Re: Limitations of RPN (was: HP-32s Engineering Applications Manual) Message #19 Posted by Karl Schneider on 16 Feb 2009, 5:23 p.m., in response to message #14 by Thomas Klemm
Quote:
The limitation of RPN is of course the restriction to 4 registers in the stack.
Hi, Thomas --
Well, no, the 4-level fixed stack is not a chracteristic or RPN per se, but rather an effective compromise of what is useful, necessary, and practical. Three levels is inadequate (which, alas, did not stop National Semiconductor in the 1970's), but most people have difficulty keeping track of more than four values in the stack.
I've advocated a settable value for fixed RPN stack depth, with mimimum = default = 4; and maximum = 9 or 19, set respectively by a command on the HP-35s such as "STKD 9" or "STKD .9". (An HP-43s might require "STKD 09" to support indirection.)
Quote:
((1 + 2)*(3 + 4) + (5 + 6)*(7 + 8))*((9 + 10)*(11 + 12) + (13 + 14)*(15 + 16)) = 236964
Neither TI-57 nor TI-59 have problems with the expression above.
Sure, as long as all the required parentheses are properly placed in the expression, and meticulously entered during calculation.
Quote:
Of course there are ways to circumvent the limitation using LASTx or other registers. But that's rather cumbersome.
1 2 + 3 4 + * 5 6 + 7 8 + * + 9 10 + 11 12 + * 13 14 + 15 16 + * + *
If the blank spaces between numbers indicate use of the "SPACE/SPC" command, that's RPL, which handles this problem just fine.
Quote:
There might be different ways to do that in RPN but it will be something like
an expression that is not too cumbersome:
1 ENTER 2 + 3 ENTER 4 + * 5 ENTER 6 + 7 ENTER 8 + * +
STO 0
9 ENTER 10 + 11 ENTER 12 + * 13 ENTER 14 + 15 ENTER 16 + * +
RCL* 0 (or RCL 0 *)
Quote:
PS: Can anybody think of an even simpler expression that can't be calculated using RPN?
If the "gotcha" does not entail limited stack depth, I'm not sure what it would be. Entering inputs when usable and reversing with x< >y, instead of left-to-right, helps to avoid the problem.
-- KS
Edited: 16 Feb 2009, 5:26 p.m.
|