%@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);

vardef axes =
  drawarrow (ux*xmin,0) -- (ux*xmax,0); % axe des x
  drawarrow ((0,uy*ymin) -- (0,uy*ymax))  ; % axe des y
enddef;


beginfig(1);
%Reci des tangentes

% Déclarations des constantes  
  ux:=0.8cm; uy:=0.9ux;
  xmin:=-3.5; xmax:=4.5;
  ymin:=xmin; ymax:=xmax;
  coefficient:=1; % coefficient d'échelle
  
%Tracé des axes
  axes;
  
  label(btex $y=x$ etex,(3.3*ux,3.3*uy));
  
% Définitions de la fonction
  vardef f(expr x) :=(-2.5)/x enddef;
  
  vardef trace (suffix F)(expr a,b,inc) :=
    save i; numeric i;
    for i:=a step inc until b:
      (i*ux,f(i)*uy) ..
    endfor (b*ux,f(b)*uy)
  enddef;
  
% Tracé des différentes courbes
  numeric pas, seuil, seuilbis, abscisse;
  pas:=0.009;
  seuil:=3.75;
  seuilbis:=0.75;
  abscisse:=seuilbis+1.5;
  
  xA:=abscisse;
  yA:=f(abscisse);
  xB:=f(abscisse);
  yB:=abscisse;
  xD:=xmin/2;
  yD:=xD;
  xE:=0.75*seuil;
  yE:=xE;
  xG:=seuilbis-0.25;
  yG:=2.5*(xG-xA)/(xA*xA)+yA;
  xH:=seuil-0.25;
  yH:=2.5*(xH-xA)/(xA*xA)+yA;
  xG':=yG;
  yG':=xG;
  xH':=yH;
  yH':=xH;
  
  pair A, B, C, D, E, G, H, G', H';
  A:=(xA*ux,yA*uy);
  B:=(xB*ux,yB*uy);
  D:=(xD*ux,yD*uy);
  E:=(xE*ux,yE*uy);
  G:=(xG*ux,yG*uy);
  H:=(xH*ux,yH*uy);
  G':=(xG'*ux,yG'*uy);
  H':=(xH'*ux,yH'*uy);
  
  C=whatever[A,B]=whatever[D,E];
  
  draw trace(F,f(seuilbis),f(seuil),pas) withpen pencircle scaled 1.3bp withcolor 0.55white; % tracé de la courbe de f
  draw trace(F,seuilbis,seuil,pas) withpen pencircle scaled 1.3bp withcolor bleu_m; % tracé de la courbe de f
  
  draw ((0,yA*uy)--A--(xA*ux,0)) dashed evenly withcolor bleu_f;
  draw ((0,yB*uy)--B--(xB*ux,0)) dashed evenly withcolor bleu_f;
  
  draw D--E  withcolor bleu_f dashed withdots withpen pencircle scaled 2.5bp;
  draw G--H withcolor bleu_m;
  draw G'--H' withcolor 0.55white;
  draw A--B withpen pencircle scaled 1bp;
  label(btex $\Vert$ etex, 1/2[A,C]) withcolor bleu_f;
  label(btex $\Vert$ etex, 1/2[B,C]) withcolor bleu_f;
  label.lrt(btex $\Gamma_f$ etex, (seuil*ux,f(seuil)*uy));
  label.llft(btex $\Gamma_{f^{-1}}$ etex, (f(seuil)*ux,seuil*uy));
  label.urt(btex $\mathcal{T}$ etex, H);
  label.urt(btex $\mathcal{T'}$ etex, H');
  draw (((1,0)--(1,1)--(0,1)) zscaled (5*unitvector(D-E)) shifted C);
  dotlabel.top(btex $x_0$ etex, (xA*ux,0));
  dotlabel.lft(btex $y_0$ etex, (0,yA*uy));
  dotlabel.bot(btex $y_0$ etex, (xB*ux,0));
  dotlabel.rt(btex $x_0$ etex, (0,yB*uy));
endfig;
end