Summation of Infinite Alternating Series

Description

by Valentin Albillo

Quote:

SUMALT is a short (84 steps) RPN program that I wrote in 1979 for the HP-34C calculator (will also run as-is or with minor modifications in many RPN models, such as the HP-11C) which, given an infinite alternating series (i.e.: consecutive terms alternate signs) whose general term is defined by the user, it will compute its sum very quickly using the Euler Transformation up to 7th order differences.

See the full article on Valentin's site for further details.

Instructions:

Step 1:
In PRGM Mode, define under LBL B the sequence of steps (35 maximum) which defines the series’ general term, y(i), where i is in stack register X, and end it with RTN. The very first term corresponds
to i = 0. Do not define a sign for each term, it’s assumed that it alternates between + and -.

Also, before keying in the general term’s definition do not forget to delete the previous definition from program memory, if there’s one, except for LBL B itself.

Step 2:
In RUN Mode, enter the number of terms to sum initially, n (integer ≥ 0), and the maximum order of
differences to compute, d (integer, 1 ≤ d ≤ 7):

n ENTER d AS (sum of the series)

To try different values for n and/or d, repeat Step 2 above. To sum another series, go to Step 1 above.

Notes:

Program Resources

Labels

Name Description
 A
 B
 0
 1
 2
 4
 6

Storage Registers

Name Description
 8
 9
.0
.1
.2
(i)
I

Flags

Number Description
0

Program

Line Display Key Sequence Line Display Key Sequence Line Display Key Sequence
000 029 43, 4, 0 g SF 0 058 45 .1 RCL . 1
001 42,21,11 f LBL A 030 43 35 g CLx 059 45 25 RCL I
002 43, 5, 0 g CF 0 031 44 25 STO I 060 43,30, 0 g TEST x≠0
003 44 .1 STO . 1 032 42,21, 2 f LBL 2 061 22 0 GTO 0
004 34 x↔y 033 45 8 RCL 8 062 45 .2 RCL . 2
005 44 .0 STO . 0 034 32 12 GSB B 063 44 25 STO I
006 1 1 035 44 24 STO (i) 064 43 20 g x=0
007 44 8 STO 8 036 42, 6,25 f ISG I 065 22 4 GTO 4
008 0 0 037 42, 7, 4 f FIX 4 066 1 1
009 44 9 STO 9 038 1 1 067 22 6 GTO 6
010 44 25 STO I 039 44,40, 8 STO + 8 068 42,21, 4 f LBL 4
011 42,21, 1 f LBL 1 040 45 .1 RCL . 1 069 45 24 RCL (i)
012 32 12 GSB B 041 45 25 RCL I 070 45 8 RCL 8
013 45 8 RCL 8 042 43 10 g x≤y 071 10 ÷
014 44,30, 8 STO 8 043 22 2 GTO 2 072 44,40, 9 STO + 9
015 44,30, 8 STO 8 044 2 2 073 2 2
016 20 × 045 43, 6, 0 g F? 0 074 16 CHS
017 44,40, 9 STO + 9 046 16 CHS 075 44,20, 8 STO × 8
018 42, 6,25 f ISG I 047 44 8 STO 8 076 42, 6,25 f ISG I
019 42, 7, 4 f FIX 4 048 43 16 g ABS 077 42, 7, 4 f FIX 4
020 45 .0 RCL . 0 049 42,21, 6 f LBL 6 078 45 .1 RCL . 1
021 45 25 RCL I 050 30 079 45 25 RCL I
022 43 10 g x≤y 051 44 25 STO I 080 43 10 g x≤y
023 22 1 GTO 1 052 44 .2 STO . 2 081 22 4 GTO 4
024 44 8 STO 8 053 42,21, 0 f LBL 0 082 45 9 RCL 9
025 2 2 054 45 24 RCL (i) 083 43 32 g RTN
026 10 ÷ 055 42, 6,25 f ISG I 084 42,21,12 f LBL B
027 42 44 f FRAC 056 42, 7, 4 f FIX 4
028 43,30, 0 g TEST x≠0 057 44,30,24 STO (i)