> |
> |
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); |
(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)) |
(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); |
> |
> | 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); |
(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); |
(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); |
> | LagrangeGraphe(t->ln(1+t),20,0,5,t,0,5,-2,3); |
Tchebychev
> | with(orthopoly): |
> | T(5,x); |
(5) |
> | S:=solve(T(5,5*x)=0,x); |
(6) |
> | [evalf(S)]; |
(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); |
> |