Sunday, February 20, 2022

HP 48GX and HP 12C: Continued Fractions

HP 48GX and HP 12C: Continued Fractions


Continued Fractions


A continued fraction is a nested fraction in the form, shown in a linear fashion:


a_0 + 1 ÷ (a_1 + 1 ÷ (a_2 + 1 ÷ (a_3 + 1 ...    ÷ (a_n-1 + 1 ÷ a_n  ) ... )


Below are two examples of continued fractions:





HP 48GX Program: CNFRC


Instructions:


1.  Clear the stack.

2.  Enter values from a_0, a_1, a_2, to a_n.

3.  Run CNFRC


Program:

<< DEPTH 1 - 1 SWAP START INV + NEXT EVAL >>


Example 1 (refer to the above):  


Input: Clear the stack, 5, ENTER, 3, ENTER, 7, run CNFRC

Output:  5.31818181818


Example 2 (refer to the above):


Input:  Clear the stack, 6, ENTER, 4, ENTER, 2, ENTER, 5, run CNFRC

Output:  6.22448979592


HP 12C Program: Continued Fractions


1.  Enter a_n, ENTER a_n-1

2.  Press [ R/S ]

3.  Work backwards, enter a_n-2, press [ R/S ] until the end


Program:  (step, key code, key)

01   34   x<>y

02   22   1/x

03   40   +

04   43,33,00   GTO 00*


*43,33,000 GTO 000 for HP 12C Platinum


For the examples, the HP 12C set to FIX 5


Example 1 (refer to the above):  


Input:  7, ENTER, 3, R/S, 5, R/S

Output:  5.31818


Example 2 (refer to the above):


Input:  5, ENTER, 2, R/S, 4, R/S, 6, R/S

Output:  6.22449


March Madness Sweet Sixteen Calculus 


In the spirit of college basketball's March Madness, I will be posting a calculus post each day from March 16 to March 31, 2022.  


Going On a Break


I am going on a blog break.  This blog is a one-person band, me, all done on spare time between family, a full time job, relationships, and possibly some house repairs.  I am grateful for everyone who reads, subscribes, and enjoys my blog, it is an absolute joy to do.

Next blog entry is on March 12, 2022.

Thank you.  


Eddie 


All original content copyright, © 2011-2022.  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-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...