MapleApproxInt.mws

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 f(x) = x^3-2*x^2-3*x+10  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;

f := x -> x^3-2*x^2-3*x+10

>    plot(f(x),x=-2..3.5,y=-5..20,thickness=3);

[Maple Plot]

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);

[Maple Plot]

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);

[Maple Plot]

The sum command can be used to sum the areas of the 20 approximating rectangles.

>    sum(f(-1+i/5)/5,i=1..20);

734/25

>    evalf(%);

29.36000000

The exact area can be computed using a definite integral and the Fundamental Theorem of Calculus.

>    Int(f(x),x=-1..3);

Int(x^3-2*x^2-3*x+10,x = -1 .. 3)

>    evalf(%);

29.33333333

>    int(f(x),x=-1..3);

88/3

Here is the area approximated using 200 approximating rectangles.

>    sum(f(-1+i/50)/50,i=1..200);

36667/1250

>    evalf(%);

29.33360000

>    ApproximateInt(f(x),x=-1..3,method=right,partition=200,output=plot,thickness=3);

[Maple Plot]

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);

[Maple Plot]

Here is an animation using a "midpoint" approximation.

>    ApproximateInt(f(x),x=-1..3,method=midpoint,partition=4,output=animation,thickness=2);

[Maple Plot]

The animation below uses a "left" approximation.

>    ApproximateInt(f(x),x=-1..3,method=left,partition=4,output=animation,thickness=2);

[Maple Plot]

>