|Re: Sample problems to evaluate RPL vs. RPN "objectively"|
Message #19 Posted by Valentin Albillo on 22 Feb 2006, 6:48 a.m.,
in response to message #1 by Gene
"I'd like to ask for input from our community here to see if there are some sample problems we could pose that would allow us to evaluate the effectiveness and efficiency of RPL vs. 4-level stack RPN."
Though interesting, I'd say this is an exercise in futility, because the RPN vs. RPL topic, which has been discussed ad nauseam, probably belongs to the same class as politics, religion, nationality, local mores, etc. The ones who idolize one will despise the other no matter how many examples you care to provide or no matter how rationally you want to discuss the subject, and you're certain to make no converts no matter how good your arguments. For each example favorable to one of them, someone will provide an example favorable to the other, and at the end we all will agree to disagree, if at that.
"For example, suppose we said one of the problems was to compute the roots to a quadratic equation given a, b, and c in the stack. I'd like to see the RPN approach and the RPL approach to see if they can be remotely objectively evaluated for clarity, efficiency, and general usefulness to the
average (NOTE THAT) user. :-)"
Actually, irrelevant. The average user would be best served by the simple HP-71B version (or any vintage SHARP handheld for that matter)
D=SQR(B*B-4*A*C) @ (-B+D)/2/A, (-B-D)/2/A
which can run rings around any RPN or RPL version in terms of efficiency and simplicity, requires no mental conversion, and requires no programming, just a command-line statement.
Anyway, if you still insist in comparing a once useful but now obsolete system to perform calculations to an aberrant, obfuscated system to do the same, you should focus in programs which show off their differences to the best. For instance, if you want to highlight RPN, you must seek examples which:
- Make good use of automatic stack replication, i.e., T is replicated whenever the stack drops. A great example for this would be arbitrary (and *not* specified in advance!) degree polynomial evaluation.
- Make good use of the fact that the stack is always 4 registers deep so it's *never* 'nonexistent'.
- Make good use of LASTX and register arithmetic and manipulations directly or indirectly upon stack registers (STO+Y, STO-L, RCL Z, RCL IND ST T, X<> IND ST L, XEQ IND ST X, etc). A good example would be performing complex number multiplication directly on the stack, as well as converting numeric values in the ALPHA register to their full equivalent numeric value in X, just using the stack.
- Make good use of numerically addressed registers, specially in combination with register arithmetic and indirection.
- In the case of the HP42S, make good use of the fact that the whole numerically addressable register set can be dealt with en masse as a matrix variable, so you can have multiple sets of independent numerically addressable register banks and the possibilities are almost limitless. A good example for this would be to provide recursion in a simple way, as well as working with any number of matrices simultaneously.
etc, etc, etc. I'm glad if any of these comments of mine can be of any help to your quest, but for the reasons mentioned at the beginning, I wouldn't waste much time on this.
Best regards from V.
Edited: 22 Feb 2006, 6:59 a.m.