(48G/50g) Binomial Transform, Difference Table
05-27-2019, 09:07 PM
Post: #8
 John Keith Senior Member Posts: 455 Joined: Dec 2013
RE: (48G/50g) Binomial Transform, Difference Table
Following on from the last two posts, a much faster binomial transform program for sequences defined by simple polynomials. Sequences defined by an nth degree polynomial are binomial transforms of a sequence beginning with n+1 terms followed by an arbitrary number of zeros. For instance, A000292, the tetrahedral numbers, is the binomial transform of { 1 3 3 1 0 0 0... }.

The following program requires a list of the non-zero terms on level 2 and a number on level 1 which is the number of terms to return. For example, with { 1 3 3 1 } on level 2 and 12 on level 1, the program will return a list of the first 12 tetrahedral numbers.

Code:
 \<< OVER SIZE 2. - \-> n s   \<< EVAL n LASEQ 1. s     START SWAP       \<< +       \>> Scanl     NEXT   \>> \>>

This program is HP 50g only since it uses commands from the external libraries ListExt and GoferLists.

The following version is compatible with the HP-48G. It is longer and slower than the HP 50 version but still reasonably fast.

Code:
 \<< OVER SIZE 2 - ROT OBJ\-> 2 + ROLL LASTARG ROLL \-> m n s   \<< n m * OVER + 1 -     FOR j j m     STEP n \->LIST 1 s     START 1       \<< OVER +       \>> DOLIST +     NEXT   \>> \>>
 « Next Oldest | Next Newest »

 Messages In This Thread (48G/50g) Binomial Transform, Difference Table - John Keith - 01-17-2019, 09:56 PM RE: (48G/50g) Binomial Transform, Difference Table - Thomas Klemm - 01-18-2019, 05:53 AM RE: (48G/50g) Binomial Transform, Difference Table - John Keith - 01-18-2019, 08:01 PM RE: (48G/50g) Binomial Transform, Difference Table - Thomas Klemm - 01-18-2019, 08:14 AM RE: (48G/50g) Binomial Transform, Difference Table - John Keith - 01-18-2019, 07:39 PM RE: (48G/50g) Binomial Transform, Difference Table - Thomas Klemm - 01-18-2019, 08:50 PM RE: (48G/50g) Binomial Transform, Difference Table - John Keith - 01-18-2019, 09:44 PM RE: (48G/50g) Binomial Transform, Difference Table - John Keith - 05-27-2019 09:07 PM

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