(42S) Recurring Sequence Matrix - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (42S) Recurring Sequence Matrix (/thread-6539.html) |
(42S) Recurring Sequence Matrix - Eddie W. Shore - 07-11-2016 05:04 AM HP 42S: Recurring Sequence Matrix The program RECUR builds a table for the sequence f(n, u(n-1)). The table is stored in the matrix MAT. At the completion of the program, you will be to see the elements of MAT in matrix edit mode. LBL 00 holds the sequence function. R00 = u(n-1) Specify as many entries as you like, up to 999. To use the counter in the sequence function, use RCL 02, IP. Other registers that are used are: R01 = n R02 = counter, in the form of 2.nnn Code: HP 42S Program RECUR How to run RECUR: 1. If desired, edit the function by [shift] [XEQ] (GTO) 00, [shift] [R/S] (PRGM). Remember you start with u(n-1) in the X stack. End f(x) with RTN. 2. Press [XEQ] {RECUR}. You will be prompted for U(1) and the number of rows desired. Test 1: u(n) = 2*u(n-1), u(1) = 1, 5 rows wanted Code: 41 LBL 00 [XEQ] {RECUR} 1 [XEQ] 5 [XEQ] MAT = 1 1 2 2 3 4 4 8 5 16 Test 2: u(n) = u(n-1)^2 – u(n-1)^3/6, u(1) = 1.5, 5 rows wanted Code: 41 LBL 00 MAT = 1 1.5000 2 1.6875 3 2.0468 4 2.7602 5 4.1138 |