Computing the Jacobian of the Euler equations Given the Euler equations 
$$
\frac{\partial q}{\partial t}+\frac{\partial f(q)}{\partial x}=0,\qquad q=\begin{pmatrix}\rho\\\rho u\\\rho e\end{pmatrix}, \qquad f(q)=\begin{pmatrix} \rho u\\\rho u^2+p\\\rho u(e+\frac{p}{\rho})\end{pmatrix},
$$
where $e$ is the energy computed with
$$
e = \frac{1}{\gamma-1}\frac{p}{\rho}+\frac{u^2}{2},
$$
I have to compute the Jacobian matrix $J=\frac{df(q)}{dq}$. However, I have trouble to compute terms like
$$
\frac{\partial f_2(q)}{\partial q_2}= \frac{\partial \rho u^2}{\partial \rho u} = u + \rho u\frac{\partial u}{\partial \rho u}.
$$
The second term in the righthand side is unequal to 0, since if $\rho u$ changes, $u$ does not have to remain constant. However, I do not know how to continue from here.
 A: Presumably you need the Jacobian to solve a linearized approximation of the Euler equations.
The independent variables are $q_1 = \rho$, $q_2 = \rho u$, and $q_3 = \rho e$.
First, express pressure $p$ and all of the components of $f(q)$ in terms of the independent variables. Rearranging the equation-of-state, the pressure is given by
$$\begin{align}p &= (\gamma -1) \rho e - \frac{\gamma -1}{2}\rho u^2 \\ &= (\gamma -1) \rho e - \frac{\gamma -1}{2}\frac{(\rho u)^2}{\rho} \\ &= (\gamma -1) q_3 - \frac{\gamma -1}{2}\frac{q_2^2}{q_1}\end{align}.$$
The components of $f(q)$ translate to
$$\begin{align}f_1(q) &= \rho u \\ &= q_2  \\ f_2(q) &= \rho u^2 + p \\ &= \frac{q_2^2}{q_1} + (\gamma -1) q_3 - \frac{\gamma -1}{2}\frac{q_2^2}{q_1} \\  f_3(q) &= \rho u \left( e + \frac{p}{\rho}\right) \\ &= \frac{q_2 q_3}{q_1} + (\gamma -1) \frac{q_2q_3}{q_1} - \frac{\gamma -1}{2}\frac{q_2^3}{q_1^2}\end{align}.$$
Then find the partial derivatives with respect to $q_1$, $q_2$ and $q_3$  to compute the Jacobian.
For example,
$$\frac{\partial f_2(q)}{\partial q_2} = \frac{2 q_2}{q_1}- (\gamma -1)\frac{q_2}{q_1} = 2u - (\gamma-1)u.$$
