Solution (source code)

= Solution

Here
$$
L_1=-c^2\phi_x,
\qquad
L_2=\phi_t,
\qquad
L_3=0,
$$
so the <Euler-Lagrange field equation> is the variable-coefficient <wave equation>
$$
\boxed{\phi_{tt}-\partial_x(c^2\phi_x)=0.}
$$
At leading order, $Φ=A(X,T)\cos\theta$ has
$$
\phi_x\sim k\Phi_\theta,
\qquad
\phi_t\sim-\omega\Phi_\theta,
$$
and hence
$$
L^{(0)}=\frac12(\omega^2-c^2k^2)\Phi_\theta^2.
$$
The leading part of the modulated-wave first integral is
$$
\partial_\theta\left[
\frac12(\omega^2-c^2k^2)\Phi_\theta^2
\right]=0.
$$
A nonconstant periodic wave therefore requires the local <dispersion relation>
$$
\boxed{\omega^2=c^2(X,T)k^2.}
$$
This is usually called the <eikonal equation>, or equivalently the leading geometric-optics dispersion relation.