Sunday, December 5, 2021

HP 17B and HP 27S: Using the Solver for Recursive Functions

HP 17B and HP 27S: Using the Solver for Recursive Functions


Introduction


A simple store and recall procedure can be used with the solver.   


One Initial Condition


u_n = f(u_n-1) with the initial condition u_0


Let B = u_n and A = u_n-1, set up the solver as:


B = F(A)


Initial condition:

u_0 ( A ) ( B )


Subsequent calculations:

[ RCL ] ( B )* [ STO ] ( A ) ( B )


*RCL B is not necessary if you go straight to the next calculation.  


Example:   

u_n = 4*u_n-1 - 3, u_0 = 3


Setup:  B=4×A-3


3 ( A ) ( B )

Result:  9


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  33


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  129


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  513



Two Initial Conditions


u_n = f(u_n-1, u_n-2) with the initial conditions u_0 and u_1


Let C = u_n, B = u_n-1, and A = u_n-2 and set up the solver as:


C = F(A, B)


Initial condition:

u_0 ( A ) u_1 ( B )  ( C )


Subsequent calculations:

[ RCL ] ( B )* [ STO ] ( A ) ( B )


Example:


The Fibonacci Sequence:

u_n = u_n-1 + u_n-2; with u_0 = 1, u_1 = 1


Setup:  C=B+A


1 ( A ) 1 ( B ) ( C )

Result: 2


[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  3



[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  5


[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  8


Nothing to it.


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. 


Casio fx-CG50: Sparse Matrix Builder

Casio fx-CG50: Sparse Matrix Builder Introduction The programs can create a sparse matrix, a matrix where most of the entries have zero valu...