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

% Visualisation PHYSIQUE de la def des lim

% Déclarations des constantes %
numeric xmin, xmax, ymin, ymax, N;

ux:=1.25cm;  uy:=1.15cm;
xmin := -0.2 ; xmax := 5;
ymin := -0.2 ; ymax := 3;

% 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.lrt(btex $T$ 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;

vardef f(expr x) =1/2*x+1/2 enddef;

vardef tracee (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;


beginfig(1);

%  Courbe et point central avec pointillés
  axes;
  label.llft(btex $0$ etex,(0,0));
  
  draw tracee(f,-.2,4.5,.01)  ;
  label.rt(btex $ y=p(\mathit{T})$ etex,(4.5*ux,f(4.5)*uy));

  pair A,B,C,h,b,g,d;

  h=(0,.1*uy);
  b=(0,-.1*uy);
  g=(-.1*ux,0);
  d=(.1*ux,0);
  
  A=(3*ux,f(3)*uy) ;
  
  draw A withpen pencircle scaled 2.5bp;
  
  B=A xscaled 0;
  C=A yscaled 0;
  
  draw A--B dashed evenly;
  draw A--C dashed evenly;
  
  draw (B shifted (-.05*ux,0))--(B shifted (.05*ux,0)) withpen pencircle scaled 2 bp;
  draw (C shifted (0,-.05*uy))--(C shifted (0,.05*uy)) withpen pencircle scaled 2 bp;
  
  label.bot(btex $\textit{T}_0$ etex,C shifted 1.2 b);
  label.lft(btex $p_0$ etex,B shifted g);
  
%  Les intervalles et l'axe des y
  
  pair M,N; % points de l'axe des y
  pair S,T; % points de l'axe des x
  pair p,q; % shift d'epsilon
  numeric n; % epsilon
  
  n:=.5;
  
  p:=(0,n*uy);
  q:=(0,-n*uy);
  
  N:= B shifted p;
  M:= B shifted q;
  
  draw N--(N shifted d)--(N shifted (d+b)) withpen pencircle scaled 2 bp withcolor bleu_m;
  draw N--(N shifted g)--(N shifted (g+b)) withpen pencircle scaled 2 bp withcolor bleu_m ;
  draw M--(M shifted d)--(M shifted (d+h)) withpen pencircle scaled 2 bp  withcolor bleu_m;
  draw M--(M shifted g)--(M shifted (g+h)) withpen pencircle scaled 2 bp withcolor bleu_m ;
  
  label.lft(btex $p_0\!-\!\varepsilon$ etex, M shifted g);
  label.lft(btex $p_0\!+\!\varepsilon$ etex, N shifted g);

% Les crochets sur l'axe des x

  S:=((3-(2*n))*ux,0);
  T:=((3+(2*n))*ux,0); 

  draw S--(S shifted h)--(S shifted (h+d)) withpen pencircle scaled 2 bp withcolor 0.6white;
  draw S--(S shifted b)--(S shifted (b+d)) withpen pencircle scaled 2 bp withcolor 0.6white ;
  draw T--(T shifted h)--(T shifted (h+g)) withpen pencircle scaled 2 bp  withcolor 0.6white;
  draw T--(T shifted b)--(T shifted (b+g)) withpen pencircle scaled 2 bp withcolor 0.6white ;
  
  label.bot(btex $\textit{T}_0\!+\!\varepsilon V/R$ etex,T shifted b);
  label.bot(btex $\textit{T}_0\!-\!\varepsilon V/R$ etex,S shifted b);

% Le gras
  pair Q,R; % les points de la courbe
  path fleched, flecheb;
  
  fleched=(h+g)--(0,0)--(b+g);%flèche vers la droite
  flecheb=(h+g)--(0,0)--(h+d);%flèche vers le bas
  
  Q:=((3-(2*n))*ux,f(3-(2*n))*uy);
  R:=((3+(2*n))*ux,f(3+(2*n))*uy);
  
  draw S--T withpen pencircle scaled 2bp withcolor 0.6white;
  draw M--N withpen pencircle scaled 2bp withcolor bleu_m;
  
  draw (S shifted 1.5 h)--Q dashed evenly withpen pencircle scaled 1.2bp;
  draw (T shifted 1.5 h)--R dashed evenly withpen pencircle scaled 1.2bp;
  draw (N shifted 1.5 d)--R dashed evenly withpen pencircle scaled 1.2bp;
  draw (M shifted 1.5 d)--Q dashed evenly withpen pencircle scaled 1.2bp;
  
  draw fleched shifted (N+(1*ux,0)) withpen pencircle scaled 1.2bp;
  draw fleched shifted (M+(1*ux,0)) withpen pencircle scaled 1.2bp;
  draw flecheb shifted (S+(0,0.7*uy)) withpen pencircle scaled 1.2bp;
  draw flecheb shifted (T+(0,0.7*uy)) withpen pencircle scaled 1.2bp;
  
endfig;
end