Saturday, April 18, 2020

HP 12C: Sums of x

HP 12C:  Sums of x

Introduction

The following are four programs to calculate:

*  ∑ x
*  ∑ x^2
*  ∑ x^3
*  ∑ ax + b

with limits x = 0 to n.

Each program uses a closed sum formula.  The second and fourth program uses Horner's Method. 

Note:  You can use the first three if your limits are x = 1 to n (because at x = 0, 0 is added to the sum).  However if you use the fourth program, to get the sum from 1 to n, subtract b. 

HP 12C Program:  ∑x (x=0 to n)

n
∑ x =  n * (n + 1) / 2
x=0

Enter n, execute program

STEP:  KEY CODE  KEY
01:  36  ENTER
02:  36  ENTER
03:  1  1
04:  40  +
05:  20  *
06:  2   2
07  10  ÷
08:  43,33,00  GTO 00

Keys Only:
ENTER
ENTER
1
+
2
*
÷
GTO 00

Example:  (n = 48)

48
∑ x  = 1176
x=0

HP 12C Program:  ∑x^2 (x=0 to n)

n
∑ x^2 =  n * ( ( n / 3 + 1 / 2 ) * n + 1 / 6 )
x=0

Enter n, execute program

STEP:  KEY CODE KEY
01:  36  ENTER
02:  36  ENTER
03:  36  ENTER
04:  3  3
05:  10  ÷
06:  2  2
07:  22  1/x
08:  40  +
09:  20  *
10:  6  6
11:  22  1/x
12:  40  +
13:  20  *
14:  43,33,00  GTO 00

Keys Only:
ENTER
ENTER
ENTER
3
÷
2
1/x
+
*
6
1/x
+
*
GTO 00

Example:  (n = 48)

48
∑ x^2  = 38,024
x=0

HP 12C Program:  ∑x^3 (x=0 to n)

n
∑ x^3 =  1 / 4 * (n^2 + n)^2
x=0

Enter n, execute the program

STEP:  KEY CODE  KEY
01:  36  ENTER
02:  36  ENTER
03:  2  2
04:  21  y^x
05:  40  +
06:  2:  2
07:  21  y^x
08:  4  4
09:  10  ÷
10:  43,33,00  GTO 00

Keys Only:
ENTER
ENTER
2
y^x
+
2
y^x
4
÷
GTO 00

Example:  (n = 32)

32
∑ x^3  = 278,784
x=0

HP 12C Program:  ∑(a*x + b)  (x=0 to n)

n
∑ (a*x + b) =  n * (a * n / 2 + (a / 2 + b) ) + b
x=0

Store a in R1, store b in R2, enter n on the x-stack, execute the program

STEP:  KEY CODE   KEY
01:  36   ENTER
02:  36   ENTER
03:  36   ENTER
04:  45, 1  RCL 1
05:  20   *
06:  2    2
07:  10   ÷
08:  45, 1  RCL 1
09:  2   2
10:  10   ÷
11:  45, 2   RCL 2
12:  40   +
13:  40   +
14:  20   *
15:  45, 2  RCL 2
16:  40  ÷
17:  43, 33, 00   GTO 00

Keys Only:
ENTER
ENTER
ENTER
RCL 1
*

÷
RCL 1
2
÷
RCL 2
+
+
*
RCL 2
÷
GTO 00

Example:  (a = R1 = 3,  b = R2 = 4, n = 32)

3 STO 1,  4 STO 2,  32, R/S

32
∑ (3x + 4) = 1,716
x=0


I tried something new with my RPN keystroke programs, the second versions of each I just listed what keys to press without the step number or code.  I think this would be easier to read, but does leave out the key and key code.  Any comments on which style is preferred is appreciated. 


Eddie

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

1 comment:

TI-84 Plus CE and HP 17BII+: Euclidian Divison

 TI-84 Plus CE and HP 17BII+: Euclidian Division What is the ├ symbol on the calculator? (├ the symbol is a vertical line with a horizontal ...