>
 

>
 

Développements limités 

 

> dl:=proc(F,n)
local Der,Pol,f,k;
f:=unapply(F,x);
Der:=f;
Pol:=0;
for k from 0 to n do
  Pol:=Pol+Der(0)*x^k/k!;
  Der:=D(Der);
od;
Pol;
end:

 

> dl(tan(x),10);
 

`+`(x, `*`(`/`(1, 3), `*`(`^`(x, 3))), `*`(`/`(2, 15), `*`(`^`(x, 5))), `*`(`/`(17, 315), `*`(`^`(x, 7))), `*`(`/`(62, 2835), `*`(`^`(x, 9)))) (1)
 

>
 

> T:=proc(F)
local f;
f:=unapply(F,x);
Array([[seq(k,k=0..4)],[seq(evalf(unapply(dl(f(x),5),x)(10^(-k))-f(10^(-k)),20),k=0..4)]]);end:
 

> T(ln(1+x))
 

Array(%id = 68309104) (2)
 

> graph:=proc(f,xmax,ymax,p)
local s,i:
s:=seq(plots[display](plot(dl(f,i),x=-xmax..xmax,color=red),plot(f,x=-xmax..xmax,color=blue)),i=1..p):
plots[display](s,insequence=true,view=[-xmax..xmax,-ymax..ymax]);
end:
 

> graph(cos(x),15,1,50);
 

Plot_2d
 

> graph(ln(`+`(x, 1)), 5, 3, 50); 1
 

Plot_2d
 

> restart:
 

Lagrange 

>
 

> Lagrange:=proc(X,Y,t)
local k,L,P;
P:=0:
for k to nops(X) do
L:=simplify(product(t-X[i],i=1..nops(X))/(t-X[k])):
L:=L/subs(t=X[k],L):
P:=P+Y[k]*L:
od:
sort(expand(P));
end:
 

> Lagrange([1,2,3,4,5],[7,-8,9,-10,11],x);
 

`+`(`*`(6, `*`(`^`(x, 4))), `-`(`*`(`/`(214, 3), `*`(`^`(x, 3)))), `*`(294, `*`(`^`(x, 2))), `-`(`*`(`/`(1463, 3), `*`(x))), 266) (3)
 

>
 

> LagrangeFonction:=proc(f,X,x)
local Y,k;
Y:=[seq(f(X[k]),k=1..nops(X))]:
Lagrange(X,Y,x);
end:
 

> LagrangeFonction(t->1/(1+t^2),[1,2,3,4,5],x);
 

`+`(`*`(`/`(19, 4420), `*`(`^`(x, 4))), `-`(`*`(`/`(147, 2210), `*`(`^`(x, 3)))), `*`(`/`(1731, 4420), `*`(`^`(x, 2))), `-`(`*`(`/`(2373, 2210), `*`(x))), `/`(275, 221)) (4)
 

>
 

>
 

>
 

>
 

> LagrangeGraphe:=proc(g,n,a,b,t,xmin,xmax,ymin,ymax)
local i,s,p;
s:=seq( plots[display]( plot ( LagrangeFonction(g,[a+(b-a)*i/p$i=0..p],t),t=xmin..xmax),plot(g(t),t=xmin..xmax,color=blue)),p=1..n):
plots[display](s,insequence=true,view=[xmin..xmax,ymin..ymax]);
end:
 

> LagrangeGraphe(t->1/(1+t^2),40,-5,5,t,-5,5,-0.2,1.2);
 

Plot_2d
 

> LagrangeGraphe(t->ln(1+t),20,0,5,t,0,5,-2,3);
 

Plot_2d
 

Tchebychev 

> with(orthopoly):
 

> T(5,x);
 

`+`(`*`(16, `*`(`^`(x, 5))), `-`(`*`(20, `*`(`^`(x, 3)))), `*`(5, `*`(x))) (5)
 

> S:=solve(T(5,5*x)=0,x);
 

0, `+`(`-`(`*`(`/`(1, 20), `*`(`^`(`+`(10, `*`(2, `*`(`^`(5, `/`(1, 2))))), `/`(1, 2)))))), `+`(`*`(`/`(1, 20), `*`(`^`(`+`(10, `*`(2, `*`(`^`(5, `/`(1, 2))))), `/`(1, 2))))), `+`(`-`(`*`(`/`(1, 20), ... (6)
 

> [evalf(S)];
 

[0., -.1902113032, .1902113032, -.1175570504, .1175570504] (7)
 

> LagrangeTcheb:=proc(g,n,t,ymin,ymax)
local i,s,p;
s:=seq( plots[display]( plot ( LagrangeFonction(g,[evalf(solve(T(p,x)=0,x))],t),t=-1..1),plot(g(t),t=-1..1,color=blue)),p=1..n):
plots[display](s,insequence=true,view=[-1..1,ymin..ymax]);
end:
 

> LagrangeTcheb(t->1/(1+t^2),10,t,-0.2,1.2);
 

Plot_2d
 

>