\documentclass{amsart}

\usepackage[inline]{asymptote}





\begin{document}

Test du texte et de l'animation pdf.

\begin{asy}
  
import pdfanim;
import graph_pi;
import markers;
//import markers_pi;
texpreamble("\usepackage{amsmath}");
//settings.outformat="pdf";


animation A;

real [][] masuite;
int nn;
int n=15;
string legdicho;
real f(real x){return (x^2-2);}

real[][] dicho(picture pic=currentpicture, real F(real), real a, real b, int nmax)
{
  real an,bn,xn;
  real[][] mvct;
  real [] cn;
  int compt=0;
  an=a;
  bn=b;
  cn.push(a);
  cn.push(b);
  mvct.push(copy(cn));
  if (f(an)*f(bn)<0) {
    for(int i=0; i<nmax; ++i)
      {
	xn=(an+bn)/2;
	if (f(an)*f(xn)<=0) { bn=xn ; } else {an=xn;}
	cn.delete(0); cn.delete(0);
	cn.push(an);
	cn.push(bn);
	mvct.push(copy(cn));
      }
   }
  return mvct;
}

graphicrules(unit=5cm,
             xmin=1, xmax=2, ymin=-1, ymax=2,
             xcrop=Crop);


masuite=dicho(f,1,2,n);
nn=masuite.length-1;
for(int i=0; i < n; ++i) {
    save();
  legdicho="$\left\{\begin{aligned} \null & a_{"+string(i)+"}="+string(masuite[i][0])+"\\ & b_{"+string(i)+"}="+string(masuite[i][1])+"\end{aligned}\right.$";
  draw(graph(f),legend="$f:\longmapsto x^2-2$");
  draw((masuite[i][0],0)--(masuite[i][1],0),linewidth(1mm)+red,Bars(3mm),legend=legdicho);
  draw((masuite[i][0],f(masuite[i][0]))--(masuite[i][0],0),dashed);
  dot((masuite[i][0],f(masuite[i][0])),5bp+red);
  draw((masuite[i][1],f(masuite[i][1]))--(masuite[i][1],0),dashed);
  dot((masuite[i][1],f(masuite[i][1])),5bp+red);
  xaxis("$x$",Ticks);
  yaxis("$y$",Left,Ticks);
  attach(legend(linelength=10mm), point(S),30NE);
  A.add();
    restore();
}
label(A.pdf(150));

label(A.controlpanel(),truepoint(S),S);
pair z=truepoint(S);
label(A.progress(blue),z,SW);
label(A.delay(red),z,SE);







\end{asy}




\end{document}


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
