Problem 2 - Linearized Model: Cubic Equation of State (15 pts)
The van der Waals (vdW) cubic equation of state is a model that describes the thermody-
namic properties of a non-ideal gas using two parameters a and b :
P=(RT)/(V_(m)-b)-(a)/(V_(m)^(2))
where P is the pressure, R is the gas constant, T is the temperature, and V_(m) is the molar vol-
ume.
We would like to use linear regression to solve for the parameters of the model in the case of
methane gas. Experimental data for the pressure as a function of molar volume is provided in
the "eos-data.dat" file. All data was collected at T=300K. However, since the equation of
state is not linear with respect to the parameters, a linearized version should be derived first.
(a) Derive a linearized form of the vdW equation of state shown above. There are several
ways to linearize the equation of state. However, some methods are better than
others; aim for three unknowns where one is technically a function of the other two. Fi-
nally, rewrite into general matrix form (Ax=b) where x is the vector of unknowns.
(b) Using Python and the matrix method for linear least squares regression, solve and re-
port the model parameters for a and b. Sanity check that your third unknown is close
to its expected value based on the fit values of a and b.
(c) Code a function in Python that computes an array of pressures given an array of molar
volumes and the model parameters a and b. Use this function to plot the model predic-
tions against the experimental data for the pressure of methane.
(d) Finally, discuss if other direct solvers, e.g., Gaussian Elimination, and iterative solvers,
e.g., Gauss-Seidel, would be appropriate for this problem. Explain your reasoning with
evidence.
"eos-data.dat" file content:
# Vm(L/mol) P(bar)
0.100 207.621
0.127 154.076
0.162 121.974
0.207 98.645
0.264 80.085
0.336 64.848
0.428 52.274
0.546 41.941
0.695 33.509
0.886 26.677
1.129 21.175
1.438 16.769
1.833 13.254
2.336 10.460
2.976 8.245
3.793 6.493
4.833 5.109
6.158 4.018
7.848 3.159
10.000 2.482Problem 2 - Linearized Model: Cubic Equation of State (15 pts)
The van der Waals (vdW) cubic equation of state is a model that describes the thermody-
namic properties of a non-ideal gas using two parameters a and b :
P=(RT)/(V_(m)-b)-(a)/(V_(m)^(2))
where P is the pressure, R is the gas constant, T is the temperature, and V_(m) is the molar vol-
ume.
We would like to use linear regression to solve for the parameters of the model in the case of
methane gas. Experimental data for the pressure as a function of molar volume is provided in
the "eos-data.dat" file. All data was collected at T=300K. However, since the equation of
state is not linear with respect to the parameters, a linearized version should be derived first.
(a) Derive a linearized form of the vdW equation of state shown above.
Let's define a new variable, (z=(V)/(V-b)). So,
the equation becomes:
P=(RT)/(z-1)-(a)/((z-1)^(2))
(eta =(a)/(R^(2)T^(2))) and ,(alpha =(b)/(RT)).
The equation now reads:
P=(RT)/(z-1)-(a)/((z-1)^(2))=(RT)/(z)-(a)/(z^(2))
Create new variables:
(x_(1)=(T)/(z)),(x_(2)=z), and ,(x_(3)=(1)/(z))
The equation can be rewritten as follows:
P=Rx_(1)+eta x_(2)+alpha x_(3)
This equation is now linear in relation to the
parameters alpha, beta, and R.
Finally, rewrite this equation in the general
matrix form (Ax=b),
Start Answering from here using the equation above
(b) Using Python and the matrix method for linear least squares regression, solve and re-
port the model parameters for a and b. Sanity check that your third unknown is close
to
Problem 2-Linearized Model:Cubic Equation of State(15 pts)
The van der Waals (vdW cubic equation of state is a model that describes the thermody namic properties of a non-ideal gas using two parameters a and b:
RT
Vm-bVm
where P is the pressure,R is the gas constant,T is the temperature,and Vm is the molar vol ume.
We would like to use linear regression to solve for the parameters of the model in the case of methane gas. Experimental data for the pressure as a function of molar volume is provided in the "eos-data.dat"file.All data was collected at T = 300 K. However, since the equation of state is not linear with respect to the parameters, a linearized version should be derived first.
(a Derive a linearized form of the vdW equation of state shown above
Solution
- The original van der Waals (vdW) equation of state is: (P=RT -)
Let's define a new variable, (z = v). So, the equation becomes:
P=RT-
3=R) anda=RT
The equation now reads: [-=-=a]
Create new variables: =xpuz=x=Ix
The equation can be rewritten as follows:
[P = Rx1 + x2 + x3]
This equation is now linear in relation to the parameters alpha, beta,and R.
Finally, rewrite this equation in the general matrix form (Ax = b),
Start Answering from here using the equation above
(b Using Python and the matrix method for linear least squares regression, solve and re- port the model parameters for a and b.Sanity check that your third unknown is close to its expected value based on the fit values of a and b. (c) Code a function in Python that computes an array of pressures given an array of molar volumes and the model parameters a and b.Use this function to plot the model predic- tions against the experimental data for the pressure of methane. (d) Finally, discuss if other direct solvers, e.g., Gaussian Elimination, and iterative solvers, e.g., Gauss-Seidel, would be appropriate for this problem. Explain your reasoning with evidence.