POLYMATH Report          NLE 
 Nonlinear Equation 2016-May-30 

Calculated values of NLE variables
    Variable Value f(x) Initial Guess Initial f(x)
1 V 0.574892 3.2E-10 0.7 5.9E00

    Variable Value Initial Value
1 a 4.19695 4.19695
2 b 0.037371 0.037371
3 P 56 56
4 Pc 111.3 111.3
5 Pr 0.503145 0.503145
6 R 0.08206 0.08206
7 T 450 450
8 Tc 405.5 405.5
9 Z 0.871827 1.06155

Nonlinear equations
1 f(V) = (P+a/(V^2))*(V-b)-R*T = 0

Explicit equations
1 P = 56
2 R = 0.08206
3 T = 450
4 Tc = 405.5
5 Pc = 111.3
6 Pr = P/Pc
7 a = 27*(R^2*Tc^2/Pc)/64
8 b = R*Tc/(8*Pc)
9 Z = P*V/(R*T)

Problem source text
# S. 7 - Single NLE
# Molar Volume and Compress... Van Der Waals
# Verified Solution: V=0.574892, Z =0.871827
# Ref.: Comput. Appl. Eng. Educ. 6: 171-172, 1998
f(V)=(P+a/(V^2))*(V-b)-R*T
P=56
R=0.08206
T=450
Tc=405.5
Pc=111.3
Pr=P/Pc
a=27*(R^2*Tc^2/Pc)/64
b=R*Tc/(8*Pc)
Z=P*V/(R*T)
V(min)=0.4
V(max)=1

Matlab formatted problem
Create m file called PolyNle.m and paste the following text into it.
% S. 7 - Single NLE
% Molar Volume and Compress... Van Der Waals
% Verified Solution: V=0.574892, Z =0.871827
% Ref.: Comput. Appl. Eng. Educ. 6: 171-172, 1998
function PolyNle
   xguess = 0.7 ;
   x = fzero(@NLEfun,xguess);
   fprintf('The NLE solution is %g\n', x);
end

function fV = NLEfun(V)
   P = 56;
   R = 0.08206;
   T = 450;
   Tc = 405.5;
   Pc = 111.3;
   Pr = P / Pc;
   a = 27 * R ^ 2 * Tc ^ 2 / Pc / 64;
   b = R * Tc / (8 * Pc);
   Z = P * V / (R * T);
   fV = (P + a / (V ^ 2)) * (V - b) - (R * T);
end

Root function values
  V f(V)
1 0.4 -7.1077
2 0.412245 -6.67627
3 0.42449 -6.23176
4 0.436735 -5.77513
5 0.44898 -5.30726
6 0.461224 -4.82895
7 0.473469 -4.34092
8 0.485714 -3.84384
9 0.497959 -3.33831
10 0.510204 -2.82488
11 0.522449 -2.30405
12 0.534694 -1.77629
13 0.546939 -1.24201
14 0.559184 -0.70162
15 0.571429 -0.15547
16 0.583673 0.396103
17 0.595918 0.952792
18 0.608163 1.51431
19 0.620408 2.08039
20 0.632653 2.6508
21 0.644898 3.22529
22 0.657143 3.80366
23 0.669388 4.38572
24 0.681633 4.97126
25 0.693878 5.56013
26 0.706122 6.15216
27 0.718367 6.74719
28 0.730612 7.34509
29 0.742857 7.94572
30 0.755102 8.54896
31 0.767347 9.15469
32 0.779592 9.7628
33 0.791837 10.3732
34 0.804082 10.9857
35 0.816327 11.6004
36 0.828571 12.217
37 0.840816 12.8356
38 0.853061 13.456
39 0.865306 14.0781
40 0.877551 14.702
41 0.889796 15.3274
42 0.902041 15.9545
43 0.914286 16.583
44 0.926531 17.213
45 0.938776 17.8443
46 0.95102 18.477
47 0.963265 19.111
48 0.97551 19.7463
49 0.987755 20.3827
50 1 21.0203

General Settings
Total number of equations 10
Number of implicit equations 1
Number of explicit equations 9
Elapsed time 0.00 sec
Reporting digits 8
Solution method safenewt
Max iterations 150
Tolerance F 1E-07
Tolerance X 1E-07
Tolerance min 1E-07