## Notebook 1.2 – Solving Equations of State (Molar Volumes of Model Gases)

January 14, 2010The Euler notebook posted below asks students to solve various gaseous equations of state for molar volume. This is a common task that’s quite easily done with a computer algebra system, but difficult and tedious to do with pencil and paper.

To use the notebook:

- Download and install the Euler Math Toolbox.
- Cut and paste the code below into a plain text file.
- Save the file with an .en file extension.
- Double-click the file. It should open up in the Toolbox.

I used this in my Fall ‘09 PChem class (the third in the series). Italics mark the items students had to fill in themselves. They had less trouble with this one, although command line syntax was still a source of confusion and frustration. They wanted to type something like root(R*T/V-P,V) or root(RT/V-P,V) instead of root(“R*T/V-P”,V).

All of the notebooks in this series are specifically keyed to Atkins’ Physical Chemistry, 8th edition.

----------------------------snip here---------------------------------------------

Notebook 1.2 - Molar Volume of Model Gases (Solving Equations of State)

`%
% In this task, we'll use Euler to numerically solve equations of state.
% Study Example 1.4 on page 18 of Atkins, which estimates the molar
% volume of CO2 at 500 K and 100 atm by treating CO2 as a van der Waals
% gas.
%
% To solve this problem in Euler, set up constants in any convenient
% units (in this case, dm^3 for volume, atm for pressure, and K for
% temperature:
>R = 0.082059;
>a = 3.592;
>b = 4.267e-2;
>T = 500;
>P = 100;
%
% Now cast the equation into a form that looks like f(x) = 0.
% Atkins rearranges the van der Waals equation into polynomial
% in V:
% V^3-(b+R*T/P)*V^2 + (a/P)*V - a*b/P = 0.
% but that really isn't necessary. *Any* rearrangement of the equation
% we want to solve that puts zero on one side of the equation will work.
%
% To solve the equation in Euler, we'll need an initial guess for V.
% The ideal gas volume will do.
>V = R*T/P
0.410295
%
% Now use Euler's 'root' function, which looks like
% root("expression",x)
% where expression (enclosed in double quotes) is the nonzero side of the
% equation we want to solve, and x is the variable in that expression we
% want to solve for.
%
>root("V^3-(b+R*T/P)*V^2 + (a/P)*V - a*b/P",V)
0.3663332616871
%
% Note that root has reset the value of V:
%
>V
0.3663332616871
%
% Atkins started with the equation
% P = R*T/(V-b) - a/V^2
% We could have subtracted P from both sides of this equation to more
% simply cast it into the f(x) = 0 form:
%
>root("R*T/(V-b)-a/V^2-P",V)
0.3663332616871
%
% Atkins claims that a perfect gas under these conditions has a molar
% volume of 0.410 dm^3/mol. We can verify this by typing
%
>root("R*T/V - P", V)
0.4102949999999
% ---------------------------------------------------------------------
% TASK 3. Use this second approach to calculate the molar volume of
% argon in dm^3 per mole at 100 degrees Celsius and 100 atm, on the
% assumption that it's
% A) an ideal gas;
% B) a hard sphere gas (assuming that each molecule is a
% sphere with radius of 0.15 nm);
% C) a van der Waals gas;
% D) a Dieterici gas;
% E) a virial gas (ignoring all virial coefficients beyond B).
%
>T = 100+273.15;
>P = 100;
%
% 3A) The molar volume as an ideal gas:
%
`

*>V = R*T/P 0.3062031585*% % 3B) The molar volume as a hard sphere gas, with radius 0.15 nm: % HINT: In Euler, the constant pi is written as %pi % HINT: What units should you put b into % if V is in dm^3/mol? %

*>r = 0.15*1e-9/1e-1; >NA = 6.022e23; >b = 4*(4/3)*%pi*r^3*NA; >root("R*T/(V-b)-P",V) 0.3402567662277*% % 3C) The molar volume as a van der Waals gas: %

*>a = 1.337; >b = 3.20e-2; >root("(P+a/V^2)*(V-b)-R*T",V) 0.2981759820445*% % 3D) The molar volume as a Dieterici gas: % HINT: See Table 1.7 in Atkins. % HINT: a and b for the Dieterici gas are NOT the same as % a and b for a van der Waals gas! % HINT: All of the expressions in the Critical Constants columns % in Table 1.7 are equal. % HINT: In Euler, the constant e is written as %e % HINT: In Euler, e^x can be written as exp(x) %

*>B = 3*b/2; >A = 4*%e^2*B^2*a/(27*b^2); >root("R*T*exp(-A/(R*T*V))/(V-B)-P",V) 0.245635997406*% % 3E) The molar volume as a virial gas (with all virial coefficients % beyond B ignored) % HINT: Watch your units; what should the units of B be, if V % should be in dm^3/mol? % HINT: B varies with temperature. %

*>B = -4.2/1000; >root("(R*T/V)*(1+B*P)-P",V) 0.17759783193*----------------------------snip here---------------------------------------------

## Leave a Reply