#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
Hi people, I have an hp-28s, and I would like to know if it is
possible to make a simple summatory like this:
http://www.wolframalpha.com/input/?i=3D%28sum_%7Bi%3D1%7D%5E6+i%29 in
that calculator, but also more complicated sums, or if it is possible
to make a program which does that. Wait for your answers. Thanks.

PD: I also have the original manuals, but it doesn=B4t appear.

## Re: Question about my hp-28s

Summation functions are not implemented in the HP-28S, so you have to
write your own programs. I would suggest using general purpose
programs, so that you don't have to rewrite them for each particular
problem.

A. For finite sums, you could use a program like this:

<<
0 0 0 -> ii fi Smnd
<<
{ STO ii fi Smnd } MENU HALT
0 ii fi FOR x
x Smnd EVAL +
NEXT
DUP "=A7=3D" SWAP ->STR +
CLLCD 1 DISP
>>

=A7 represents the greek letter "sigma" (SHIFT+V).

If you run this program (which you could STOre in the variable '=A7'),
you will be presented with a solver-like menu, where you can supply
(in any order you wish):

1. the initial index: ii (1 in your example)
2. the final index: fi (6 in your example)
3. the summand: Smnd, as a user-defined function of the form: << -> x
'F(x)'>>
(instead of x you can use any variable name you please, so your
example would be entered like this: << -> i 'i'>>)

If you are done, press CONT (SHIFT+1) and you will see a nicely
formatted result:3D21

Now, try a more complex one:
ii = 1
fi = 100
Smnd = << -> X '1/(X*(X+1))' >>
-------------------------------
=A7=3D.9900990099 (in 10 FIX mode),
which is exactly this:

http://www.wolframalpha.com/input/?i=3Dsum_ ^100+1%2F%28i*%28i%2B1%29=
%29

B. For infinite sums, you could use a program like this (which you
could name 'I=A7' or 'INF=A7'):

<<
0 0 -> ii Smnd
<<
{ STO ii Smnd } MENU HALT
Smnd 0 ii
DO
DUP 4 PICK EVAL
SWAP 1 +
ROT ROT OVER +
DUP 4 ROLLD
UNTIL =3D
END ROT DROP2
DUP "=A7=3D" SWAP ->STR +
CLLCD 1 DISP
>>

The final index is always +oo, so you don't have to supply an input
for fi.

Try this one:
ii = 1
Smnd = << -> X '1/X^4' >>
-------------------------------
=A7=3D1.08232323295

For comparison:
http://www.wolframalpha.com/input/?i=3D%28sum_ ^%2Boo+1%2Fn^4%29

You can find a really excellent in-depth explanation of this topic in
"HP-28 Insights" by William C. Wickes, the very "creator" of the HP-28
(*and* HP-48) handheld computers. The core of my second program was
directly inspired by this book (p.254).

## Re: Question about my hp-28s

You can=B4t imagine how useful is your answer Giuseppe!  Thank you very
much!!! I couldn=B4t be more grateful to you.

## Re: Question about my hp-28s

On 12 Feb., 05:51, crime...@hotmail.com.ar wrote:

You are welcome!

Please bear in mind that constants are always treated as part of the
summand. For instance, for ii = 1, fi = 6 and Smd = << -> x 'x+5' >>,
=A7 yields 51, because 5 is treated as part of the summand and therefore
is added at each iteration: (1+5)+(2+5)+(3+5)+(4+5)+(5+5)+(6+5)=3D51. In
other words:

6                              6
---                            ---

---                            ---
n=3D1                            n=3D1

Mathematica, however, will interpret this as:

/   6    \
|  ---    |
|  >    n | + 5 = 26
|  ---    |
\  n=3D1    /

http://www.wolframalpha.com/input/?i=3D%28sum_ ^6+i%2B5%29

So don't be fooled by this! Simply use parentheses in Mathematica to
obtain the same result:
http://www.wolframalpha.com/input/?i=3D%28sum_ ^6+%28i%2B5%29%29

## Re: Question about my hp-28s

If you don't need nicely formatted input and output, you can add even
greater flexibility by programming and I=A7 as user-defined functions.
This has the great advantage of letting you insert summations into
bigger expressions.

A. For finite sums, STOre the following program in the variable '=A7' (=A7
=3D sigma (SHIFT+V)):

<<
-> v ii fi s
<<
0 ii fi FOR x
x 'v' EVAL STO s EVAL +
NEXT
'v' EVAL PURGE
>>

Now you can use this newly created function like every built-in
function:

I) Either put the following 4 arguments on the stack an press:

4: name of index variable
3: initial value of index variable
2: final value of index variable
1: summand

For example: 'n' 1 10 'n^2'  =>  385

II) Or use the algebraic syntax:

'=A7(name,initial_value,final_value,summand)'

In our example, this would be: '=A7(n,1,10,n^2)'

You can, of course, EVALuate this expression directly, but you can
also use it within any other expression or equation, like this:

'15+=A7(n,1,10,n^2)' EVAL => 400

And you can even use *symbolic* index values, as in this expression:

________________
/        n
/   1    ---
--  /  -----  >   x^2
\/    n-1   ---
x=3D1

http://www.wolframalpha.com/input/?i=3D%28SQRT%28%281%2F%28n-1%29%29 *sum_{x=
%3D1}^n+x^2%29%29

Here is all you have to do: '\v/(1/(n-1)*=A7(x,1,n,x^2))' (where \v/
represents the symbol for "square root")

If you now store the real number 5 in the variable 'n', the expression
EVALuates to 3.70809924355

http://www.wolframalpha.com/input/?i=3D%28SQRT%28%281%2F%28n-1%29%29 *sum_{x=
%3D1}^n+x^2%29%29

B. For infinite sums, STOre the following program in the variable
'I=A7':

<<
-> v ii s
<<
s 0 ii
DO
DUP 'v' EVAL STO
3 PICK EVAL
SWAP 1 +
ROT ROT OVER +
DUP 4 ROLLD
UNTIL =3D
END
ROT DROP2
'v' EVAL PURGE
>>

Since the final index value is always +oo, there are only 3 arguments
to supply in this case:

I) Either:
3: name of index variable
2: initial value of index
1: summand

II) Or, in algebraic syntax:
'I=A7(name,initial_value,summand)'

The following expression, for example...

_______ +oo
/        ---   x^2
--  / n+2     >   -------
\/          ---   2^x
x=3Dn

http://www.wolframalpha.com/input/?i=3DSQRT%28n%2B2%29 *sum[x^2%2F2^x%2C+{x%=
2C+n%2C+%2Boo}]

...would be entered as:

'\v/(n+2)*I=A7(x,n,x^2/2^x)'

If, for instance, n=3D2 (STOre the real number 2 in 'n'), the expression
EVALuates to 11.

http://www.wolframalpha.com/input/?i=3DSQRT%282%2B2%29 *sum[x^2%2F2^x%2C+{x%=
2C+2%2C+%2Boo}]

N.B.
1. Make sure the index variable name is not already in use (purge it,
if necessary).
2. You can't use 'i' as an index name, since it is reserved for
symbolic complex numbers.

## Re: Question about my hp-28s

wrote:

Awesome! Thank you very much!

## Re: Question about my hp-28s

You can even make plots, if you like:

A. For finite sums, store the following program in the variable
'=A7PLT':

(like in my previous listings, represents the Greek letter sigma
(Shift+V))

<<
CLLCD
-> v ii fi s
<<
'PPAR' PURGE
CL=A7
1 2 COL=A7
"\$=3D"
'v' EVAL ->STR
DUP SIZE 1 - 2 SWAP SUB "=3D" +
0 ii fi
FOR x
x 'v' EVAL STO s EVAL +
x DUP2
->STR 5 PICK SWAP + 2 DISP
->STR 5 PICK SWAP + 1 DISP
OVER 2 ->ARRY+
NEXT "STARTING PLOTTER..." 4 DISP 3 WAIT
SWAP ROT DROP2 'v' EVAL PURGE
SCL=A7 CLLCD DRW=A7 DGTIZ
>>

To run the program, put the following 4 arguments on the stack and
pressPLT:

4: name of index variable
3: initial value of index variable
2: final value of index variable
1: summand, expressed as an ordinary algebraic (for example: 'n^2')

In a first phase, the program will display both the running index and
the running sum, so you can easily monitor the sum as it accumulates.

When the calculations are done, the screen is cleared and the
corresponding plot is drawn. (Naturally, this will create, or modify,
the reserved variables PPAR,DAT andPAR in the current directory.)

In the plot environment:
Press and hold down the <^v> key to display the current coordinates.
Press INS to return the current pair of coordinates to the stack.

When you quit the plot environment, the calculated sum will be
available on the stack for further calculations.

Optionally you can pressDAT (in the current directory) SHIFT+EDIT,
and you will see a nice table of values, with the index values in the
first column and the corresponding sums in the second.

Try this one, for instance:

4: 'n'
3: 1
2: 65
1: 'n^7/2^n'

=A7PLT

...and compare: http://www.wolframalpha.com/input/?i=3D%28sum_ ^50+n^=
7%2F2^n%29

In the Plot environment, press ON to return to the stack (notice that
the result 94586 is preserved fot further calculations), then press
\$DAT SHIFT+EDIT to see the corresponding table of values.

B. For infinite sums, store the following program in the variable
'I=A7PLT':

<<
CLLCD
-> v ii s
<<
'PPAR' PURGE
CL=A7
1 2 COL\$
"\$=3D" s 0 ii
DO
DUP 'v' EVAL STO
3 PICK EVAL
3 PICK +
SWAP DUP 1 +
4 ROLLD OVER 2 ->ARRY+
DUP ->STR 6 PICK SWAP + 1 DISP
DUP 4 ROLLD
UNTIL =3D
END "STARTING PLOTTER..." 3 DISP 3 WAIT
ROT DROP2 SWAP DROP 'v' EVAL PURGE
SCL=A7 CLLCD DRW=A7 DGTIZ
>>

Since the final index value is +oo, I=A7PLT takes only 3 arguments:

3: name of index variable
2: initial value of index variable
1: summand

For the same reason, no running index is shown in the first phase of
the program (only the running sum).

Here is an example:

3: 'X'
2: 3
1: 'X^2/2^X'

I=A7PLT

For comparison: http://www3.wolframalpha.com/input/?i=3D%28sum_ ^%2Bo=
o+n^2%2F2^n%29

## Re: Question about my hp-28s

wrote:

Amazing! You are an expert! Thanks