This is a numerical analysis problem that I should know the answer to, but for some reason, I am all over the shop...
I have a grid of $\rho$ and $T$ values, with $\rho > 0$ and $T \ge 0$. At each grid point I have values for the functions $e(\rho,T)$ and $p(\rho,T)$.
I need to calculate a third value $S(\rho,T)$ at every grid point, where $S$ satisfies:
$\text{d}e = T\text{d}S + \frac{p}{\rho^2}\text{d}\rho;\ \ \ S(\rho,0) = 0$
My approach so far has been:
$\int_A^B \text{d}S = \int_A^B \frac{1}{T} \text{d}e - \int_A^B \frac{p}{\rho^2T} \text{d}\rho$
and then computing this numerically, but it is not giving me sensible answers. Any thoughts?
EDIT: The equation is the second law of thermodynamics, where $e$ is internal energy, $T$ is temperature, $\rho$ is density, $p$ is pressure and $S$ is entropy.