input_case nil$ % Legendre polynomials % -------------------- load_package specfn; n:=9$ array P(n); % 0. specfn package on revpri,div; for i:=0:n do write P(i):=legendrep(i,x); % 1. Rodriguez formula procedure P1(n); df((x^2-1)^n,x,n)/(2^n*factorial(n))$ for i:=1:n do if P1(i) neq P(i) then write "error ",i; clear P1; % 2. Generating function a:=(1-2*x*y+y^2)^(-1/2)$ for i:=1:n do << a:=df(a,y)/i; P1:=sub(y=0,a); if P1 neq P(i) then write "error ",i; >>; clear a,P1; % 3. Better way to do the same thing in "binom.red"$ weight y=1$ wtlevel n$ a:=binom(-2*x*y+y^2,-1/2)$ clear y; l:=coeff(a,y)$ for i:=0:n do << if first(l) neq P(i) then write "error ",i; l:=rest(l) >>; clear a,l,binom; % 4. Recurrence relation operator P1; P1(0):=1$ P1(1):=x$ for all i such that fixp(i) and i>1 let P1(i)=(2-1/i)*x*P1(i-1)-(1-1/i)*P1(i-2); for i:=1:n do << P2:=P1(i); if P2 neq P(i) then write "error ",i; >>; for all i such that fixp(i) and i>1 clear P1(i); clear P2; % 5. Another way to do the same thing P1(0):=1$ P1(1):=x$ for i:=2:n do << P1(i):=(2-1/i)*x*P1(i-1)-(1-1/i)*P1(i-2); if P1(i) neq P(i) then write "error ",i; >>; clear P,P1; off revpri,div; end;