kill(all)$

maxima : programming :Binomial_theorem Newton,version 1.0
peter.vlasschaert@gmail.com,26/07/2022

→ ref :

ned :https://nl.wikipedia.org/wiki/Binomium_van_Newton
eng :https://en.wikipedia.org/wiki/Binomial_theorem

expr1:expand((1+x)^5);

p1:listofvars(expr1);

highest power : expr1

p2:hipow(expr1,p1[1]);

p3:polynomialp(expr1,p1);

? make list of coef. from expr1
----------------------------------------

p4a:makelist(ratcoef(expr1,(p1[1]),i),i,0,p2);

? make matrix : (1+x)^j , j=0,1..5
-----------------------------------------

p4b:makelist(makelist(ratcoef((1+x)^j,(p1[1]),i),i,0,j),j,0,p2);

p4b1:length(p4b);

p4b2:genmatrix(A, p2+1, p2+1);

for i:1 thru p2+1 do(
A[i,j]:makelist(ev(p4b[i][j],nouns),j,1,i)
                                );

A[4,2]:p4b[4][2];

p4b3:ev(p4b2,nouns);

makelist(A[4,j]:p4b[4][j],j,1,4);

p4b4:ev(p4b2,nouns);

for i:1 thru p2+1 do(  
    makelist(A[i,j]:p4b[i][j],j,1,i),
    makelist(A[i,j]:0,j,i+1,p2+1)
)$

Binomium van Newton
----------------------------

representation : lower triangle .

use : p4b

p4b5:ev(p4b2,nouns);

→ table form

p4c:table_form(p4b5)$

find : (1+x)^5

→ use : sum , combinatorics.

1e step : load(functs)

p5a:load(functs)$

2e step : how use combination.

p5b:makelist(combination(2,i),i,0,2);

rem : values in 3e line p4c

3e step : final step

p5c:n:5;

→ mathematical notation. 

p5c1:(a+b)^m = ' sum(combination(m,j)*a^j*b^(m-j),j,0,m);

→  m=n

p5c2:subst([m=n],p5c1);

expanded : version p5c2

p5d:(a+b)^n = sum(combination(n,j)*a^j*b^(n-j),j,0,p2);

p5e:subst([b=x,a=1],p5d);

definition : BTN → (aa+bb)^jj "function (:=)"
-----------------------------------------------------

BTN(aa,bb,jj):=sum(combination(jj,j)*aa^j*bb^(n-j),j,0,jj);

BTN(a,b,n);

check : How "is" works
----------------------------

is(%=rhs(p5d));

rem:
------

p5f:is(expr1=rhs(p5e));

→ keywords :

use :expand,listofvars,polynomail(p),genmatrix,combinatiom,is.

% : result before.

-----------------------------------------------------------------------------