Area under y = 2x -x^2 on = Antiderivative of 2x - x^2 evaluated at the
[0,1] right endpoint (x = 1) - Antiderivative evaluated
at the left endpoint (x=0)
= (1^2 - 1^3/3) - (0^2 - 0^3/3) = 1 - 1/3 = 2/3.
The exercises below show how to compute area using Maple.
Exercises and Examples
Find the area under the curve y = 1/x^2 for x from 1 to 3 using inscribed and circumscribed polygons by working through the Maple commands given below:
[> f := x -> 1/x^2; # define f(x)
[> plot( f(x), x = 1..3, scaling = constrained);
We can use Maple to draw some of these polygonal approximations to the area under the curve:
[> with(student); # Load the student package
[> leftbox(f(x), x = 1..3, 4); # Use left endpoints and
4 subintervals
[> rightbox(f(x), x = 1..3, 6); # Use right endpoints and
6 subintervals
Notice that in this example, leftbox gave us the
circumscribed rectangles and rightbox gave us the
inscribed ones. (Will this always be true?)
Maple will also compute these sums for us:
[> leftsum(f(x), x = 1..3, 4); value("); evalf(");
[> rightsum(f(x), x = 1..3, 6); value("); evalf(");
[> evalf(leftsum(f(x), x = 1..3, 10));
[> leftsum( f(x), x = 1..3, n );
[> limit( " , n = infinity );
[> Int( 1/x^2, x = 1..3 ) = int( f(x), x = 1..3 );
When we use Int with a capital I Maple simply
displays the integral. When we type int, Maple actually
evaluates the integral if it can.
First define our new function and graph it on the interval from x = 0 to x = Pi:
[> f := x -> (sin(x))^2;
[> plot( f(x), x = 0..Pi, scaling = constrained);
Estimate the area by eye. (Note that we use the option
scaling = constrained
to ensure that Maple uses the same scale on the horizontal
and vertical axes.)
[> leftbox(f(x), x = 0..Pi, 10);
[> rightbox(f(x), x = 0..Pi, 10);
[> evalf( leftsum(f(x), x = 0..Pi/2, 5) ) +
evalf( rightsum(f(x), x = Pi/2..Pi, 5);
[> limit( leftsum( f(x), x = 0..Pi/2, n), n = infinity )
+ limit( rightsum( f(x), x = Pi/2..Pi, n), n = infinity );
[> Int(sin(x)*sin(x), x = 0..Pi) = int( f(x), x = 0..Pi );
Define our new function and graph it:
[> f := x -> sin(x)*exp(x);
[> plot(f(x), x = 0..Pi);
[> middlebox( f(x), x = 0..Pi, 10 );
[> middlesum( f(x), x = 0..Pi, 10 ); evalf(");
Estimate the area using middlesum with n = 10,
n = 100, and n = 1000.
[> limit( middlesum(f(x), x = 0..Pi, n), n = infinity);
[> Int( sin(x)*exp(x), x = 0..Pi ) = int( f(x), x = 0..Pi );
[> leftbox( f(x), x = 0..Pi, 10 );
[> rightbox( f(x), x = 0..Pi, 10);
Notice that the rectangles change from inscribed to
circumscribed (or vice versa) at the peak.
[> plot( f(x), x = 0..Pi );
[> xmax := ---Fill in correct value from your plot---;
[> with(plots):
[> p1 := leftbox( f(x), x = 0..xmax, 10 ): #Use colon, not semicolon
[> p2 := rightbox( f(x), x = xmax..Pi, 4): #Use colon.
[> display({p1, p2}); #Use semicolon.