Print ["\n Maxwell Construction for the van der Waals
gas \n"]
Clear["Global`*"]
Print[" Commands:"]
menu:=(Print["\n
menu => This menu \n\n
critical => Critical parameters of the van der Waals gas \n\n
plot[T] => Isotherm of the van der Waals gas at temperature T \n
e.g. plot[0.85] => Original (unphysical) isotherm \n
and Maxwell Construction"])
menu
pp=t/(v-b)-a/v^2
eq1=D[pp,v]==0
eq2=D[pp,{v,2}]==0
sol=Solve[{eq1,eq2},{t,v}]
pc=pp/.sol[[1]]
critical = Join[sol[[1]],{Rule[p,pc]}]
p[v_] = 8 t/(3 v-1)-3/v^2
Off[Integrate::gener]
eq3 = p[v1]==p[v3]
eq4 = p[v1]*(v3-v1)==Integrate[p[v],{v,v1,v3}]
On[Integrate::gener]
pmax[v_]:=If[v < vleft || v > vright, p[v], p[vleft]]
plot[T_]:= Block[{}, t = T;
If[ t >= 1,
Plot[p[v], {v, .34, 50.},
PlotRange -> {{0,50},{0,2}},
Frame -> True,
FrameLabel -> {"v","p"}],
vmin = v /. FindMinimum[ p[v], {v,0.4}][[2]];
vmax = v /. FindMinimum[-p[v], {v,1.}][[2]];
vtest = (vmin + vmax)/2 ;
r = Solve[ p[v] == p[vtest], v];
v1start = v /. r[[1]];
v3start = v /. r[[3]];
frs = Chop[FindRoot[{eq3,eq4},{v1,v1start},
{v3,v3start}]];
vleft=v1/.frs; vright=v3/.frs;
Plot[{pmax[v],p[v]},{v,0.34,50.},
PlotRange->{{0,50},{0,2}},
Frame -> True, FrameLabel -> {"v","p"} ]]]
plot1=plot[.85];plot2=plot[.92];plot3=plot[.95];plot4=plot[1];plot5=plot[1.05];
Show[plot1,plot2,plot3,plot4,plot5];
![[Graphics:webnbgr1.gif]](webnbgr1.gif)
pts0=imported data
{Vdata0,Pdata0}=Transpose[pts0];
a=4.6368 (atm*L^2/mol^2)
b=0.0436111 (L/mol)
moles=5.315*10^-4;
R=.08206;
Pc0=a/(27*b^2);
Vc0=3*b;
Tc0= 8*a/(27*b*R);
Vdata1=Vdata0/moles;
PdataN2=Pdata0/Pc0;
VdataN2=Vdata1/Vc0;
pts0=Transpose[{VdataN2,PdataN2}];
dataPlot0=ListPlot[pts0];
plot1=plot[273/Tc0];
Show[plot1,dataPlot0,PlotRange->{All,{0,.5}}];
pts1=imported data
{VdataS0,PdataS0}=Transpose[pts1];
a1=5.4 (atm*L^2/mol^2)
b1=0.046511 (L/mol)
moles1=6.585*10^-4;
R1=.08206;
PcS0=a/(27*b1^2);
VcS0=3*b1;
TcS0= 8*a1/(27*b1*R);
VdataS1=VdataS0/moles1;
PdataNS1=PdataS0/PcS0;
VdataNS1=VdataS1/VcS0;
pts1=Transpose[{VdataNS1,PdataNS1}];
dataPlotS0=ListPlot[pts1];
plotS1=plot[273.15/TcS0];
Show[plotS1,dataPlotS0,PlotRange->{All,{0,.4}}];
<<Go back to the theory behind our experiment Venture forth to our Conclusions>>