Hi Derek,
I did some syntax correction and divided your code into 3 sections. The first establishes initial values for the iterations. The second performs the iterations 10 times and accumulates the Y1 results. It shows that the iterations quickly take Y1 to a stable value greater than the termination condition. The third it the while loop, but of course it does not terminate. I don't know enough of the fundamentals to suggest more. perhaps other initial conditions would behave differently, but maybe not.
Kind regards,
David
PS. In Mathematica, it is good to use variable names starting with lower case, since reserved words all begin with upper.
In[1]:= (* set up initial values *)
gamma = 21/28.96;
P = 2000;
T = 581.67;
Tpc = 168 + 325*gamma - 12.5*gamma^2;
Ppc = 667 + 15*gamma - 37.5*gamma^2;
Tpr = T/Tpc;
t = 1/Tpr;
Ppr = 2000/Ppc;
X1 = -0.06125*Ppr*t*Exp[-1.2*(1 - t)^2];
X2 = (14.76*t - 9.76*t^2 + 4.58*t^3);
X3 = (90.7*t - 242.2*t^2 + 42.4*t^3);
X4 = (2.18 + 2.82*t);
Y = 0.0125*Ppr*t*Exp[-1.2*(1 - t)^2];
F = X1 + (Y + Y^2 + Y^3 + Y^4)/(1 - Y)^3 - X2*Y^2 + X3*Y^X4;
Fpr = (1 + 4*Y + 4*Y^2 - 4*Y^3 + Y^4)/(1 - Y)^4 - 2*X2*Y +
X3*X4*Y^(X4 - 1);
Y1 = Y - F/Fpr;
In[17]:= (* do the first 10 iterations and accumulate Y1 in a list *)
y1Values = {};
Do[
Y = Y1;
F = X1 + (Y + Y^2 + Y^3 + Y^4)/(1 - Y)^3 - X2*Y^2 + X3*Y^X4;
Fpr = (1 + 4*Y + 4*Y^2 - 4*Y^3 + Y^4)/(1 - Y)^4 - 2*X2*Y +
X3*X4*Y^(X4 - 1);
Y1 = Y - F/Fpr;
AppendTo[y1Values, Y1],
{10}
]
In[19]:= (* appears to stagnate with 0.147417 a stable value for y1 *)
\
y1Values
Out[19]= {0.14882, 0.147323, 0.147424, 0.147417, 0.147417, 0.147417, \
0.147417, 0.147417, 0.147417, 0.147417}
In[20]:= (* the While will not terminate *)
While[Abs[Y1] > 10^-4,
Y = Y1;
F = X1 + (Y + Y^2 + Y^3 + Y^4)/(1 - Y)^3 - X2*Y^2 + X3*Y^X4;
Fpr = (1 + 4*Y + 4*Y^2 - 4*Y^3 + Y^4)/(1 - Y)^4 - 2*X2*Y +
X3*X4*Y^(X4 - 1) ;
Y1 = Y - F/Fpr
];
Out[20]= $Aborted