|Follow-up: RPN "SOLVE" vs. RPL "ROOT"|
Message #5 Posted by Karl Schneider on 25 Jan 2004, 5:06 a.m.,
in response to message #4 by Karl Schneider
This is a follow-up to an answer I posted to Felix' question about how to utilize the root-finding solver on the 49G using only stack arguments, not menus.
Try ROOT, e.g.,
Answer of 6.30152 is returned in "radians" angular mode.
I subsequently discovered that the root-finding algorithm on the RPL 48/49 machines ("ROOT") works like the one on the RPN machines ("SOLVE/SOLVER"). Also, ROOT is similar to SOLVE on the 32S/ii and 42S in that the first guess is to be loaded into the variable to be solved for, while the second guess is put onto the stack.
On earlier RPN machines, the variable to be solved is taken from the x-register at the beginning of the function, so both initial guesses are put onto the stack in the x- and y-registers.
ROOT seems to have lost one refinement from SOLVE -- if no root is found in SOLVE, an error message is given. However, if no root is found by ROOT, it just blithely returns the closest answer it could find, without any message. (Is there a "solve failed" flag I don't know about?
The equation I gave has the following points of interest:
x f(x) remark
2.51399621560 0.22224030507 local min
4.61300597767 1.09428505564 local max
6.30152146492 0 first root
On all units, guess-pairs to the left of the local max will cause ROOT/SOLVE to stop at the local min. The 15C gives "Error 8"; the 41C Advantage gives "NO"; the 32Sii gives "NO ROOT FND"; the 42S says "Extremum".
ROOT on the 28C/48G/49G give no such disclaimers.
ROOT/SOLVE tend to find the first root with guesses to the right of the local max, although ROOT is more likely to find higher roots with guesses near the flat area around the local max.