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: *

- First graph the function and estimate the area of this region
(by eye).
[> 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(");

- Find an upper and lower bound for the area of this region
using inscribed
and circumscribed rectangles with n = 10.
Repeat using 100 subrectangles. Repeat using 1000 rectangles.

If you have loaded the student package, you just need commands like:[> evalf(leftsum(f(x), x = 1..3, 10));

- Maple can even compute the limit of the sum of the inscribed
rectangles. Try this:
[> leftsum( f(x), x = 1..3, n ); [> limit( " , n = infinity );

- Maple can also compute definite integrals using the fundamental
theorem of calculus.
[> 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. - As in the examples above, we compute the area
under the curve y = (sin(x))^2 for x from 0 to Pi.
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.)

Use leftbox and rightbox to look at the approximating rectangles.[> leftbox(f(x), x = 0..Pi, 10); [> rightbox(f(x), x = 0..Pi, 10);

Since this function changes from increasing to decreasing at x = Pi/2, we need to combine`leftsum`and`rightsum`to compute the inscribed rectangles. For n = 10 and*inscribed rectangles*we need[> evalf( leftsum(f(x), x = 0..Pi/2, 5) ) + evalf( rightsum(f(x), x = Pi/2..Pi, 5);

Compute the limit as n goes to infinity of the inscribed rectangles.[> limit( leftsum( f(x), x = 0..Pi/2, n), n = infinity ) + limit( rightsum( f(x), x = Pi/2..Pi, n), n = infinity );

Compare to the result of[> Int(sin(x)*sin(x), x = 0..Pi) = int( f(x), x = 0..Pi );

- Modify the commands of the previous exercise to compute
the area using
*circumscribed rectangles*. - Using the examples above as a guide, compute the area
under the curve y = for sin(x)*exp(x) for x from 0 to Pi.
Define our new function and graph it:

[> f := x -> sin(x)*exp(x); [> plot(f(x), x = 0..Pi);

This time use`middlebox`and`middlesum`to estimate the area:[> 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.

Next, compute the limit as n goes to infinity:[> limit( middlesum(f(x), x = 0..Pi, n), n = infinity);

Finally, compute the area using[> Int( sin(x)*exp(x), x = 0..Pi ) = int( f(x), x = 0..Pi );

- Let f(x) = sin(x)*exp(x) and consider the area under this curve
for x from 0 to Pi as in the previous problem.

Use leftbox and rightbox to look at approximating rectangles.[> 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.

Replot the graph of f and click on the peak to estimate its coordinates. Define a variable`xmax`that corresponds to the x-value where the peak occurs.[> plot( f(x), x = 0..Pi ); [> xmax := ---Fill in correct value from your plot---;

Now you can draw inscribed rectangles using[> 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.

Use`leftsum`and`rightsum`to compute the area using inscribed rectangles and at least 100 subrectangles.

Estimate the area using (100) circumscribed rectangles.