KM05_exo2.mw

Exercice 2

>

>

> restart:

> with(plots):

> ListePoints:=proc(f,u0,n)
local X,Y,l,i;

X:=u0;Y:=0;

l:=[X,Y];
point sur l'axe des abscissses [u0,0]
for i from 1 to n do

Y:=f(X);

l:=l,[X,Y];
on ajoute le point sur la courbe [un,f(un)]
X:=Y;

l:=l,[X,Y];
on ajoute le point sur la bissectrice [f(un),f(un)]
od;

[l]

end:

> graphique:=proc(f,u0,n,a,b)
local l,Gf,Gs,diag;

diag:=plot(t,t=a..b,color=red):
Graphe de la bissectrice
Gf:=plot(f,a..b,color=green,thickness=2):  
Graphe de la fonction f
l:=ListePoints(f,u0,n);

Gs:=plot(l,style=line,color=blue):
Graphe constitué des segments associés à la suite  u(n+1)=f(un)
display({Gf,Gs,diag},scaling=constrained);

end:



> f:=t->1-t^2;

f := proc (t) options operator, arrow; 1-t^2 end proc

> a:=0:b:=1:

> u0:=0.7:n:=15:

> graphique(f,u0,n,a,b);

[Plot]