# Express V in terms of P for equation of state

This is the equation of state

$$\left(P + \frac{n^2*a}{V^2}\right)(V-nb)=nRT$$

where a, b, n, R, T are constants.

The actual question is to calculate $\frac{dV}{dP}$, so in order to do that I'm first trying to solve the above function for V in terms of P.

What I did so far:

1. simplify by eliminating brackets
2. move terms with V to the left and without to the right

What I end up with is a 3rd power polynomial

$$PV^3-(nbP+nRT)V^2 + n^2aV = n^3ab$$

and I don't know how to proceed. Usually I factor out the variable in question and divide by the other factor, but that isn't applicable this time.

• This belongs on math.se or possibly physics.se But that approach isn't going to work. Just look at this: wolframalpha.com/input/… – Feyre Sep 20 '16 at 17:12
• allright, so that approach is unfeasible. I guess at least I can move on. – ttdijkstra Sep 20 '16 at 18:42

\begin{align*} \left(p+\frac{an^2}{V^2} \right)(V-nb) &= nRT \\ \left(p+\frac{an^2}{V^2} \right) \frac{\partial}{\partial V}(V-nb)+ (V-nb) \frac{\partial}{\partial V}\left(p+\frac{an^2}{V^2} \right) &= \frac{\partial}{\partial V} (nRT) \\ \left(p+\frac{an^2}{V^2} \right)+(V-nb) \left[ \left( \frac{\partial p}{\partial V} \right)_{T}- \frac{2an^2}{V^3} \right] &= 0 \\ \left( \frac{\partial p}{\partial V} \right)_{T} &= \frac{2an^2}{V^3}-\frac{nRT}{(V-nb)^2} \\ \left( \frac{\partial V}{\partial p} \right)_{T} &= \frac{1}{\left( \frac{\partial V}{\partial p} \right)_{T}} \\ &= \frac{V^3(V-nb)^2}{2an^2(V-nb)^2-nRTV^3} \end{align*}

• This looks like what I want, but could you elaborate what your reasoning is? I don't follow. – ttdijkstra Sep 21 '16 at 6:27

If I have not make any error, here is what I think you are waiting for. First set the constants

SetAttributes[a, Constant]
SetAttributes[n, Constant]
SetAttributes[R, Constant]
SetAttributes[b, Constant]
SetAttributes[T, Constant]

eq := (P[V] + ( a n^2)/V^2) (V - n b) - n R T == 0


Then Dt[eq, V] is the derivative of the lhs of the equation according to V

Solve[Dt[eq, V], P'[V]]

Dt[eq[V], V]


is the derivative or eq[V] according to V. Have a look at it. Then

sol = Solve[Dt[eq[V], V], P'[V]]


is your answer. You can go further in substituting its value to P that is

FullSimplify[sol[[1, 1, 2]] /. P[V] -> Solve[ (P + ( a n^2)/V^2) (V - n b) - n R T == 0 , P][[1, 1, 2]]]

• If you do not want to write P[V], but only P, you will be oblige to substitute Dt[P,V] to P'[V] – cyrille.piatecki Sep 20 '16 at 19:22