Advertisement
sutasuu

graph1(uncomp)

Oct 14th, 2024 (edited)
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Asymptote 1.30 KB | Source Code | 0 0
  1. import geometry;
  2. import graph;
  3. import contour;
  4.  
  5. size(9cm, 0);
  6. defaultpen(fontsize(12pt));
  7. dotfactor = 4;
  8. picture axis;
  9.  
  10. real xmin = -5, xmax = 5,
  11.      ymin = -5, ymax = 5;
  12. xaxis(axis, xmin=xmin, xmax=xmax,
  13.     Ticks(scale(.7)*Label(align=E, Fill(white) ),
  14.           NoZero,
  15.           beginlabel=false, endlabel=false,
  16.           begin=false, end=false,
  17.           Step=0, step=0,
  18.           Size=0mm, size = 0mm),
  19.           Arrow(2mm),true);
  20.  
  21. yaxis(axis, ymin=ymin, ymax=ymax,
  22.     // Ticks(scale(.7)*Label(align=W, Fill(white) ),
  23.     //      NoZero,
  24.     //      beginlabel=false, endlabel=false,
  25.     //      begin=false, end=false,
  26.     //      Step=0, step=0,
  27.     //      Size=0mm, size = 0mm),
  28.           Arrow(2mm),true);
  29.  
  30. real f(real x){return (x^2-3*x-1)/(x^2+1);}
  31. //guide[][] Cf = contour(f,(xmin,ymin),(xmax,ymax),nx=400,ny=400, new real[]{0}, operator ..);
  32. path Cf = graph(f, xmin, xmax, n = 400);
  33. line x = line((xmin,0),(xmax,0));
  34. point[] fp = intersectionpoints( x, Cf);
  35. path Df=buildcycle(Cf, (xmax,0)--(xmin,0));
  36.  
  37. fill(Df,green);
  38. draw(Cf, green+1pt);
  39.  
  40. label("$x$", (xmax,0), 2S);
  41. label("$y$", (0,ymax), 2W);
  42. label("$a$", fp[0],SW );
  43. label("$b$", fp[1],SE );
  44. dot(fp[0]^^fp[1]);
  45. //label(scale(.7)*"$0$", origin, S+W, UnFill);
  46. ylimits(ymin, ymax, Crop);
  47. add(axis);
  48. addMargins(2mm,2mm);
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement