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

Subsections


The Definite Integral

Purpose

The purpose of this lab is to introduce you to the definite integral and to Maple commands for computing definite integrals.

Background

Introduction

There are two main ways to think of the definite integral. The easiest one to understand, and the one we'll consider first, 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.

Of course, when we use a definite integral to compute an area or a volume, we are adding up area or volume. So you might ask why make a distinction? The answer is that the notion of an integral as a means of computing an area or volume is much more concrete and is easier to understand.

You have learned in class that the definite integral is actually defined as a (complicated) limit of sums, so it makes sense that the integral should be thought of as a sum. You have also learned in class that the indefinite integral, or anti-derivative, can be used to evaluate definite integrals. Students often concentrate on techniques for evaluating integrals, and ingnore the definition of the integral as a sum. This is a mistake, for the following reasons.

  1. Many functions don't have anti-deriviatives that can be written down as formulas. Definite integrals of such function must be done using numerical techniques, which always depend on the definition of the integral as a sum.
  2. In many applications of the integral in engineering and science, you aren't given the function which is to be integrated and must derive it. The derivation always depends on the definition of the integral as a sum. You will see examples of this later on in the course.

Definite and indefinite integrals with Maple

The basic Maple command for computing definite and indefinite integrals is the int command. The syntax is very similar to that of the leftsum and rightsum commands, except you don't need to specify the number of subintervals. 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 shown below.

  > 
int(x^2,x=0..4);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {64}{3}}
\end{displaymath}\end{maplelatex}
Notice that Maple gives an exact answer, as a fraction. If you want a decimal approximation to an integral, you just put an evalf command around the int command, as shown below.
  > 
evalf(int(x^2,x=0..4));

\begin{maplelatex}
\begin{displaymath}
21.33333333
\end{displaymath}\end{maplelatex}

To compute an indefinite integral with Maple, you just leave out the range for the limits of integration, as shown below.

  > 
int(x^2,x);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {1}{3}}\,{x}^{3}
\end{displaymath}\end{maplelatex}
Note that Maple does not include a constant of integration.

You can also use the Maple int command with functions or expressions you have defined in Maple. For example, suppose you wanted to find area under the curve of the function $f(x)=x \sin(x)$ on the interval $[0,\pi]$. Then you can define this function in Maple with the command

  > 
f := x -> x*sin(x);

\begin{maplelatex}
\begin{displaymath}
{f} := {x} \rightarrow {x}\,{\rm sin}(\,{x}\,)
\end{displaymath}\end{maplelatex}
and then use this definition as shown below.
  > 
int(f(x),x=0..Pi);

\begin{maplelatex}
\begin{displaymath}
{ \pi}
\end{displaymath}\end{maplelatex}

You can also simply give the expression corresponding to $f(x)$ a label in Maple, and then use that label in subsequent commands as shown below. However, notice the difference between the two methods. You are urged you to choose one or the other, so you don't mix the syntax up.

  > 
p := x*sin(x);

\begin{maplelatex}
\begin{displaymath}
{p} := {x}\,{\rm sin}(\,{x}\,)
\end{displaymath}\end{maplelatex}
  > 
int(p,x=0..Pi);

\begin{maplelatex}
\begin{displaymath}
{ \pi}
\end{displaymath}\end{maplelatex}

More on computing definite integrals with Maple

The same int command works to compute any definite integral, whether it corresponds to an area or not. For example, to compute the definite integral

\begin{displaymath}\int_{-2}^{4} (2x-3)^5 \, dx \end{displaymath}

you could use the following Maple command.
  > 
int((2*x-3)^5,x=-2..4);

\begin{maplelatex}
\begin{displaymath}
-8502
\end{displaymath}\end{maplelatex}

Sometimes you need to compute a definite integral involving a piecewise-defined function. For example, suppose you have a function $f(x)$ defined as follows

\begin{displaymath}f(x) = \left\{ \begin{array}{ll}
2-x^2 & \mbox{if $x < 1$} \\
x & \mbox{if $x \geq 1$}
\end{array}\right. \end{displaymath}

and you needed to compute the definite integral

\begin{displaymath}\int_{-5}^{5} f(x) \, dx \end{displaymath}

The best way to do this in Maple is to split it up into two integrals and use the appropriate formula, as shown below. How you split the integral up is determined by where the formula defining the function changes.
  > 
int(2-x^2,x=-5..1)+int(x,x=1..5);

\begin{maplelatex}
\begin{displaymath}
-18
\end{displaymath}\end{maplelatex}

Definite integrals that can't be done analytically

A painful fact is that many functions do not have simple formulas for their antiderivatives. When Maple encounters a definite integral that it can't do, it just echoes the integral, as shown below. Using the evalf command invokes Maple's numerical integration routines to obtain a decimal approximation to the integral.
  > 
int(sin(x+x^3),x=0..1);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \int _{0}^{1}} \mathrm{sin}(x + x^{3})\,dx
\end{displaymath}\end{maplelatex}
  > 
evalf(int(sin(x+x^3),x=0..1));

\begin{maplelatex}
\begin{displaymath}
.5695284641
\end{displaymath}\end{maplelatex}
Sometimes Maple gives an answer to an integral like the one below.
  > 
int(sqrt(1+x^4),x=0..1);

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {1}{3}} \,\sqrt{2} +...
...icK}({\displaystyle \frac {1}{2}} \,\sqrt{2
})
\end{displaymath}\end{maplelatex}
This is an integral that cannot be done analytically, but Maple has recognized that it can be written in terms of a ``known'' integral. By ``known'' we mean an integral that cannot be done analytically, but has been encountered enough times that it has been given a name. In this case, the known integral is what is known as an elliptic integral of the first kind. Maple uses the name EllipticK to refer to this particular integral. For more information, you can look at the help page for EllipticK. As before, you can use the evalf command to obtain a decimal approximation to the integral.
  > 
evalf(int(sqrt(1+x^4),x=0..1));

\begin{maplelatex}
\begin{displaymath}
1.089429413
\end{displaymath}\end{maplelatex}

Definite integrals and average values

If a function $f$ is integrable over an interval $[a,b]$, then we define the average value of $f$, which we'll denote as $\bar{f}_{ab}$, on this interval to be

\begin{displaymath}\bar{f}_{ab} = \frac{1}{b-a} \int_{a}^{b} f(x) \, dx \end{displaymath}

Note that the average value is just a number. Note furthermore that we can rearrange the definition to give

\begin{displaymath}\bar{f}_{ab} \, (b-a) = \int_{a}^{b} f(x) \, dx \end{displaymath}

If $f(x) \geq 0$ on $[a,b]$, then the average value has the following geometrical interpretation: $\bar{f}_{ab}$ is the height of a rectangle of width $b-a$ such that the area of this rectangle is equal to the area under the graph of $f$ from $a$ to $b$. The following example shows you how to compute an average. The last plot command shows the function and the top of this rectangle.

  > 
f :=x ->  x*sin(x) ;

\begin{maplelatex}
\begin{displaymath}
{f} := {x} \rightarrow {x}\,{\rm sin}(\,{x}\,)
\end{displaymath}\end{maplelatex}
  > 
plot(f(x),x=0..Pi);
  > 
f_ave := int(f(x),x=0..Pi)/Pi;

\begin{maplelatex}
\begin{displaymath}
{\it f\_ave} := 1
\end{displaymath}\end{maplelatex}
  > 
plot(f(x),f_ave,x=0..Pi);

Exercises

  1. Use Maple to compute the following definite integrals.
    1. $\displaystyle \int_{0}^{\pi} (x^2+4x)\sin(x) \, dx $
    2. $\displaystyle \int_{0}^{2} (x^2+1)^{12} \, dx $

  2. Use Maple to find the area of the region bounded above by $g(x)
= -x^2+x+6$ and below by $f(x) = x^4-4x^2+x+2$.

  3. Consider the function

    \begin{displaymath}g(x) = \left\{ \begin{array}{ll}
\frac{x}{1+x^2} & \mbox{if $x < 1$} \\
x^2/2 & \mbox{if $x \geq 1$}
\end{array}\right. \end{displaymath}

    Compute the following integral.

    \begin{displaymath}\int_{-1}^{4} g(x) \, dx \end{displaymath}

  4. Use Maple to approximate the following integral.

    \begin{displaymath}\int_{0}^{\frac{\pi}{2}} \sin(x^2) \, dx \end{displaymath}

  5. Suppose that a current $i(t)=-3 \sin(120 \pi t)$ Amperes is flowing through a 20 ohm resistor, $R$. The instantaneous power, $p(t)$, is given by $p(t) = i(t)^2 R = 20 i(t)^2$.
    1. Find the average value of the current $i(t)$ over a single cycle ( $0 \leq t \leq 1/60$). Explain the value you obtain.
    2. Find the average value of the power $p(t)$ over a single cycle ( $0 \leq t \leq 1/60$).
    3. The average power over a single cycle, denoted by $\bar{p}$, is used by electrical engineers to compute the effective or root-mean-square current, denoted by $i_{\mathrm{eff}}$, as

      \begin{displaymath}i_{\mathrm{eff}} = \sqrt{\frac{\bar{p}}{R}} \end{displaymath}

      Compute this quantity for the given value of $i(t)$.


next up previous
Next: About this document ... Up: lab_template Previous: lab_template
Dina Solitro
2000-11-14