Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import geometry;
- import graph;
- import contour;
- size(9cm, 0);
- defaultpen(fontsize(12pt));
- dotfactor = 4;
- picture axis;
- real xmin = -5, xmax = 5,
- ymin = -5, ymax = 5;
- xaxis(axis, xmin=xmin, xmax=xmax,
- Ticks(scale(.7)*Label(align=E, Fill(white) ),
- NoZero,
- beginlabel=false, endlabel=false,
- begin=false, end=false,
- Step=0, step=0,
- Size=0mm, size = 0mm),
- Arrow(2mm),true);
- yaxis(axis, ymin=ymin, ymax=ymax,
- // Ticks(scale(.7)*Label(align=W, Fill(white) ),
- // NoZero,
- // beginlabel=false, endlabel=false,
- // begin=false, end=false,
- // Step=0, step=0,
- // Size=0mm, size = 0mm),
- Arrow(2mm),true);
- real f(real x){return (x^2-3*x-1)/(x^2+1);}
- //guide[][] Cf = contour(f,(xmin,ymin),(xmax,ymax),nx=400,ny=400, new real[]{0}, operator ..);
- path Cf = graph(f, xmin, xmax, n = 400);
- line x = line((xmin,0),(xmax,0));
- point[] fp = intersectionpoints( x, Cf);
- path Df=buildcycle(Cf, (xmax,0)--(xmin,0));
- fill(Df,green);
- draw(Cf, green+1pt);
- label("$x$", (xmax,0), 2S);
- label("$y$", (0,ymax), 2W);
- label("$a$", fp[0],SW );
- label("$b$", fp[1],SE );
- dot(fp[0]^^fp[1]);
- //label(scale(.7)*"$0$", origin, S+W, UnFill);
- ylimits(ymin, ymax, Crop);
- add(axis);
- addMargins(2mm,2mm);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement