Solution (source code)

= Solution

The one-dimensional <Isentropic Euler equations> are
$$
\rho_t+u\rho_x+\rho u_x=0,
\qquad
u_t+uu_x+\frac1\rho p_x=0.
$$
For the <polytropic equation of state>,
$$
c^2=\frac{dp}{d\rho}=\frac{\gamma p}{\rho},
\qquad
\frac c{c_0}=\left(\frac\rho{\rho_0}\right)^{(\gamma-1)/2}.
$$
The continuity equation therefore implies
$$
c_t+uc_x+\frac{\gamma-1}{2}cu_x=0,
$$
while the momentum equation becomes
$$
u_t+uu_x+\frac{2c}{\gamma-1}c_x=0.
$$
Adding and subtracting these equations gives
$$
\left[\partial_t+(u\pm c)\partial_x\right]
\left[u\pm\frac{2(c-c_0)}{\gamma-1}\right]=0.
$$
Thus the <Riemann invariants>
$$
\boxed{R_\pm=u\pm\frac{2(c-c_0)}{\gamma-1}}
$$
are constant along the <characteristic curves>
$$
\boxed{C_\pm:\quad\frac{dx}{dt}=u\pm c.}
$$