The Museum of HP Calculators

HP Forum Archive 20

 The Sigma Function on the WP34Message #1 Posted by Eddie W. Shore on 25 Apr 2011, 12:17 a.m. ```How is the Sigma function used? I am trying to find the sum: 10 Sigma .5^x * .2 (= .399805) x=0 If understand the manual correctly, I am supposed to enter the counter in the x stack as ccc.fffiii: So I would enter 0.01001? (final = 10, increment = 0, c = 0) I am not getting the answer I expected. Please help. Here is what I have: LBL FF . 5 x<>y y^x .2 x RTN .01001 g [3] f [ENTER] FF ?? (I'm not getting what I am expecting, I get .2000) Thanks in advance. ```

 Re: The Sigma Function on the WP34Message #2 Posted by Paul Dale on 25 Apr 2011, 12:54 a.m.,in response to message #1 by Eddie W. Shore The source for sum is in the subversion repository. The big problem I think you're encountering is that the loop is a DSE loop not an ISG one. So, try entering 10 SUM'FF The finish value defaults to 0 and the increment/decrement defaults to 1. - Pauli

 Re: The Sigma Function on the WP34Message #3 Posted by Paul Dale on 25 Apr 2011, 6:20 a.m.,in response to message #2 by Paul Dale Small correction. You need to start the sum from 11 and subtract 1 at the start of the function. The sum stops before the zero term is evaluated. Thus, ``` LBL A DEC x . 5 x<>y y^x 5 / RTN ``` Then 11 g Sigma A gives 0.3998046875 - Pauli

 Re: The Sigma Function on the WP34Message #4 Posted by Dieter on 25 Apr 2011, 8:12 a.m.,in response to message #2 by Paul Dale Quote: The big problem I think you're encountering is that the loop is a DSE loop not an ISG one. So, try entering 10 SUM'FF Not just him. ;-) That's one of the things that made me read the manual twice before I finally realized that the sum and product loops are working backwards. Pauli, I think this is a quite unintuitive feature. I'm a big fan of POLA user interfaces (policy of least astonishment - things should work the way the average user expects). That's why I think the sum and product functions should count upwards. Simply think of the way you write down a sum: it's from 1 to n, not from n down to 1. And this way there is also no problem with an index starting at zero. ;-) Dieter

 Re: The Sigma Function on the WP34Message #5 Posted by Paul Dale on 25 Apr 2011, 6:32 p.m.,in response to message #4 by Dieter Originally I had both product and sum counting up then the documentation had them counting down so I switched. There are arguments both ways on this: Counting up limits you to a final value to 999, counting down doesn't. Counting up lets you get a zero index easily, counting down doesn't. Counting up requires more keystrokes (e.g. sum 1 to 5 requires 1.005 SUM as opposed to 5 SUM). For summations whose terms diminish as the index increases (i.e. many), counting down is generally more accurate. The change to make the count go the other way is trivial -- the DSE becomes an ISG in the main loop. I guess we could implement alternate commands to count the other way or switch to counting up again. I'm indecisive on this one, like I said advantages both ways. - Pauli Edited: 25 Apr 2011, 9:41 p.m.

 Re: The Sigma Function on the WP34Message #6 Posted by exschr on 26 Apr 2011, 3:54 a.m.,in response to message #5 by Paul Dale how about a flag to decide (switch) if counting up or down is used? (but I bet you are tight on flag usage though) Anyway, very nice work done, I'm looking forward to buy a 30b and starting to flash the business out of it ;-) Thanks a lot for more fun!

 Re: The Sigma Function on the WP34Message #7 Posted by Paul Dale on 26 Apr 2011, 4:03 a.m.,in response to message #6 by exschr We wouldn't use a flag for this, we'd define two commands for each. - Pauli

 Re: The Sigma Function on the WP34Message #8 Posted by Namir on 26 Apr 2011, 7:47 a.m.,in response to message #7 by Paul Dale How about using the sign of the summation range as a way to tell if you are summing up or down. Let's say a negative value means you are counting down, and vice versa? Namir

Go back to the main exhibit hall