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);

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

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);

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;

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

> evalf(%);

Use the right hand endpoint and repeat the process.

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

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

> evalf(%);

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

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

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

> evalf(%);

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

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

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

> evalf(%);

Now we produce the indefinite integral.

> Int(f(x),x);

> value(%);

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);

> F(4)-F(0);

>

> evalf(%);

Finally, we evaluate the integral directly.

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

>

> evalf(%);

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);

> evalf(%);

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

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

> value(%);

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

> Int(g(x),x);

> value(%);

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

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

> evalf(%);

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

> evalf(%);

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

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.