
clear
X=poly(0,"X")
A1=[15:65].^3;
B1=X^[15:65];
P1=A1*B1';
po=horner(P1,0.9)



L=[1,X]
for m=3:50
  n=m-1;
  L(m)=(2*n-1)/n*X*L(m-1)-(n-1)/n*L(m-2);
end;  
i1=integrate('exp(t)*horner(L(6),t)','t',-1,1)

T=0
for k=1:6
  T=T+sqrt(2*k+1)*integrate('exp(t)*horner(L(k),t)','t',-1,1)*L(k);
end;

x=-1:0.01:1;
y=exp(x);
z=horner(T,x);
plot2d(x,y)
plot2d(x,z)



function y=f(x)
    y=2.0.*x./(1+x.^2);
 endfunction

function z=rectangleTier(n) 
    x0=0:n-1;                  
    x=x0/n;        
      s=0.0
      for i=x;  
        s=s+f(i+2/(3*n));
      end;      
    z=s/n           
endfunction

A=10:100;
 E=[];
 for n=A;
   E=[E,rectangleTier(n)];
 end;

