Solution (source code)

= Solution

For a free <real scalar field>, the <Lagrangian density> contains its quadratic <kinetic term> and <mass term>:
$$
\boxed{\mathcal L_1=\frac12\partial_\mu\phi_1\partial^\mu\phi_1-\frac12m_1^2\phi_1^2
=\frac12\dot\phi_1^2-\frac12|\nabla\phi_1|^2-\frac12m_1^2\phi_1^2.}
$$
The field's conjugate momentum is $\pi_1=\partial\mathcal L_1/\partial\dot\phi_1=\dot\phi_1$. The positive sign of the time-derivative term uses the metric convention fixed in Question 1.