SUM, MEAN & SDEV don't lift the stack

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Epidiah
Posts: 13
Joined: Mon Jan 29, 2018 2:08 am

SUM, MEAN & SDEV don't lift the stack

Post by Epidiah » Tue Sep 25, 2018 8:40 pm

I was messing around with the statistical functions and noticed that SUM, MEAN and SDEV don't lift the stack. They just replace whatever was in X and Y. WMN, however, does lift the stack. That seemed curious to me. Since I don't have an actual HP 42s to compare this to, I checked the manual to see if this was intentional, but I couldn't find a definitive answer. So here I am, asking you good folks about it.

Thomas Okken
Posts: 486
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: SUM, MEAN & SDEV don't lift the stack

Post by Thomas Okken » Tue Sep 25, 2018 9:55 pm

That is how the real HP-42S behaves. Note that SUM, MEAN, and SDEV are the only functions that return two results; WMEAN returns only one number. The behavior of SUM (a.k.a. RCL Σ+ or RCLΣ on older HPs), MEAN, and SDEV is similar on older HP calculators as well, though not identical... I seem to remember that the 29C and 19C lifted the stack one level, so X would go to LASTx, Y would go to Z, Z would go to T, and T would be lost, while the 42S moves X to LASTx, leaves Z and T in place, and loses Y. Two different flavors of odd behavior. Why not just lift the stack two levels? I have no idea!

Epidiah
Posts: 13
Joined: Mon Jan 29, 2018 2:08 am

Re: SUM, MEAN & SDEV don't lift the stack

Post by Epidiah » Tue Sep 25, 2018 10:24 pm

Interesting.

Best guess I have is that it's a way to review all three statistics and still preserve some of the stack.

Thomas Okken
Posts: 486
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: SUM, MEAN & SDEV don't lift the stack

Post by Thomas Okken » Wed Sep 26, 2018 5:20 am

I just checked the HP-19C/29C manual, and it turns out that I was mistaken in my previous post. The behavior of overwriting X and Y, saving X in LASTx, losing Y, and leaving Z and T in place, is how the 19C and 29C behave as well.

As does the HP-67, verified on the actual calculator.

So, whatever the original rationale for this behavior, it appears that HP calculators are consistent this way. Which certainly makes sense for the sake of program portability.

User avatar
Walter
Posts: 776
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: SUM, MEAN & SDEV don't lift the stack

Post by Walter » Wed Sep 26, 2018 7:24 am

Hmmh, I didn't recognize this so far. I faintly remember HP's claims that only CLx, ENTER, Σ+, and Σ- don't enable stack lift - but my memory may be wrong.* There are more functions returning two values: ->POL, ->REC, L.R.**, as well as the matrix commands DIM? and RCLIJ. I specified all these (except ->POL and ->REC) pushing 2 objects on the stack for the 43S. Seems I've to change this for sake of backward compatibilty.

* Cf. pp. 46 and 276 of the HP-42 Owner's Manual. But how does this match the reported behaviour of MEAN, SDEV, and SUM ?!? Pp. 231f don't make clear statements in this matter (space for improvement also in HP's manuals! :shock: ). Now, the pedestrian's approach has to start: check flag 30 after all suspect commands ... :roll: Alas, I've not got my HP-42S with me. :(

** On the HP-15C, for instance. Also the HP-15C Owner's Handbook shares the shortcomings of the HP-42S Owner's Manual - copy & paste? :shock: :shock:

EDIT: Seems I confused automatic stack lift and overwriting stack levels. SUM, MEAN, and SDEV "just" overwrite x and y as ->POL and ->REC do.
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

User avatar
Walter
Posts: 776
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: SUM, MEAN & SDEV don't lift the stack

Post by Walter » Wed Sep 26, 2018 3:25 pm

Does anybody have the necessary machines at hand to check what DIM? and RCLIJ and L.R. do in real life? The first two commands are members of the HP-42S function set. L.R. is found on Voyagers and Spices, for instance. Do these commands push their output on the stack or do they anything else? Thanks in advance for your experimental research :)

EDIT: At least my HP-11C works as expected from an RPN calculator: SUM, MEAN, SDEV, and L.R. push their output on the stack :) When and why did HP abandon this feature??

EDIT2: My HP-15C follows the same paradigm as my HP-11C, pushing the results on its stack. The lapse must have happened later ... :evil:
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

User avatar
Walter
Posts: 776
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: SUM, MEAN & SDEV don't lift the stack

Post by Walter » Thu Sep 27, 2018 7:25 am

Is there anybody with a working HP-41Cx who can check what this device does with the results of MEAN and SDEV ? Seems the lapse happened between the Voyagers and the Pioneers. Any help is appreciated.

EDIT: Found it in the HP-41C Owner's Hanbook and Programming Guide of 1980 on p. 103. Though there is no reason given why they left the previous paradigm. :?
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

dlachieze
Posts: 137
Joined: Thu May 04, 2017 10:20 am
Location: France

Re: SUM, MEAN & SDEV don't lift the stack

Post by dlachieze » Thu Sep 27, 2018 9:30 am

Walter wrote:
Wed Sep 26, 2018 3:25 pm
Does anybody have the necessary machines at hand to check what DIM? and RCLIJ and L.R. do in real life?
On the 42s:

DIM? replaces the matrix in X by the dimensions (columns & rows) in X & Y, pushing Y content to Z, Z content to T and placing the matrix in L

Code: Select all

T: t               T: z 
Z: z               Z: y
Y: y         =>    Y: rows
X: Matrix          X: columns

L: l               L: Matrix
RCLIJ recalls the row and columnn pointers in Y and X, pushing the stack up, L is left unchanged

Code: Select all

T: t               T: y 
Z: z               Z: x
Y: y         =>    Y: row-pointer
X: x               X: column-pointer

L: l               L: l
DM42 SN: 00425

User avatar
Walter
Posts: 776
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: SUM, MEAN & SDEV don't lift the stack

Post by Walter » Thu Sep 27, 2018 10:40 am

Merci beaucoup, Didier! :D

So the only open issue is:
Why did HP change the paradigm for the statistical functions in 1980? :?
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

Thomas Okken
Posts: 486
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: SUM, MEAN & SDEV don't lift the stack

Post by Thomas Okken » Fri Sep 28, 2018 2:01 am

Walter wrote:
Thu Sep 27, 2018 10:40 am
Why did HP change the paradigm for the statistical functions in 1980?
I only know how SUM, MEAN, and SDEV work on the 25/25C, 19C/29C, 67/97, 41C/41CV/41CX, and 42S, and among those calculators, the 25/25C only compute the mean and standard deviation of x, lifting the stack like you would expect, while all the others compute the mean and standard deviation of x and y, doing that weird thing of not lifting the stack, dropping y, and saving x in LASTx.

Given that the 42S was introduced in 1987 (or 1988?), shouldn't the question be why, after changing the behavior of SUM, MEAN, and SDEV, did they change it back? :D

The Voyager behavior (confirmed on my 10C, BTW, after writing the first two paragraphs of this post; also noticing that it doesn't do RCL Σ+) makes more sense, but then again, the Voyagers didn't need to be compatible with the earlier calculators, but the 41C/CV/CX and 42S did.

Next question: how does this work on, say, the 32SII?

Post Reply