> # Archimedes diagrams.mws
 

The diagrams generated here are to be imported into Archimedes area.mws. Initially I used cumbersome  

variations of my own arch_see procedures to generate parts of the pictures, but I wanted something simpler.  

I eventually settled on the use of 'PLOT' and 'POLYGONS'. 

 

This is to produce the first diagram, simply a parabola ( , between ... etc): 

> with(plots):  # needed for 'display'
 

> f := x -> x^2: a := -2: b := 3:
parabola := plot(f(x), x = (a-.1)..(b+.2)):
text1 := textplot([(a+b)/2,(f(a)+f(b))/2,
                 '` parabola P`']):
display([parabola, text1], axes=none);
 

Plot_2d
 

Now the second diagram, the one showing two points - A and B - on it: 

> parabola := plot(f(x), x = (a-.1)..(b+.2)):
textA := textplot([a, f(a)-.4, 'A']):
textB := textplot([b+.2, f(b), 'B']):
display([parabola, textA, textB], axes=none);
 

Plot_2d
 

Now for the third diagram, the one showing A and B joined: 

> parabola := plot(f(x), x = (a-.1)..(b+.2)):
textA := textplot([a, f(a)-.4, 'A']):
textB := textplot([b+.2, f(b), 'B']):
lineAB := plot([[a, f(a)],[b, f(b)]], thickness=3):
display([parabola, textA, textB, lineAB], axes=none);
 

Plot_2d
 

>
 

Now to produce the fourth diagram, the one showing the initial, approximating triangle ABC: 

> parabola := plot(f(x), x = (a-.1)..(b+.2)):
textA := textplot([a, f(a)-.4, 'A']):
textB := textplot([b+.2, f(b), 'B']):
c := (a+b)/2:
triACB := PLOT(POLYGONS(
      [[a, f(a)], [c, f(c)], [b, f(b)]],
      COLOUR(RGB, 1, 0, 0))):
textC := textplot([c+.1, f(c)-.4, 'C']):
display([parabola, triACB, textA, textB, textC], axes=none);
 

Plot_2d
 

>
 

Now for the fifth diagram (the one showing the first two extra triangles): 

> parabola := plot(f(x), x = (a-.1)..(b+.2)):
textA := textplot( [a, f(a)-.4, 'A']):
textB := textplot( [b+.1, f(b), 'B']):
c := (a+b)/2:
triACB := PLOT(POLYGONS(
      [[a, f(a)], [c, f(c)], [b, f(b)]],
      COLOUR(RGB, 1, 0, 0))):
textC := textplot( [c+.1, f(c)-.2, 'C']):
# the two extra (green) triangles are defined by:
d := (a+c)/2:
triADC := PLOT(POLYGONS(
      [[a, f(a)], [d, f(d)], [c, f(c)]],
      COLOUR(RGB, 0, 1, 0))):
textD := textplot([d-.1, f(d)-.3, 'D']):
e := (c+b)/2:
triCEB := PLOT(POLYGONS(
      [[c, f(c)], [e, f(e)], [b, f(b)]],
      COLOUR(RGB, 0, 1, 0))):
textE := textplot([e+.1, f(e)-.2, 'E']):
display([parabola, triACB, triADC, triCEB,
        textA, textB, textC, textD, textE], axes=none);
 

Plot_2d
 

>
 

A reminder of the kind of construction being used above: 

> PLOT(POLYGONS(
      [[a, f(a)], [c, f(c)], [b, f(b)]],
      COLOUR(RGB, 0, 1, 0)));
# then Axes, None, and shrink size to give:
 

Plot_2d
 

>