Solution (source code)

= Solution

If $P\,dx+Q\,dy=dF$ for a twice continuously differentiable potential $F$, then $P=F_x$ and $Q=F_y$. Equality of <mixed partial derivatives> gives the necessary condition for an <exact differential>:
$$
\boxed{P_y=Q_x.}
$$
This condition alone does not ensure global exactness on a domain with holes.

For the <Helmholtz free energy> $A=U-TS$, use the stated identity for <internal energy> and the <product rule>:
$$
dA=dU-T\,dS-S\,dT=-S\,dT-p\,dV.
$$
Thus $A_T|_V=-S$ and $A_V|_T=-p$. Equality of <mixed partial derivatives> yields the <Maxwell relation>
$$
\boxed{\left(\frac{\partial S}{\partial V}\right)_T=\left(\frac{\partial p}{\partial T}\right)_V.}
$$
The <temperature> and <volume (thermodynamics)> are the independent variables here, with composition and amount of gas fixed.

Next express $S=S(T,V)$ and substitute its <total differential> into $dU=T\,dS-p\,dV$:
$$
dU=T\left(\frac{\partial S}{\partial T}\right)_VdT+\left[T\left(\frac{\partial S}{\partial V}\right)_T-p\right]dV.
$$
Matching the coefficient of $dV$ gives
$$
\boxed{\left(\frac{\partial U}{\partial V}\right)_T=T\left(\frac{\partial S}{\partial V}\right)_T-p=T\left(\frac{\partial p}{\partial T}\right)_V-p.}
$$
This is the <thermodynamic internal pressure> identity: an <equation of state> determines how <internal energy> changes under an isothermal change of <volume (thermodynamics)>.

For the <Dieterici equation>, set $c=an/(VR)$ while differentiating at fixed $V$. Then
$$
p=\frac{nR}{V-nb}Te^{-c/T},\qquad\left(\frac{\partial p}{\partial T}\right)_V=\frac{nR}{V-nb}e^{-c/T}\left(1+\frac cT\right).
$$
Substitute into the <thermodynamic internal pressure> identity. The term proportional to $T$ cancels $p$, leaving
$$
\boxed{\left(\frac{\partial U}{\partial V}\right)_T=\frac{an^2}{V(V-nb)}\exp\left(-\frac{an}{VRT}\right).}
$$
The physical gas domain has $T>0$ and $V>nb$.

For the <ideal gas> instead, $p=nRT/V$ gives $T(\partial p/\partial T)_V-p=0$. Therefore $U$ is independent of <volume (thermodynamics)> at fixed amount of gas. Integrating the remaining condition $(\partial U/\partial T)_V=C_V$, with constant <heat capacity at constant volume>, gives
$$
\boxed{U(T,V)=C_VT+U_0,}
$$
where $U_0$ is independent of both $T$ and $V$ and fixes the reference for <internal energy>.