Sunday, January 28, 2024

Swiss Micros DM42 and TI-84 Plus: Sum of an Infinite Geometric Series

Swiss Micros DM42 and TI-84 Plus:  Sum of an Infinite Geometric Series



Introduction


An infinite geometric series has the form:


a + a × r + a × r^2 + a × r^3 + ...


= a × (1 + r + r^2 + r^3 + ....)



If |r| < 1, the series converges and a sum exists. 


Σ  a × r^n   =   a ÷ (1 - r)

n=0


Σ  a × r^(n-1)   =   a ÷ (1 - r)

n=1


However if |r| ≥ 1, the series diverges and does not have as sum.



DM42 Program:  GSUM


Calculators: DM42, HP 42S, Free42, Plus42


00 { 36-Byte Prgm }

01▸LBL "GSUM"

02 ENTER

03 ABS

04 1

05 X<>Y

06 X>Y?

07 GTO 00

08 R↓

09 R↓

10 1

11 X<>Y

12 -

13 ÷

14 RTN

15▸LBL 00

16 CLX

17 "DIVERGES"

18 AVIEW

19 .END.


In the case the series diverges, the X stack is cleared (displays 0).  



TI-84 Plus Program:  GSUM


Calculators:  TI-84 Plus, TI-84 Plus CE (Python), TI-83 Premium CE (Python)


Disp "Σ(A*R^N,0,INF)","Σ(A*R^(N-1),1,I)"

Prompt A,R

ClrHome

Disp "A=",A,"R=",R

If abs(R)<1

Then

A/(1-R)→S

Disp "SUM=",S

Else

Disp "DIVERGES"

End



Examples


A:  3,  R:  -0.2

Stack:  Y = 3, X = -0.2

Result = 2.5


A:  3,  R:  0.2

Stack:  Y = 3, X = -0.2

Result = 3.75


A:  3,  R:  -2.2

Stack:  Y = 3, X = -2.2

Result = diverges


A:  3,  R:  2.2

Stack:  Y = 3, X = 2.2

Result = diverges



Eddie


All original content copyright, © 2011-2024.  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. 


TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...