Now, we go from just a time-dependent function like q or p to a “field” that is dependent on both temporal and spatial components:

.

The field can be imagined as:

where the field points can move up & down (we neglect horizontal motion).

Lagrangian Formulation

Then, we can write the action as,

.

But, due to locality (the fact that it takes time for the effect to be felt) the field at does not get influenced directly and instantaneously by the field at some . So, the term becomes zero. Hence, let us introduce Langrangian Density .

If we introduce a small deviation in the action,

Note that the second term cancels for Dirichlet boundary conditions and on assuming that , the third term also goes to zero.

Then, we can extract the field equations as,

.

We can rewrite this as

.

Hamiltonian Formulation

such that the canonical coordinate is

.

We define the Hamiltonian Density as .

We can now write the Hamiltonian as

.

Now the equations of motion follow from theLegendre inverse transform such that

.

Poisson Bracket has a generalisation,

.