%@AUTEUR:Guillaume Connan
prologues:=2;

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);
%Graphique f-1 , f pas monotone
  
% Déclarations des constantes %
  ux:=0.45cm; uy:=ux;
  xmin:=-1; xmax:=9;
  ymin:=xmin; ymax:=9;
  coefficient:=1; % coefficient d'échelle

%Tracé des axes
  axes;
  
% Définitions de la fonction
  numeric h, debut, fin;
  h:=1.5;
  
  xA:=1*h; yA:=2*h;
  xE:=2.875*h; yE:=5*h;
  xD:=4.125*h; yD:=yE;
  xB:=3.5*h; yB:=5.25*h;
  xC:=4.5*h; yC:=4.75*h;
  
  pair A, D, E, B, C;
  A:=(xA*ux,yA*uy);
  D:=(xD*ux,yD*uy);
  E:=(xE*ux,yE*uy);
  B:=(xB*ux,yB*uy);
  C:=(xC*ux,yC*uy);
  
  draw (A .. E .. B .. D .. C) withpen pencircle scaled 1.3bp withcolor bleu_f;
  
  draw D withpen pencircle scaled 3bp withcolor 0.6white;
  draw E withpen pencircle scaled 3bp withcolor 0.6white;
  draw ((xD*ux,0)--D--(0,yD*uy)) dashed evenly withcolor 0.6white;
  draw (E--(xE*ux,0)) dashed evenly withcolor 0.6white;
  
  label.bot(btex $x_2$ etex,(xD*ux,0));
  label.bot(btex $x_1$ etex,(xE*ux,0));
  label.lft(btex $y_0$ etex,(0,yE*uy));
  label.rt(btex $y=f(x)$ etex,C) withcolor bleu_f;
endfig;
end