summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/examples/lowupint.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/examples/lowupint.asy')
-rw-r--r--Build/source/utils/asymptote/examples/lowupint.asy31
1 files changed, 31 insertions, 0 deletions
diff --git a/Build/source/utils/asymptote/examples/lowupint.asy b/Build/source/utils/asymptote/examples/lowupint.asy
new file mode 100644
index 00000000000..1c3a0cd9488
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/lowupint.asy
@@ -0,0 +1,31 @@
+import graph;
+
+real f(real x) {return x^3-x+2;}
+pair F(real x) {return (x,f(x));}
+
+void rectangle(real a, real b, real c, real h(real,real))
+{
+ real height=(a < c && c < b) ? f(c) : h(f(a),f(b));
+ pair p=(a,0), q=(b,height);
+ path g=box(p,q);
+ fill(g,lightgray);
+ draw(g);
+}
+
+void partition(real a, real b, real c, real h(real,real))
+{
+ rectangle(a,a+.4,c,h);
+ rectangle(a+.4,a+.6,c,h);
+ rectangle(a+.6,a+1.2,c,h);
+ rectangle(a+1.2,a+1.6,c,h);
+ rectangle(a+1.6,a+1.8,c,h);
+ rectangle(a+1.8,b,c,h);
+
+ draw((a,0)--(F(a)));
+ draw((b,0)--(F(b)));
+
+ draw(graph(f,a,b,operator ..),red);
+ draw((a,0)--(b,0));
+ labelx("$a$",a);
+ labelx("$b$",b);
+}