(48SX and 12C): Continued Fractions

01092022, 07:23 PM
Post: #1




(48SX and 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_n1 + 1 ÷ a_n ) ... ) Below are two examples of continued fractions: Example 1: 5 + 1 ÷ (3 + 1 ÷ 7) Example 2: 6 + 1 ÷ (4 + 1 ÷ (2 + 1 ÷ 5)) 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: Code: << 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_n1 2. Press [ R/S ] 3. Work backwards, enter a_n2, press [ R/S ] until the end Program: (step, key code, key) Code: 01 34 x<>y *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 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)