The Sigma Function on the WP34 - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: The Sigma Function on the WP34 (/thread-182986.html) The Sigma Function on the WP34 - Eddie W. Shore - 04-25-2011 ```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 WP34 - Paul Dale - 04-25-2011 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 WP34 - Paul Dale - 04-25-2011 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 WP34 - Dieter - 04-25-2011 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 WP34 - Paul Dale - 04-25-2011 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 WP34 - exschr - 04-26-2011 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 WP34 - Paul Dale - 04-26-2011 We wouldn't use a flag for this, we'd define two commands for each. - Pauli Re: The Sigma Function on the WP34 - Namir - 04-26-2011 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