This is a second part of my previous question. I'm trying to figure it out by myself how to deduce Hamilton's equations in classical field theory as it is usually obtained in physics books.

**Notation:** If ${\bf{x}} = (x_{1},...,x_{n}) \in \mathbb{R}^{n}$ and $f=f({\bf{x}})$ is real-valued and differentiable, I'll denote:
$$\frac{\partial f}{\partial \bf{x}} := \bigg{(}\frac{\partial f}{\partial x_{1}},...,\frac{\partial f}{\partial x_{n}}\bigg{)} \equiv \nabla f.$$

This notation is useful since, if $f$ is a function of more than one variable, e.g. $f=f(\bf{x},\bf{y},\bf{z})$, then $\partial f/{\partial \bf{x}}$ means the gradient with respect to the $\bf{x}$ variable.

## Legendre Transforms for many variable functions

Here, I'm following Arnold. Let $f: \mathbb{R}^{n}\to \mathbb{R}$ be a twice-differentiable function such that its Hessian $\nabla^{2}f$ is positive-definite (so $f$ is strictly convex). Let $G=G({\bf{p}},{\bf{x}}) := \langle {\bf{p}},{\bf{x}}\rangle - f({\bf{x}})$, where $\langle \cdot, \cdot \rangle$ is the usual inner product on $\mathbb{R}^{n}$. Then, the Legendre transform of $f$ is defined to be the function $g=g({\bf{p}}) := \max_{{\bf{x}}}G({\bf{p}},{\bf{x}})$. Notice that $G$ attains its maximum iff $\frac{\partial G}{\partial \bf{x}} = 0$, so that the vector $\bf{x}$ which maximizes $G$ for a fixed $\bf{p}$ is the solution of: \begin{eqnarray} \frac{\partial f}{\partial \bf{x}} = \bf{p} \tag{1}\label{1} \end{eqnarray}

## Classical Field Theory

I know that the more general setting of classical field theory (as well as classical mechanics) is defined in terms of manifolds and tangent bundles, but for our purposes I will work in the usual spacetime $\mathbb{R}^{4}$. In the present context, a field is a function $\phi: \mathbb{R}^{4} \to \mathbb{R}^{n}$. A point ${\bf{x}} = (x_{1},x_{2},x_{3},x_{4}) \in \mathbb{R}^{4}$ is represented by space coordinates $x_{1},x_{2},x_{3}$ and a time coordinate $x_{4} = t$. It is useful to write the equations that follow in Einstein's notation: $x_{\mu}$ denotes any coordinate of ${\bf{x}}$ and $\partial_{\mu}$ denotes the partial derivative with respect to the $\mu$-th entry, $\mu \in \{1,2,3,4\}$.

The action $S = S(\phi)$ is defined by: \begin{eqnarray} S({\bf{\phi}}) := \int L(t, \phi(t), \partial_{\mu}\phi)dt \tag{2}\label{2} \end{eqnarray} where the Lagrangian is given by an integral: \begin{eqnarray} L(t,\phi(t), \partial_{\mu}\phi) := \int \mathscr{L}({\bf{x}}, \phi, \partial_{\mu}\phi)d{\bf{x}} \tag{3}\label{3} \end{eqnarray} with $\mathscr{L}$ being the Lagrangian density.

**Question:** Is this a closed form for the Hamiltonian $H$ of such a system, given that $H$ is the Legendre transform of $L$? If there is, how to obtain it?

Let us assume that $L$ and $H$ do not depend explicitly on $t$. As far as I understand, $H$ is the Legendre transform of $L$ with respect to the variable $\dot{\phi} = \partial_{4}\phi$, so we have to perform a change $\dot{{\bf{\phi}}} \leftrightarrow {\bf{p}}$. Thus, it is natural to define $H(\phi, \frac{\partial \phi}{\partial {\bf{x}}}, {\bf{p}}) = \max_{\dot{\phi}}(\langle {\bf{p}}, \dot{\phi}\rangle - L(\phi, \frac{\partial \phi}{\partial {\bf{x}}}, \dot{\phi}))$. Using (\ref{1}), we get:

\begin{eqnarray} {\bf{p}} = \frac{\partial L}{\partial {\bf{x}}} = \frac{\partial}{\partial {\bf{x}}}\int \mathscr{L}({\bf{x}}, \phi, \partial_{\mu}\phi)d{\bf{x}} \tag{4}\label{4} \end{eqnarray}

Here is where things become unclear. Physicists usually define: \begin{eqnarray} \pi({\bf{x}}) := \frac{\partial \mathscr{L}({\bf{x}})}{\partial {\bf{x}}} \tag{5}\label{5} \end{eqnarray} so that: \begin{eqnarray} {\bf{p}} = \int \pi({\bf{x}}) d{\bf{x}} \tag{6}\label{6} \end{eqnarray} But the Hamiltonian should become:

\begin{eqnarray} H = \int \pi({\bf{x}})\dot{\phi}({\bf{x}})d{\bf{x}} - L \tag{7}\label{7} \end{eqnarray}

But this is **really** strange since the $\dot{\phi}$ seems to be being integrated together with $\pi$, and this is not the case if you put (\ref{6}) into $\langle {\bf{p}}, \dot{\phi}\rangle - L(\phi, \frac{\partial \phi}{\partial {\bf{x}}}, \dot{\phi})$.

So, **what am I doing wrong**?

canhelp with conceptual understanding is working under sufficiently liberal hypotheses so that all formal manipulations that you encounter "just work". A continuous variable should be interpreted as an index? Consider an analogous case where it is an index (e.g., spatial discretization). An integral might not converge? Suppose that all fields have compact support. Is it OK to differentiate $n$ times? Suppose everything is smooth and differentiate as much as you like. These are just some examples. $\endgroup$ – Igor Khavkine Feb 2 at 22:086more comments