%@AUTEUR:Guillaume Connan
prologues:=2;
verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex
input courbes;
input geo;
color vert_e, turquoise, orange, vert_fonce, rose, vert_mer, bleu_ciel, or, rouge_v,bleu_m,bleu,bleu_f;
vert_e:=(0,0.790002,0.340007);
turquoise:=(0.250999,0.878399,0.815699);
orange:=(0.589999,0.269997,0.080004);
vert_fonce:=(0,1.4*0.392193,0);
rose:=(1.0, 0.752907, 0.796106);
bleu_ciel:=(1.2*0.529405,1.2*0.807794,1);%.2*0.921598);
or:=(1,0.843104,0);
rouge_v:=(0.829997,0.099994,0.119999);
bleu_m:=(0.7*0.529405,0.7*0.807794,0.7);%*0.921598);
bleu_f:=(0.211762,0.3231176,0.3686392);
bleu:=(0.529405,0.807794,1);
% Déclarations des constantes %
numeric xmin, xmax, ymin, ymax, N;
ux:=2cm; uy:=2cm;
xmin :=-.5 ; xmax :=2.3;
ymin := -.3; ymax :=2.5;
pair d,h;
d=(.05*ux,0);
h=(0,.05*uy);
% Définitions des axes et labels associés
vardef axes =
drawarrow (ux*xmin,0) -- (ux*xmax,0) ; % axe des x
drawarrow (0,uy*ymin) -- (0,uy*ymax); % axe des y
label.rt(btex $x$ etex,(xmax*ux,0)); % label de l'axe des x
label.urt(btex $y$ etex,(0,ymax*uy)); % label de l'axe des y
enddef;
beginfig(1);
axes;
vardef f(expr x) = 2/(x+1) enddef;
vardef trace (suffix g)(expr a,b,inc) =
save i; numeric i;
for i=a step inc until b:
(i*ux,g(i)*uy) ..
endfor (b*ux,g(b)*uy)
enddef;
path P,Q;
P=trace(f,-.2,2,.01) ;
Q=(-.2*ux,-.2*uy)--(2*ux,2*uy);
draw P withpen pencircle scaled 1.3bp;
draw Q withcolor bleu;
label.rt(btex $\displaystyle y=f(x)$ etex,(2*ux,f(2)*uy)); label.rt(btex $y=x$ etex,(2*ux,2*uy)) withcolor bleu;
draw (.2*ux,0)--(.2*ux,f(.2)*uy)--(f(.2)*ux,f(.2)*uy)--(f(.2)*ux,f(f(.2))*uy)--(f(f(.2))*ux,f(f(.2))*uy)--(f(f(.2))*ux,f(f(f(.2)))*uy)--(f(f(f(.2)))*ux,f(f(f(.2)))*uy) withcolor bleu_m;
drawarrow (.2*ux,0)--1/2[(.2*ux,0),(.2*ux,f(.2)*uy)];
draw 1/2[(.2*ux,0),(.2*ux,f(.2)*uy)]--(.2*ux,f(.2)*uy) withcolor bleu_m;
drawarrow (.2*ux,f(.2)*uy)--1/2[(.2*ux,f(.2)*uy),(f(.2)*ux,f(.2)*uy)] withcolor bleu_m;
draw 1/2[(.2*ux,f(.2)*uy),(f(.2)*ux,f(.2)*uy)]--(f(.2)*ux,f(.2)*uy) withcolor bleu_m;
drawarrow (f(.2)*ux,f(.2)*uy)--1/2[(f(.2)*ux,f(.2)*uy),(f(.2)*ux,f(f(.2))*uy)] withcolor bleu_m;
draw 1/2[(f(.2)*ux,f(.2)*uy),(f(.2)*ux,f(f(.2))*uy)]--(f(.2)*ux,f(f(.2))*uy) withcolor bleu_m;
drawarrow (f(.2)*ux,f(f(.2))*uy)--1/2[(f(.2)*ux,f(f(.2))*uy),(f(f(.2))*ux,f(f(.2))*uy)] withcolor bleu_m;
draw 1/2[(f(.2)*ux,f(f(.2))*uy),(f(f(.2))*ux,f(f(.2))*uy)]--(f(f(.2))*ux,f(f(.2))*uy) withcolor bleu_m;
drawarrow (f(f(.2))*ux,f(f(.2))*uy)--2/3[(f(f(.2))*ux,f(f(.2))*uy),(f(f(.2))*ux,f(f(f(.2)))*uy)] withcolor bleu_m;
draw 2/3[(f(f(.2))*ux,f(f(.2))*uy),(f(f(.2))*ux,f(f(f(.2)))*uy)]--2/3[(f(f(.2))*ux,f(f(.2))*uy),(f(f(.2))*ux,f(f(f(.2)))*uy)] withcolor bleu_m;
draw ((f(f(f(.2)))*ux,f(f(f(.2)))*uy)--(f(f(f(.2)))*ux,uy)) dashed withdots withpen pencircle scaled 1.3bp withcolor bleu_m;
draw ((.2*ux,0) shifted h)--((.2*ux,0) shifted -h);
label.bot(btex $u_0$ etex,(.2*ux,0) shifted -h)withcolor bleu_m;
draw ((f(.2)*ux,0) shifted h)--((f(.2)*ux,0) shifted -h);
draw ((f(.2)*ux,0) --(f(.2)*ux,f(f(.2))*uy)) dashed evenly withcolor bleu_f;
label.bot(btex $u_1$ etex,(f(.2)*ux,0) shifted -h)withcolor bleu_f;
draw ((f(f(.2))*ux,0) shifted h)--((f(f(.2))*ux,0) shifted -h) withcolor bleu_f;
draw ((f(f(.2))*ux,0) --(f(f(.2))*ux,f(f(f(.2)))*uy))dashed evenly withcolor bleu_f;
label.bot(btex $u_2$ etex,(f(f(.2))*ux,0) shifted -h) withcolor bleu_f;
draw ((f(f(f(.2)))*ux,0) shifted h)--((f(f(f(.2)))*ux,0) shifted -h) withcolor bleu_f;
draw ((f(f(f(.2)))*ux,0) --(f(f(f(.2)))*ux,f(f(f(f(.2))))*uy)) withcolor bleu_f dashed evenly;
label.bot(btex $u_3$ etex,(f(f(f(.2)))*ux,0) shifted -h+d/2) withcolor bleu_f;
draw((f(f(f(.2)))*ux,f(f(f(.2)))*uy)--(f(f(f(.2)))*ux,f(f(f(f(.2))))*uy)) dashed evenly withpen pencircle scaled 1.3bp withcolor bleu_f;
draw ((ux,0)--(ux,uy)) dashed evenly withcolor bleu_f;
draw ((ux,0) shifted h)--((ux,0) shifted -h) withcolor bleu_f;
label.bot(btex $\large{\ell}$ etex,(ux,0) shifted -h-d/2) withcolor bleu_f;
label.ulft(btex $0$ etex,(0,0));
endfig;
end