A procedure named curve(x) in the attached worksheet solves several equations, each dependent on the solution to the previous equation. The problem is that when I issue the plot command for a range of the dependent variable x, the equation result that gets plotted is not for the result of the solution to the last equation for P. Specifically, I would like to issue the "plot(curve,0.0..0.5, <other format commands>);" and get a plot of k vs. P. Currently the plot is of k vs. P_bar. Your comments are appreciated.
View 4865_Procedure Results.mw on MapleNet or Download 4865_Procedure Results.mw
View file details
Are you sure?
Why do you believe the plot is of k vs. P_bar?
If, in the definition of curve, you remove the definition of P, the plot is different. Create a copy of curve, say curve2, but remove the definition of P_bar. Then, plot both curve and curve2. Here's the command I used:
The shapes are similar, but the plotted points are clearly different.
Am I missing something?
Doug
Mea culpa, however...
Doug,
You are exactly right, I was not reading the plotted results correctly; however, assuming I did want to plot (or otherwise use the value of P_bar in an expression), does the fact that I have declared it as a global variable mean that it retains it's value outside of the procedure?
Thank you for your comments (and patience).
Wayne J. Bell AREVA NP, Inc. Charlotte, North Carolina
P and P_bar
The result returned by a procedure is the result of the last statement it executes.
In your case the procedure curve returns the value of P because that's the last thing it calculates. As a side effect it also assigns values to the global variables P_bar and P. But of course those values will be overwritten the next time curve is called.