Saturday, August 7, 2021

TI-95 ProCalc: Arithmetic and Geometric Series, Arithmetic-Geometric Mean

TI-95 ProCalc: Arithmetic and Geometric Series, Arithmetic-Geometric Mean




Welcome to TI-95 ProCalc month!  I think this is the first time I am going to post programs for this classic keystroke calculator.  


To see my review of the TI-95 ProCalc in 2020, click here:

http://edspi31415.blogspot.com/2020/07/retro-review-ti-95-procalc.html

Note, all programs on this series will use the one-letter variables A-Z, which can also be registers 000 - 025. 


Arithmetic Term and Sum


Arithmetic Series:

a + (a + d) + (a + 2d) + ...


Nth Term:

TERM = B = a + (n -1) * d


Sum of N Terms:

SUM = S = n / 2 * (2 * a + (n - 1) * d) = n / 2 * (a + TERM)


Alpha strings are enclosed in singular quotes (' ').


TI-95 ProCalc Program File ARI

Size: 72 bytes


'A+(A+D)+...'  BRK CLR


'A?' BRK STO A


+ ( 'N?' BRK STO N 


- 1 ) * 'D?' BRK = STO B


+ RCL A = * RCL N / 2 = STO S


'TERM=' COL 16 MRG B BRK 


CLR 'SUM=' COL 16 MRG S HLT


Examples

 

A = -1, D = 6, N = 20

Results:  TERM = 113, SUM = 1,120


A = 4.5, D = 1.8, N = 35

Results:  TERM = 65.7, SUM = 1,228.5



Geometric Series and Sum


Geometric Series:

a + a*r + a*r^2 + a*r^3 + ...


Nth Term:

TERM = B = a * r^(n-1)


Sum of N Terms:

SUM = S = (a * (1 - r^n)) / (1 - r) = ( -r * TERM + a ) / (1 - r )


TI-95 ProCalc Program File GMS

Size: 80 bytes


'A+A*R+A*R^2+...' BRK CLR


'A?' BRK STO A* 


'R?' BRK STO R y^x 


( 'N?' BRK - 1 ) = STO B

 

* RCL R +/- + RCL A = 


/ ( 1 - RCL R ) = STO S


'TERM=' COL 16 MRG B BRK


CLR 'SUM=' COL 16 MRG S HLT


Examples


A = 1,000, R = 1.36, N = 32

Results: TERM = 13,794,506.22, SUM = 52,109,801.29 


A = 1,000, R = 0.95, N = 26

Results: TERM = 277.3895731, SUM = 14,729.59811


Arithmetic-Geometric Mean


Given positive real numbers A and G, the follow algorithm repeats until A and G converge:


A_n+1 = (A_n + G_n) / 2

G_n+1 = √(A_n * G_n)


When convergence is satisfied to a set of decimal places, both A_final and G_final are calculated for comparison purposes.


TI-95 ProCalc Program File AGM

Size: 104 bytes


CLR 'ARITH/GEOM MEAN' PAU


CLR 'A?' BRK STO A


CLR 'G?' BRK STO G


CLR '# PLACES?' BRK +/- INV LOG STO T 


LBL 01 RCL A STO B RCL G STO H


( RCL B + RCL H ) / 2 = STO A


( RCL B * RCL H ) SQR = STO G


( RCL A - RCL G ) ABS = IF> T GTL 01 


RCL G x~t RCL A HLT


Examples


A = 2.4, G = 3.6, # PLACES = 6 (6 places)

Results:  2.969616524, 2.969616523


A = 105, G = 207, # PLACES = 6 (6 places)

Results:  151.6836959, 151.6836959


Source for Arithmetic and Geometric Term and Sum:


Lindeburg, Michael R. P.E.  Engineering Fundamentals: Quick Reference Cards Third Edition  Professional Publications, Inc.  Belmont, CA 1988 ISBN 0-932276-88-1


Commas added to the results for readability.  


Eddie


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


Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...