import graph; size (8cm,0); real f(real x) {return (x^3-3x^2-x+2)/3;} path Cf=graph(f,-1.6,3.5); draw(Cf); // real dirtime(path p, pair z); // returns the first "time", a real number between 0 and the length of // the path in the sense of point(path, real), at which the tangent // to the path has the direction of pair z, or -1 if this never happens. real tA=dirtime(Cf,(1,0)); // le "time" du premier point du path // dont la tangente est dans la direction (1,0). pair pA=point(Cf,tA); // et le point correspondant du path dot(pA,4bp+red); // que l'on dessine en rouge. // on procède de la même manière avec le path orienté dans l'autre sens // pour trouver le second point bleu. real tB=dirtime(reverse(Cf),(-1,0)); pair pB=point(reverse(Cf),tB); dot(pB,4bp+blue); draw(pA--pA+(1,0),grey,Arrow); draw(pB--pB+(-1,0),grey,Arrow); xaxis(Label("$x$",position=EndPoint, align=NE), Ticks(scale(.7)*Label(),NoZero,Size=.8mm, size=.4mm)); yaxis(Label("$y$",position=EndPoint, align=NE), Ticks(scale(.7)*Label(),NoZero,Size=.8mm, size=.4mm)); label("Utilisation de dirtime",truepoint(SE),NW);