Van der Waals Gas

The equation of state of a Van der Waals gas is:

P = ((N*R*T)/(V - N*b)) -  (((N^2)*a)/(V^2))

Note the explicit use of the multiplication symbol (*).  Execute the above command so that P is defined.  Now let's have fun.  Let's try to plot it.  The following won't work: (do you know why?)

Plot[P, {V, 0, 1}]

Computers  can only plot numbers.  We've got to reduce this do dimensionless form.  That means we scale the physical variables V, T and P and get a new equation with no physical units.  The obvious thing to simplify the first denominator is:

p = P /. V -> N*v*b

We can fix the temperature.

p = p /. T -> t*a/b

Now let's do it again, a bit more cleanly.

p = (P /. V -> N*v*b /. T -> t*a/(R*b))*(b^2)/a

p = Simplify[p]

Now we can plot!  Of course, we have to fix the value of t.

Plot[(p /. t -> 1/4), {v, 1.2, 10}]

Here are several plots.

Plot[{p /. t -> 1/5, p /. t -> 1/4, p /. t -> 1/3, p /. t -> 1/2}, {v, 
        1.2, 10}]

We can calculate the derivatives of P:

D[D[P, V], V]D[P, V]

Mathematica will find the position of the extrema for us.

Solve[D[P, V] == 0, {V}]

Note very useful though.... Maybe we can find the critical point.  That's where both the first and second derivative are zero.

Solve[{D[P, V, V] == 0, D[P, V] == 0}, {V, T}]

In the dimensionless equation of state.

Solve[{D[p, v, v] == 0, D[p, v] == 0}, {v, t}]

Let's check:

Plot[p /. t -> 8/27, {v, 1.4, 10}]

Ok, let's look at the whole surface:

Plot3D[p, {t, 0, 1}, {v, 1.5, 6}, PlotRange -> All]