DISP Mathematics (Scie 1500R)

MAPLE Lab. Tutorial 5 Integration
Monday February 14.

** 1** SUMS.

MAPLE can evaluate most of the summations that one finds in Calculus books.
To evaluate

use the command

As we saw last week for limits, there is a useful way of getting MAPLE to write
out such things nicely (we shall see the same thing with integrals below). This
is to use the command ` > Sum(f(i), i=1..n);` This returns a nicely formatted
expression for the sum. Therefore, if you want the whole thing to look good, try
` > Sum(f(i), i=1..n)= sum(f(i), i=1..n);` .

Try the following commands:

` > sum(i2,i=1..10);
> Sum(i2,i=1..10);
> value(%);
> evalf(%%);
> Sum(i2,i=1..10) = sum(i2,i=1..10);`

** 2** INTEGRATION

The command for indefinite integration is

` > int(f(x), x);`

but this does NOT give you an arbitrary constant at the end (you must supply that).
For definite integration, the command is

` > int(f(x), x=a..b);`

Note that in both of these, is an expression.

MAPLE will try and do the definite integral symbolically and give an * exact*
answer. If it cannot do so, it will return the expression for the integral.
To evaluate integrals exactly, use ` > value(.);` to get a decimal approximation
use ` > evalf(.);`

There is a special MAPLE package to help students with Calculus exercises. Type

` > ?student;` to see what it has.

** 3** EXERCISES

** NAME STUDENT # **

Before you start these exercises type

` > restart;
> with(student);`

Now define the * expressions* and to be

1. Riemann sums. Type the following commands:

` > leftbox(f,x=0..2,8);
> leftsum(f,x=0..2,8);
> evalf(%);
> rightbox(f,x=0..2,8);
> rightsum(f,x=0..2,8);
> evalf(%);`

Write down two inequalities for

2. Repeat question 1. with 80 subintervals.

Write down two new inequalities for

3. Type the following commands:

` > int(f,x=0..2);`

(i) Find a decimal approximation for this integral

` > Int(f,x=0..2);
> value(%);
> Int(f,x=0..2)= int(f,x=0..2);
> int(f,x);
> diff(%,x);`

(ii) What theorem is verified by the last two formulas?

4. Type the following command:

` > int(g,x=1..3);`

What does this tell you about this integral?

§5.9 of the text is called Numerical Integration. It talks about two methods
for finding numerical approximations to integrals. These are the Trapezoid Rule
and Simpson's Rule. There is not much point in talking about them in class when
you have MAPLE available. MAPLE will do both as follows:

` > trapezoid(g,x=1..3,12);
> simpson(g,x=1..3,12);`

Give the

Trapezoid: Simpson:

Which of the two rules used above (Trapezoid and Simpson) is the more accurate?

5. Areas Between Curves: Type
` > restart:
> f := x4 - 3*x2 + 2*x + 1;
> g := x2 + cos(x);
`

Find the area trapped between these two curves.
`
> plot({f,g},x=-3..3);
> plot({f,g},x=-3..2,y=-5..5);
> x0 := fsolve(f=g,x,-3..-2);
> x1 := fsolve(f=g,x,-2..0.5);
> A1 := int(g-f,x=x0..x1);
> x2 := fsolve(f=g,x,0.5..1);
> A2 := int(f-g,x=x1..x2);
> x3 := fsolve(f=g,x,1..2);
> A3 := int(g-f,x=x2..x3);
`

What is the area between the curves?

Theoretically, the following should give the same answer:

But it didn't!? Maple, while pretty smart, has difficulty doing Calculus with absolute values.