-1
$\begingroup$

Hello I'm new to mathematica and I have been trying to plot an isotherm for a substance at its critical temperature, using Van der Waals equation of state. I have done all the work except I do not know why my code is not outputting the graph; it simply outputs the graph with no line in it. Any help is appreciated!

Code:

P = R*T/(v - b) - a/v^2;

Tc = (8 a)/(27 b R);
R = 0.08205;
Tc /. {a -> 5.489, b -> 0.063}
Plot[P[Tc, v, {a -> 5.489, b -> 0.063}], {v, 0, 1}, AxesLabel -> {v(*L/mol*), T(*K*)}]

P is VDW equation, Tc is the critical temperature equation with parameters a and b and I am using the Plot function to graph the isotherm.

$\endgroup$
0
$\begingroup$

The way you have your code set up, your equation for pressure never calls for the value of Tc, instead it tries to use an unknown variable you have called T.

Additionally, if you're looking to plot an isotherm, your y-axis is incorrectly labelled. It should be pressure, not temperature. When plotting, make sure you have your equation's variables defined beforehand, so as to make the code used easier to follow. Here you go:

P = R*Tc/(v - b) - a/v^2;

Tc = (8 a)/(27 b R);
R = 0.08205;
Tc /. {a -> 5.489, b -> 0.063}
Plot[P, {v, 0, 1}, AxesLabel -> {v(*L/mol*), p(*atm*)}]

Isotherm

$\endgroup$
  • $\begingroup$ Hello thank you for your response! Should this make a plot for sure? I tried it right now but nothing was outputted as well. $\endgroup$ – Pollo Oct 9 '16 at 5:13
  • $\begingroup$ Sorry my mistake it worked!!! Thank you so much! $\endgroup$ – Pollo Oct 9 '16 at 5:35
  • $\begingroup$ No problem, glad to see it all worked out for you! $\endgroup$ – BiomedPHYS Oct 9 '16 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.