Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.2K Views
|
8 Replies
|
0 Total Likes
View groups...
Share
Share this post:

while loop issues

POSTED BY: Derek du Plessix
8 Replies
Posted 12 years ago
POSTED BY: David Keith

I realized that the condition which had to be met was: Abs[Y -Y1] < 10^-4, in other words F/Fpr < 10^-4 not Y1 < 10^-4. Thank you, your post was really helpful because now I know a procedure to follow when I need to figure out what's going on. Best regards,

Derek du Plessix

POSTED BY: Derek du Plessix
Posted 12 years ago
POSTED BY: David Keith
POSTED BY: Derek du Plessix
Posted 12 years ago

Inside the while loop, you probably want to replace the double equal signs with single equal signs and put the semicolon and the end of those lines.

POSTED BY: Gustavo Delfino
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
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]
Y1
POSTED BY: Derek du Plessix

What you show is an image, and that cannot be cut and pasted into Mathematica. SO it's not really possible for anyone to experiment with the code.

POSTED BY: Daniel Lichtblau

Thank you for your time, I've added the code.

POSTED BY: Derek du Plessix
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard