Area Under A Curve
an example
We are going to investigate the area of the region between the graph of the x-axis and the graph of 
 between x = -1 and x = 3.
| > | with(plots): | 
Warning, the name changecoords has been redefined
| > | with(Student[Calculus1]): | 
| > | f:=x->x^3-2*x^2-3*x+10; | 
| > | plot(f(x),x=-2..3.5,y=-5..20,thickness=3); | 
Here is a picture of the region whose area is to be calculated.
| > | plot(f(x),x=-1..3,y=-3..12,thickness=3,filled=true); | 
First we will approximate the area using a "right" approximation with 20 subintervals.
| > | ApproximateInt(f(x),x=-1..3,method=right,partition=20,output=plot,thickness=3); | 
The sum command can be used to sum the areas of the 20 approximating rectangles.
| > | sum(f(-1+i/5)/5,i=1..20); | 
| > | evalf(%); | 
The exact area can be computed using a definite integral and the Fundamental Theorem of Calculus.
| > | Int(f(x),x=-1..3); | 
| > | evalf(%); | 
| > | int(f(x),x=-1..3); | 
Here is the area approximated using 200 approximating rectangles.
| > | sum(f(-1+i/50)/50,i=1..200); | 
| > | evalf(%); | 
| > | ApproximateInt(f(x),x=-1..3,method=right,partition=200,output=plot,thickness=3); | 
Here is an animation going from 4 subintervals to 128 subintervals.
| > | ApproximateInt(f(x),x=-1..3,method=right,partition=4,output=animation,thickness=2); | 
Here is an animation using a "midpoint" approximation.
| > | ApproximateInt(f(x),x=-1..3,method=midpoint,partition=4,output=animation,thickness=2); | 
The animation below uses a "left" approximation.
| > | ApproximateInt(f(x),x=-1..3,method=left,partition=4,output=animation,thickness=2); | 
| > |