Post Reply 
(71B) Expanding the Binomial (ax+b)^n
06-27-2016, 03:29 AM (This post was last modified: 08-26-2016 04:16 AM by Eddie W. Shore.)
Post: #1
(71B) Expanding the Binomial (ax+b)^n
BINOMEXP gives the coefficients of the expansion of (ax+b)^n.
Code:

Program BINOMEXP (about 189 bytes)

10 DESTROY A,B,N,L,I,C
12 OPTION BASE 0
14 DISP ‘exapand(Ax+B)^N’ @ WAIT 1
16 INPUT “A,B,N”;A,B,N
18 DIM L(N)
20 FOR I=0 TO N
22 C=FACT(N)/(FACT(I)*FACT(N-I))  \\ FACT is the factorial function
24 L(I)=C*A^(N-I)*B^I
26 DISP “L(“; I; ”):”; L(I); “x^”; N-I  @ PAUSE
28 NEXT I
40 DISP “DONE, CHECK L.”
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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