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 définit le path correspondant à la partie de Cf débutant au point rouge. path Cf2=subpath(Cf,tA,reltime(Cf,1)); // Une autre façon de trouver le point bleu avec la fonction : // real[] mintimes(path p) // returns an array of length 2 containing times at which path p // reaches its minimal horizontal and vertical extents, respectively. pair pB=point(Cf2,mintimes(Cf2)[1]); draw(Cf2,1bp+red); dot(pB,4bp+blue); draw(pA--pA+(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("dirtime/reltime/mintimes",truepoint(SE),NW);