INTEGRATION

To motivate the notion of the integral and Riemann sums it is advisable to do an example. For that we need to pull up the package with(student) which has the relevant packages.

> with(student);

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

> f:=x->x^2-4*sin(x);

[Maple Math]

Start with a Riemann sum using the left hand end point and dx=(4-0)/10=0.4 for the interval [0,4].

> leftbox(f(x),x=0..4,10);

[Maple Plot]

The sun clearly underestimates the value of the area enclosed by the graph and the x-axis. Now add up the areas of the rectangles.

> dx:=(4-0)/10;

[Maple Math]

> Sum(f(0+i*dx)*dx,i=0..9);

[Maple Math]

> evalf(%);

[Maple Math]

Use the right hand endpoint and repeat the process.

> rightbox(f(x),x=0..4,10);

[Maple Plot]

> Sum(f(0+i*dx)*dx,i=1..10);

[Maple Math]

> evalf(%);

[Maple Math]

This sum overestimates the area so let's use the midpoint.

> middlebox(f(x),x=0..4,10);

[Maple Plot]

> Sum(f(0+(i+1/2)*dx)*dx,i=0..9);

[Maple Math]

> evalf(%);

[Maple Math]

This sum certainly gives a better approximation so refine the partition by letting dx=(4-0)/200.

> dx:=(4-0)/200;

[Maple Math]

> Sum(f(0+(i+1/2)*dx)*dx,i=0..199);

[Maple Math]

> evalf(%);

[Maple Math]

Now we produce the indefinite integral.

> Int(f(x),x);

[Maple Math]

> value(%);

[Maple Math]

To demonstrate the Fundamental Theorem of Calculus we use the unapply( ,x) command which turns

an expression into a function. Note that Maple does not insert the constant of integration.

> F:=unapply(%,x);

[Maple Math]

> F(4)-F(0);

[Maple Math]

>

> evalf(%);

[Maple Math]

Finally, we evaluate the integral directly.

> Int(f(x),x=0..4);

[Maple Math]

>

> evalf(%);

[Maple Math]

As with the solve( ) command we can enter the function directly into the Int( ) command. We use t instead of x.

> Int(3*sqrt(t)+sin(t),t=0..Pi);

[Maple Math]

> evalf(%);

[Maple Math]

Finally, there is the case where no antiderivative exists or it is expressed in arcane, mysterious functions.

> Int(sqrt(1+x^(3/2)),x);

[Maple Math]

> value(%);

[Maple Math]

> g:=x->exp(cos(x));

[Maple Math]

> Int(g(x),x);

[Maple Math]

> value(%);

[Maple Math]

There is no antiderivative known to Maple. But it easily evaluates the definite integrals.

> Int(exp(cos(x)),x=-1..3);

[Maple Math]

> evalf(%);

[Maple Math]

> Int(sqrt(1+x^(3/2)),x=0.5..1.7);

[Maple Math]

> evalf(%);

[Maple Math]

The with(student) package has some techniques of integration routines (changevar, intparts), and there

is also the convert/parfrac combination. Students may wish to learn them on their own to verify their

homework answers. Also there are some numerical quadrature schemes (midpoint,simpson,

trapezoid) which should be implemented on a calculator, since it is a little absurd to be doing them

with Maple when it has its own very accurate internal scheme.

PROBLEMS

1. For the functions below, find their indefinite integral and its antiderivative then evaluate the

definite integral for the interval given.

a) f(x)=2*x^(-3)-5*x^(3/2), x=1..2 b) g(t)=4*t^3-sin(2*t)+exp(-4*t), t=1..9

c) h(u)=exp(-u)*cos(4*u), u=0..Pi/2

d) f(x)=(x^4-3*x+1)/(x^3-2*x^2-x+2), x=3..5

2. The function sqrt(1+x^3) has no antiderivative. Graph a midpoint Riemann sum approximation

and compute its sum for x=0..1 and n=10, 40. Then evaluate the definite integral.

3. Using the command plot(f,x=0..3,discont=true) plot the piecewise continuous function

f:=piecewise(x<=1,x^2,x<2,2*x+1,2<=x,-2*x).

Then compute its definite integral.

4. Some unbounded functions can be integrated. Graph a midpoint Riemann sum approximation

for x=0..1 and n=20, 50, 100 for the function 1/sqrt(x) and compute its sum. Then find its

indefinite integral and its antiderivative then evaluate the definite integral.


The Maple Worksheet
Maple Tutorial Main Page