The purpose of this lab is to introduce you to the definite integral and to Maple commands for computing definite integrals.
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 applications (some are seen in the later calculus courses).
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.
We have learned in class that the definite integral is defined as a limit of sums, so it makes sense that the integral should be thought of as a sum. We have also seen in class that the indefinite integral, or anti-derivative, can be used to evaluate definite integrals. The computation of the intergral as a limit of sums although harder than finding antiderivitaves is most often the only option, since :
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.
The rectangular area approximations we will describe in this section depend on subdividing the interval [a,b] into subintervals of equal length. For example, dividing the interval [0,4] into four uniform pieces produces the subintervals [0,1], [1,2], [2,3], and [3,4]. The next step is to approximate the area above each subinterval with a rectangle, with the height of the rectangle being chosen according to some rule. In particular, we will consider the following 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. Make sure you understand the differences between the three different rectangular approximations. Take a moment to see that the different rules choose rectangles which in each case will either underestimate or overestimate the area. Even the midpoint rule, whose rectangles usually have heights more appropriate than those for the left endpoint and right endpoint rules, will produce an approximation which is not exact.
There are also Maple commands leftsum, rightsum, and middlesum to sum the areas of the rectangles, see the examples below. Note the use of evalf to obtain numerical answers.
The Maple commands above use the short-hand summation notation. Since there are only four terms in the sums above, it isn't hard to write them out explicitly, as follows.
However, if the number of terms in the sum is large, summation notation saves a lot of time and space.
It should be clear from the graphs that adding up the areas of the rectangles only approximates the area under the curve. However, by increasing the number of subintervals the accuracy of the approximation can be increased. All of the Maple commands described so far in this lab permit a third argument to specify the number of subintervals. The default is 4 subintervals. See the example below for the area under y=x from x=0 to x=2 using the rightsum command with 4, 10, 20 and 100 subintervals. (As this region describes a right triangle with height 2 and base 2, this area can be easily calculated to be exactly 2.) Try it yourself with the leftsum and middlesum commands.
Since, in this trivial example, we knew that the area is exactly 2, it appears that, as the number of subintervals increases, the rectangular approximation becomes more accurate.
In the example in the previous section, we saw that increasing the number of subintervals gave a better approximation to the area. In such a case, it seems reasonable that taking a limit as the number of subintervals goes to infinity should give the exact answer. This is exactly the idea in defining the definite integral.
When this limit as the number of subintervals goes to infinity exists, we have special notation for this limit and write it as
We will learn later on that if the function f(x) is continuous on the interval [a,b], then this limit always exists and we can write
where A is the area under the curve y=f(x) between x=a and x=b.
The Fundamental Theorem of Calculus (FTOC) provides a connection between the definite integral and the indefinite integral (a.k.a. the antiderivitave). That is, the FTOC provides a way to evaluate definite integrals if an anti-derivative can be found for f(x). We'll spend a lot of time later in the course developing ways to do this, but for now we'll let Maple do the work.
The basic maple command for performing 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. This should make sense, if you recall that the definite integral is defined as a limit of a rectangular sum as the number of subintervals goes to infinity. In the section on rectangular approximations, we used two examples. The first was the function on the interval [0,4] and the second was the function y=x on the interval [0,2]. We would express the areas under these two curves with our integral notation as
Using Maple, we would compute these two definite integrals as shown below.
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.
In the exercises, we'll ask you to compare rectangular approximations to integrals. In doing so, you'll need to apply several commands to the same function. To save typing and prevent errors, you can define the function as a function or an expression in Maple first and then use it in subsequent int, leftsum, etc. commands. For example, suppose you were given the function on the interval . Then you can define this function in Maple with the command
> f := x -> x*sin(x);
and then use this definition to save typing as shown below.
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);