next up previous
Next: About this document ... Up: lab_template Previous: lab_template

Subsections


The Definite Integral

Introduction

There are two main ways to think of the definite integral. The easiest one to understand is as a means for computing areas (and volumes). The second way the definite integral is used is as a sum. That is, we use the definite integral to ``add things up''. Here are some examples. This lab is intended to introuduce you to Maple commands for approximating and computing integrals, including applications of integrals.

Approximating area using Riemann Sums

Suppose $f(x)$ is a non-negative, continuous function defined on some interval $[a,b]$. Then by the area under the curve $y=f(x)$ between $x=a$ and $x=b$ we mean the area of the region bounded above by the graph of $f(x)$, below by the $x$-axis, on the left by the vertical line $x=a$, and on the right by the vertical line $x=b$. All of the numerical methods in this lab depend on subdividing the interval $[a,b]$ into subintervals of uniform length.

In these simple rectangular approximation methods, the area above each subinterval is approximated by the area of a rectangle, with the height of the rectangle being chosen according to some rule. In particular, we will consider the left, right and midpoint rules.

The Maple student package has commands for visualizing these three rectangular area approximations. To use them, you first must load the package via the with command. Then try the three commands given below to help you understand the differences between the three different rectangular approximations. Note that the different rules choose rectangles which in each case will either underestimate or overestimate the area.

> with(student):
> rightbox(x^2,x=0..4,8);
> leftbox(x^2,x=0..4,8);
> middlebox(x^2,x=0..4,8);
To commands below show how to approximate the area under the curve $y=x^2$ using the left-endpoint rule in Maple
> f:=x->x^2;
> h:=(4-0)/8;
> h*(f(0)+f(0.5)+f(1)+f(1.5)+f(2)+f(2.5)+f(3)+f(3.5))

Definite and indefinite integrals with Maple

The basic Maple command for computing definite and indefinite integrals is the int command.

To compute the indefinite integral

\begin{displaymath}\int x^2 \, dx \end{displaymath}

with Maple:
> int(x^2,x);
Note that Maple does not include a constant of integration. Suppose you wanted to compute the following definite integral with Maple.

\begin{displaymath}\int_{0}^{4} x^2 \, dx \end{displaymath}

The command to use is:
> int(x^2,x=0..4);

Finding area

If you want to find the area bounded by the graph of two functions, you should first plot both functions on the same graph. You can then find the intersection points using either the solve or fsolve command. Once this is done, you can calculate the definite integral in Maple. An example below illustrates how this can be done in Maple by finding the area bounded by the graphs of $f(x)=-x^2+4x+6$ and $g(x)=x/3+2$:
> f := x-> -x^2+4*x+6; 
> g := x-> x/3+2;
> plot({f(x),g(x)},x=-2..6);
> a := fsolve(f(x)=g(x),x=-2..0);
> b := fsolve(f(x)=g(x),x=4..6);
> int(f(x)-g(x),x=a..b);

Exercises

  1. Plot $f(x)=x\ln(x+1)+2x+8$ over the interval $[-1,5]$. Approximate the area under $f(x)$, above the $x$-axis over the given interval using right-endpoint and midpoint rules with 6 rectanglesusing the Riemann Sum formula and again using Maple's rightsum and middlesum command. Then use an integral to calculate the exact area and state which approximation was better, right-endpoint rule or midpoint rule.

  2. Find the area of the region bounded by the curves $f(x)=2\sqrt{x+10}$ and $\displaystyle g(x)=\frac{x^2}{4}-1$. Include a plot of the region bounded by the given curves.
  3. Find the area of the region bounded by the curves $\displaystyle f(x)=\frac{1}{x^2+1}$ and $\displaystyle g(x)=\ln(x^2+1)$. Include a plot of the region bounded by the given curves.
  4. Find the area of the region bounded by the curves $\displaystyle f(x)=\frac{x^2}{2}-4$ and $\displaystyle g(x)=\sin(x)\cos(x)$. Include a plot of the region bounded by the given curves.

next up previous
Next: About this document ... Up: lab_template Previous: lab_template
Dina J. Solitro-Rassias
2018-09-07