Hello, I seem to be having trouble writing for a problem I'm having. I need to find Specifi Volumes of Carbon Dioxide from the Van der Waals equation, using the Newton method, over a process of constant Temperature and variant Pressure. I am using Mathematica; I'm not very strong at coding in general and am fairly new to Mathematica.
I have figured out how to find a single value for the Specific Volume given a set Pressure. However I am having trouble coding over the pressure change.
I want The pressure to change from 3.9atm to 59atm. Another issue I seem to be having is it spits our odd answers for Specific Volume if the Temperature is above 329 or the Upper limit of Pressure is above 55. I need T=333K and the upper Pressure=59.2.
Here is my code and output, the example pressure is at 10atm:
a = 1.36;
b = .003183;
R = .0820578;
T = 329;
P = 10;
atmA = 3.9;
atmB = 59.21;
F[vi_] = vi - {{P + {a/vi^2}} {vi - b} - {R*T}}/{P - {a/vi^2} + {2 a*
b/vi^3}}
FindRoot[F[vi] == 0, {vi, 5}, WorkingPrecision -> 5]
{{{-((-26.997 + (10 + 1.36/vi^2) (-0.003183 + vi))/(
10 + 0.00865776/vi^3 - 1.36/vi^2)) + vi}}}
{vi -> 2.6512}
Ignoring these previous issues, my attempt to solve the problem was to use a double integral. However that has gotten nowehere.
a = 1.36;
b = .003183;
R = .0820578;
T = 329;
atmA = 3.9;
atmB = 59.21;
Integrate[
vi - {{P + {a/vi^2}} {vi - b} - {R*T}}/{P - {a/vi^2} + {2 a*
b/vi^3}}, {p, atmA, atmB}, {vi, 0, p}]
{{{4652.6 + 63.0819 I}}}
Thanks for your help. I know I'm very lost and attempting to teach me may be a hurdle