The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

It Can Be Done!
Message #1 Posted by Palmer O. Hanson, Jr. on 3 Nov 2006, 12:15 p.m.

In an earlier thread Cuppo wrote:

"I think the followig problem highlights pretty clearly some disadvantages of 4-level RPN:

[(3+1)(4+3)+(2+6)(4+6)] / [(2+3)(2+1) + (3+5)(4+2)] = ?

This problem is not possible using a 4-level stack without using STORE."

Not so! Try this which doesn't even require the use of LAST X:

Calculate the denominator first:

2 ENTER 3 + 2 ENTER 1 + X 3 ENTER 5 + 4 ENTER 2 + X +

The denominator (63) is in the x register. Now calculate parts of the numerator divided by the denominator and add them together:

3 ENTER 1 + 4 ENTER 3 + X 2 ENTER 6 + Roll Down x<>y / Roll Down / x<>y Roll Down 4 ENTER 6 + X +

and see 1.71428 ... = 108/63 in the display.

      
Re: It Can Be Done!
Message #2 Posted by Gene on 3 Nov 2006, 1:47 p.m.,
in response to message #1 by Palmer O. Hanson, Jr.

Good job, Palmer! We'll make an RPN guy out of you yet. BIG :-)

      
Re: It Can Be Done!
Message #3 Posted by Karl Schneider on 4 Nov 2006, 12:12 a.m.,
in response to message #1 by Palmer O. Hanson, Jr.

Palmer --

Very clever! Although your solution requires some thought, "stack-tracking" and algebra, it is applicable to all RPN models. My solution (Subject: "*Can* be done on HP-42S w/o STO..."), although somewhat more straightforward, could be performed only on the HP-42S.

Of course, all of this cleverness defeats the objective of having the tool work for you, instead of the other way around. It's best to use "STO" when necessary and be done with it.

That having been stated, the problem looked more like a contrived exercise in arithmetic than something familiar from the realm of science, engineering, or finance.

-- KS

            
Re: It Can Be Done!
Message #4 Posted by Bill (Smithville, NJ) on 4 Nov 2006, 10:27 a.m.,
in response to message #3 by Karl Schneider

Karl,

You hit it on the nail with

Quote:
looked more like a contrived exercise in arithmetic

The real question isn't whether one particular style calculator is best for a single, very contrived, set of equations, but is one style of calculator better (or easier, or...) under the majority of calculation types one would encounter in daily use.

I daresay that one could take any calculator and contrive an equation that would make it perform the equation better (or easier,...) than a particular other calculator. But unless that type of contrived equation is what is performed on a daily basis, then the exercise of showing it is just that - an exercise and really doesn't prove anything about the particular calculator.

But it is still fun to try out contrived equations on different models just to see how they are handled.

Bill

            
Re: It Can Be Done!
Message #5 Posted by Palmer O. Hanson, Jr. on 4 Nov 2006, 2:55 p.m.,
in response to message #3 by Karl Schneider

Karl wrote:

"Of course, all of this cleverness defeats the objective of having the tool work for you, instead of the other way around. It's best to use "STO" when necessary and be done with it."

He is absolutely correct. I wouldn't propose that anyone try to solve typical problems this way instead of using a memory, and I couldn't begin to match the solution time of seven seconds claimed for algebraic and for RPN plus one memory, even if I practiced the solution. I certainly didn't keep track of all that stack manipulation in my head either; but, when Cuppo said that it couldn't be done I had to try. A statement like that is like a red flag in front of a bull for old-timers like me.

                  
Re: It Can Be Done!
Message #6 Posted by Bernhard on 5 Nov 2006, 11:55 a.m.,
in response to message #5 by Palmer O. Hanson, Jr.

Good example, but anyway HP-style RPN is superior to anything else if it comes to daily work. People do make errors in punching keys, and with Last X and RPN it's easy to undo that last wrong operation you didn't want to key in and continue without need to retype the whole data. I think this advantage of RPN really makes it shine. - B.E.

                        
When EOS is better
Message #7 Posted by Palmer O. Hanson, Jr. on 10 Nov 2006, 9:51 p.m.,
in response to message #6 by Bernhard

Consider the famous Mach Number problem which appears on page 106 of the HP-67 Owner's Handbook and Programming Guide. An RPN solution requires requires 67 steps on the HP-67 or HP-97, but only 66 on the HP-41 where the square root key is not a second function. An AOS solution on a TI-30 or TI-59 requires 73 steps. An EOS solution on machines such as the TI Graphics, the Casio graphics and the Durabrand 828 requires 76 steps. It has been suggested that the difference in the number of steps translates into an efficiency advantage for RPN relative to AOS of about eleven to fifteen per cent. That may be true for a single Mach Number calculation; however, earlier in this thread Bill wrote

"I daresay that one could take any calculator and contrive an equation that would make it perform the equation better (or easier,...) than a particular other calculator. But unless that type of contrived equation is what is performed on a daily basis, then the exercise of showing it is just that - an exercise and really doesn't prove anything about the particular calculator."

The Mach Number calculation which appears in the manual is a solution of the equation for a pressure altitude (PALT) of 25,500 feet and a calibrated airspeed (CAS) of 350 knots. What if the user needed solutions for several data points, say for

     PALT               CAS              MN

25,500 350 0.836

30,000 375 0.967

35,000 325 0.939

This is a situation where the EOS methodology really shines! The user can use the cursor keys to review the entered equation. After the first solution the user can calculate the Mach Number for a different altitude and air speed by recalling the equation (2nd ENTER on the TI Graphics), using the cursor keys to quickly scroll to the appropriate places, enter the revised altitude and air speed, and press ENTER to see the solution for the revised input values. I can accomplish the equivalent in algebraic mode on my HP-28S by pressing UNDO after a solution is completed and using EDIT to modify the equation for a subsequent evaluation.

Solving for the three data points from the keyboard with either RPN or AOS requires that the entire equation be entered three times. For programmable RPN or AOS machines a user can accomplish the equivalent of the EOS and HP-28S algebraic capability by entering the equation as a program, but at the cost of abandoning the ability to see intermediate results.

                              
Re: When EOS is better
Message #8 Posted by Massimo Gnerucci (Italy) on 11 Nov 2006, 2:12 a.m.,
in response to message #7 by Palmer O. Hanson, Jr.

Quote:
For programmable RPN or AOS machines a user can accomplish the equivalent of the EOS and HP-28S algebraic capability by entering the equation as a program, but at the cost of abandoning the ability to see intermediate results

No, if you SST through the program. You can also use PAUSE and VIEW.

Greetings,
Massimo

                                    
Re: When EOS is better
Message #9 Posted by Gene on 11 Nov 2006, 9:38 a.m.,
in response to message #8 by Massimo Gnerucci (Italy)

True, you can SST through it.

However, I agree with Palmer that the EOS really shines in many situations. That's why I think a calculator with RPN, AOS and an EOS mode gives the best of all worlds.

                                    
Re: When EOS is better
Message #10 Posted by Palmer O. Hanson, Jr. on 11 Nov 2006, 5:16 p.m.,
in response to message #8 by Massimo Gnerucci (Italy)

You can do that, but if you do then keystroke efficiency really goes to pot.

                              
Re: When EOS is better
Message #11 Posted by Rodger Rosenbaum on 11 Nov 2006, 1:17 p.m.,
in response to message #7 by Palmer O. Hanson, Jr.

If a person insists on doing an RPN type (actually RPL) calculation and repeating it with different arguments (without creating a traditional program), he could do this with a modern RPL machine, such as the HP48.

Let's say you wanted to evaluate SIN((2+3)/5), and then change some of the numbers and evaluate again.

Type:

<< 2 3 + 5 / SIN >> and press enter to put it on the stack.

Press EVAL to evaluate.

Recall from the command stack and edit, then EVAL again.

Repeat as needed.

If you want to see intermediate results, run it with the debugger and single step (which is what you would do anyway, if it needed debugging).

Notice that this amounts to a program; it's just kept on the command stack instead of the usual place. In fact, whenever a complex expression on any kind of machine can be recalled (and probably edited) and run again, that is a program.

                                    
Re: When EOS is better
Message #12 Posted by James M. Prange (Michigan) on 11 Nov 2006, 5:13 p.m.,
in response to message #11 by Rodger Rosenbaum

Or for that matter, with the 48 and 49 series, press RightShift ENTRY (over the ALPHA key) to get into program entry mode (PRG at upper right of status area), key in

2 SPC 3 + 5 / SIN
(notice without the UserRPL program delimiters) and then ENTER to execute the command line, returning the result the stack. To change an argument, retrieve the command line from the command stack, change what you want, and press ENTER again to execute the edited command line.

Alternatively, instead of switching to "program entry" mode, you could type in the command line in ALPHA mode (typing in all spaces). With the 49 series, use RightShift Z to get the / character in ALPHA mode.

Or with the 49 series, if you have flag -69 set (Infinite line edit), then you can you the CursorRight key instead of the SPC key.

With the 28C/S, you can type it into the command line in alpha mode to avoid the "implicit ENTER" of the "immediate-execute" keys.

Of course, if you have a command line with 'SIN((2+3)/5)' and ENTER it, you can recall that from the command stack for (optionally edited) reuse as well. Of course in this case, ENTER simply places 'SIN((2+3)/5)' on the stack, and you have to press EVAL to evaluate it, just as with Rodger's example of entering a program.

By "retrieve from the command stack", I mean, with the 49 series, press LeftShift CMD (over the HIST key), or with the 48GX/G/G+, RightShift CMD (over the +/- key), to get a choose box of the four most recently entered command lines, highlight the command line string that you want to reuse, then press ENTER (or the OK menu key) to place it into the command line editor. With the 48SX/S, press LeftShift CMD (over the 3 key) to cycle through the four most recently entered command lines. With the 28C/S, use Shift COMMAND (over the 7 key) to cycle through the four most recently entered command lines.

Of course, this assumes that you haven't disabled the command stack.

Regards
James

                                          
Re: When EOS is better
Message #13 Posted by Rodger Rosenbaum on 11 Nov 2006, 8:13 p.m.,
in response to message #12 by James M. Prange (Michigan)

Well, James has certainly given us the exhaustive description of the ways available on the 48/49/50 calcs.

This perennial debate is the Ford/Chevy debate of the calculator world.

I find that the major factor for me is my familiarity with a particular method. If method B is in fact (by some criterion), better than method A, but I have no experience with method B, then the time it would take me to learn it is probably much greater than the slight loss in efficiency it costs me for 100 uses of method A.

Even though I've been using RPN (and now RPL) HP calculators for years, if I need to evaluate some long formula I will type it in as an algebraic on my 48/49/50. But for a short expression, I can usually do the RPN version quicker.

If the formula will be evaluated many times, then I write a stored RPL program (which may contain algebraics). Either way, on the 48/49/50 series, the ability to edit and re-evaluate is there for both RPL and algebraic expressions. It's up to the user to gain the experience to know what method to use in a particular situation.

The modern calculators from both HP and TI are very powerful and with the large LCD screens and memory, you can do much more, faster, than you ever could with the HP35 or SR50, both of which I have. The whole notion of keystroke programmibility, HP or TI style was a major step forward for pocket calculators. I remember plotting points for the response of a high-pass filter on my HP29C. The calculation was involved and would have taken forever if I had to type the dozens of keystrokes over and over; not to mention the mistakes I would have made!

Sometimes it's fun to play with one of the old calcs to see just how nice the new ones are! :-)

                                          
Re: When EOS is better
Message #14 Posted by Rodger Rosenbaum on 11 Nov 2006, 8:21 p.m.,
in response to message #12 by James M. Prange (Michigan)

Quote:
Or for that matter, with the 48 and 49 series, press RightShift ENTRY (over the ALPHA key) to get into program entry mode (PRG at upper right of status area), key in
2 SPC 3 + 5 / SIN
(notice without the UserRPL program delimiters) and then ENTER to execute the command line, returning the result the stack. To change an argument, retrieve the command line from the command stack, change what you want, and press ENTER again to execute the edited command line.

Note that to use the debugger, you must have UserRPL program delimiters around the program.

                                    
Re: When EOS is better
Message #15 Posted by Palmer O. Hanson, Jr. on 11 Nov 2006, 5:27 p.m.,
in response to message #11 by Rodger Rosenbaum

Rodger wrote:

"Notice that this amounts to a program; it's just kept on the command stack instead of the usual place. In fact, whenever a complex expression on any kind of machine can be recalled (and probably edited) and run again, that is a program."

I should have made the same statemnt about solving the problem in algebraic on the HP-28S.

One of these days I will have to tackle RPL, but for the present I'm stll working through some RPN stuff.

      
Re: It Can Be Done!
Message #16 Posted by Rich Messeder (US) on 11 Nov 2006, 3:22 p.m.,
in response to message #1 by Palmer O. Hanson, Jr.

Well, I'm a new comer here and jumping into the middle, but when I try to solve [(3+1)(4+3)+(2+6)(4+6)] / [(2+3)(2+1) + (3+5)(4+2)] = ?

3 ENTER 1 + 4 ENTER 3 + X 2 ENTER 6 + 4 ENTER 6 + X 2 ENTER 3 + 2 ENTER 1 + X 3 ENTER 5 + 4 ENTER 2 + / using only 3 stack levels...

or did I miss the point when I jumped in the middle of the thread?

...and why do my lines look like they are concatenated when I preview the posting?

Rich

Edited: 11 Nov 2006, 3:23 p.m.

            
Re: It Can Be Done!
Message #17 Posted by Karl Schneider on 11 Nov 2006, 4:52 p.m.,
in response to message #16 by Rich Messeder (US)

Greetings, Rich!

Quote:
Well, I'm a new comer here and jumping into the middle, but when I try to solve [(3+1)(4+3)+(2+6)(4+6)] / [(2+3)(2+1) + (3+5)(4+2)] = ?

3 ENTER 1 + 4 ENTER 3 + X 2 ENTER 6 + 4 ENTER 6 + X 2 ENTER 3 + 2 ENTER 1 + X 3 ENTER 5 + 4 ENTER 2 + / using only 3 stack levels...

or did I miss the point when I jumped in the middle of the thread?


You lost track of the stack. The final argument, 2, would be the fifth stack entry (which the RPL-based HP-28/48/49/50 can accommodate); the final commands would be "2 + X + /", not "2 + /".

The original thread is separated, posted by "Cuppo" with the title "How do i input this using RPN?".

My HP-42S solution was posted under the title "*Can* be done on HP-42S w/o STO..., "

It may still be available in the full 500-item Forum. Else, it's all in the most recent Archive.


Text to be displayed as monospaced and exactly-as-written can be entered within the [pre] and [/pre] codes (Click "Preformatted"). You can find the link to the advanced formatting techniques under the MoHPC Forum main page.

-- KS

                  
Re: It Can Be Done!
Message #18 Posted by James M. Prange (Michigan) on 11 Nov 2006, 8:31 p.m.,
in response to message #17 by Karl Schneider

Well, first off, I think that instead of:

3 ENTER 1 + 4 ENTER 3 + X 2 ENTER 6 + 4 ENTER 6 + X 2 ENTER 3 + 2 ENTER 1 + X 3 ENTER 5 + 4 ENTER 2 + /
Rich's example should've been:

3 ENTER 1 + 4 ENTER 3 + X 2 ENTER 6 + 4 ENTER 6 + X + 2 ENTER 3 + 2 ENTER 1 + X 3 ENTER 5 + 4 ENTER 2 + * + /

Assuming that I understand correctly (and that's a big assumption), and starting with the stack "cleared":

keystroke     Classic RPN stack     RPL command line     RPL stack
3             T: 0                  3                    (empty)
              Z: 0
              Y: 0
              X: 3

ENTER T: 0 N/A 1: 3 Z: 0 Y: 3 X: 3

1 T: 0 1 1: 3 Z: 0 Y: 3 X: 1

+ T: 0 N/A 1: 4 Z: 0 Y: 0 X: 4

4 T: 0 4 1: 4 Z: 0 Y: 4 X: 4

ENTER T: 0 N/A 2: 4 Z: 4 1: 4 Y: 4 X: 4

3 T: 0 3 2: 4 Z: 4 1: 4 Y: 4 X: 3

+ T: 0 N/A 2: 4 Z: 0 1: 7 Y: 4 X: 7

X T: 0 N/A 1: 28 Z: 0 Y: 0 X: 28

2 T: 0 2 1: 28 Z: 0 Y: 28 X: 2

ENTER T: 0 N/A 2: 28 Z: 28 1: 2 Y: 2 X: 2

6 T: 0 6 2: 28 Z: 28 1: 2 Y: 2 X: 6

+ T: 0 N/A 2: 28 Z: 0 1: 8 Y: 28 X: 8

4 T: 0 4 2: 28 Z: 28 1: 8 Y: 8 X: 4

ENTER T: 28 N/A 3: 28 Z: 8 2: 8 Y: 4 1: 4 X: 4

6 T: 28 6 3: 28 Z: 8 2: 8 Y: 4 1: 4 X: 6

+ T: 28 N/A 3: 28 Z: 28 2: 8 Y: 8 1: 10 X: 10

X T: 28 N/A 2: 28 Z: 28 1: 80 Y: 28 X: 80

+ T: 28 N/A 1: 108 Z: 28 Y: 28 X: 108

2 T: 28 2 1: 108 Z: 28 Y: 108 X: 2

ENTER T: 28 N/A 2: 108 Z: 108 1: 2 Y: 2 X: 2

3 T: 28 3 2: 108 Z: 108 1: 2 Y: 2 X: 3

+ T: 28 N/A 2: 108 Z: 28 1: 5 Y: 108 X: 5

2 T: 28 2 2: 108 Z: 108 1: 5 Y: 5 X: 2

ENTER T: 108 N/A 3: 108 Z: 5 2: 5 Y: 2 1: 2 X: 2

(28 was overflowed, but it's no longer needed)

1 T: 108 1 3: 108 Z: 5 2: 5 Y: 2 1: 2 X: 1

+ T: 108 N/A 3: 108 Z: 108 2: 5 Y: 5 1: 3 X: 3

X T: 108 N/A 2: 108 Z: 108 1: 15 Y: 108 X: 15

3 T: 108 3 2: 108 Z: 108 1: 15 Y: 15 X: 3

ENTER T: 108 N/A 3: 108 Z: 15 2: 15 Y: 3 1: 3 X: 3

5 T: 108 5 3: 108 Z: 15 2: 15 Y: 3 1: 3 X: 5

+ T: 108 N/A 3: 108 Z: 108 2: 15 Y: 15 1: 8 X: 8

4 T: 108 4 3: 108 Z: 15 2: 15 Y: 8 1: 8 X: 4

ENTER Overflow!: 108 N/A 4: 108 T: 15 3: 15 Z: 8 2: 8 Y: 4 1: 4 X: 4

2 Overflow!: 108 2 4: 108 T: 15 3: 15 Z: 8 2: 8 Y: 4 1: 4 X: 2

+ Overflow!: 108 N/A 4: 108 T: 15 (Would be 108) 3: 15 Z: 15 2: 8 Y: 8 1: 6 X: 6

X Overflow!: 108 N/A 3: 108 T: 15 (Would be 108) 2: 15 Z: 15 (Would be 108) 1: 48 Y: 15 X: 48

+ Overflow!: 108 N/A 2: 108 T: 15 (Would be 108) 1: 63 Z: 15 (Would be 108) Y: 15 (Would be 108) X: 63

/ Overflow!: 108 N/A 1: '12/7' (Exact) or 1.71418571429 (Approximate) T: 15 (Would be 108) Z: 15 (Would be 108) Y: 15 (Would be 108) X: 0.238095238 (Would be 1.714285714)

So, if I've got that right, in Classis RPN, that last ENTER to allow keying in the final 2 pushed the 108 into the bit bucket, but with a 2-line display, that wouldn't be apparent until the last + operation, and with a 1-line display, not until the very last operation, / (and perhaps non-obvious to the unwary).

In RPL, it looks as if the most that was used was 4 stack levels plus the command line, but of course the ENTER operations were actually using the stack "behind the scenes", without the display being updated until ENTER was finished.

Regards,
James

                        
Re: It Can Be Done!
Message #19 Posted by Rich Messeder (US) on 13 Nov 2006, 6:31 p.m.,
in response to message #18 by James M. Prange (Michigan)

When you're right, you're right. I meant to type in what you entered as my corrected keystrokes, but that still would have overflowed the 4 level stack. Rats.

Rich

                              
Re: It Can Be Done!
Message #20 Posted by Marcus von Cube, Germany on 13 Nov 2006, 6:49 p.m.,
in response to message #19 by Rich Messeder (US)

Don't be too concerned!

The example was especially constructed to tease the RPN voters. If you look at the numbers, who of you would ever have entered all these trivial summations into the calculator instead of the values:

[(3+1)(4+3)+(2+6)(4+6)] / [(2+3)(2+1) + (3+5)(4+2)] 
=
(4*7+8*10)/(5*3+8*6)

The latter goes easily along with a 4 level stack.

Don't feed the trolls!

Marcus

                                    
Re: It Can Be Done!
Message #21 Posted by Palmer O. Hanson, Jr. on 13 Nov 2006, 10:21 p.m.,
in response to message #20 by Marcus von Cube, Germany

I have been rattling around this site for a couple of years and I still don't know the meaning of "Don't feed the trolls!"

                                          
Re: It Can Be Done!
Message #22 Posted by Tom F on 13 Nov 2006, 11:31 p.m.,
in response to message #21 by Palmer O. Hanson, Jr.

I hope I have entered this link correctly... http://en.wikipedia.org/wiki/Internet_troll

                                                
Re: It Can Be Done!
Message #23 Posted by Palmer O. Hanson, Jr. on 14 Nov 2006, 12:19 a.m.,
in response to message #22 by Tom F

Thanks for the reference. I think that I'll be happier if I do not get too conversant with the ways of the internet. I did wonder if the useage here isn't often as described in the following quote from the reference:

"...The term troll is highly subjective. Some readers may characterize a post as trolling, while others may regard the same post as a legitimate contribution to the discussion, even if controversial. The term is often used to discredit an opposing position, or its proponent, by argument ad hominem. ..."

                                                      
Re: It Can Be Done!
Message #24 Posted by Tom F on 14 Nov 2006, 9:27 a.m.,
in response to message #23 by Palmer O. Hanson, Jr.

While I am usually inclined to give the benefit of the doubt, this argument is so tired and this was such a contrived situation, the original poster is deserving of the troll discription. I was a little surprised some folks got suckered into it as far as they were. (To some extent me too with this post.) However, I am somewhat encouraged that this thread (or rather the original thread) took a turn (that you and others took) towards a challenge to a puzzle rather than a drawn out, pointless argument of the virtues of RPN over AOS, or to paraphrase what others have said earlier; Ford Chevy; less filling tastes great; etc. It is an argument that neither side can ever win. For the record, I am a RPN guy that never does much more that add, subtract, and make a few conversions once in a while. Once in a blue moon I write a simple program to handle repetitive calculations I do. RPN is that way I think and have thought since I got my first HP41 in 1979 or 1980 (I had a TI30 prior) and there is not an argument out there that will ever change that thought or devotion to RPN regardless of how illogical that may seem to others.

                                                            
Re: It Can Be Done!
Message #25 Posted by Palmer O. Hanson, Jr. on 14 Nov 2006, 10:23 p.m.,
in response to message #24 by Tom F

Cuppo's problem was just one more in an endless series of inept challenges from one side to the other. That's why I went through the work to show that, once more, when a proponent from either side proposes a problem for the other side it probably only shows that there is a lack of understanding. It's sort of like a modified version of the old Kipling quote "RPN is RPN, and AOS is AOS, and never the twain shall meet ..."


[ Return to Index | Top of Index ]

Go back to the main exhibit hall