Sec15.01IntegrationChecker.mws

Computing multiple integrals

Worksheet by Mike May, S. J.- maymk@slu.edu

Setting up and checking integrals,

Chapter 15

> restart;

This worksheet is intended to give templates that a student might use in checking homework problems.

Multiple integration

Much of this chapter deals with problems where you need to evaluate a multiple integral. It is worthwhile to note the Maple syntax used for multiple integrals, so that you can use Maple to check your work,

We do multiple integrals in Maple by nesting the integration commands.

It is useful to note that the command Int (upper case i) only sets up the integral. (It is good practice to use both so that you see that the integral is set up properly, as well as computing its value.)

> Int(Int(x^2+y^2+x*y,x = 1..3), y=2..5);
Int(int(x^2+y^2+x*y,x = 1..3), y=2..5);
int(int(x^2+y^2+x*y,x = 1..3), y=2..5);

Int(Int(x^2+y^2+x*y,x = 1 .. 3),y = 2 .. 5)

Int(26/3+2*y^2+4*y,y = 2 .. 5)

146

Note that sometimes the integral is easier to evaluate in one order or the other.

> Int(Int(exp(x^2),x=y..1),y=0..1);
Int(int(exp(x^2),x=y..1),y=0..1);
int(int(exp(x^2),x=y..1),y=0..1);
Int(Int(exp(x^2),y=0..x),x=0..1);
Int(int(exp(x^2),y=0..x),x=0..1);
int(int(exp(x^2),y=0..x),x=0..1);

Int(Int(exp(x^2),x = y .. 1),y = 0 .. 1)

Int(-1/2*I*erf(I)*sqrt(Pi)+1/2*I*sqrt(Pi)*erf(I*y),...

1/2*exp(1)-1/2

Int(Int(exp(x^2),y = 0 .. x),x = 0 .. 1)

Int(exp(x^2)*x,x = 0 .. 1)

1/2*exp(1)-1/2

Plotting regions of integration

On of the major problems with multiple integrals is getting the limits of integration correct. It is useful to plot the region to check the limits of integration. The following sections have blocks of code to visualize the region of integration.

Slicing up and down

We start with an integral of the form int(int(f(x,y),y = g(x) .. h(x)),x = a .. b) . For that integral we are interested in the region with x between a and b, and y between the curves y = g(x) and y = h(x) .

> lowx := 1; highx := 4;
lowcurve := x -> sqrt(x):
highcurve := x -> x:
lines := {}:
for i from 0 to 5 do
xval := lowx + i*(highx - lowx)/5:
lines := lines union
{[[xval, lowcurve(xval)],[xval, highcurve(xval)]]}:
od:
plot([highcurve(x), lowcurve(x), lines[1], lines[2], lines[3], lines[4], lines[5], lines[6]] , x= lowx..highx, color=[green, red, black, black, black, black, black, black], thickness=3);

lowx := 1

highx := 4

[Maple Plot]

Slicing right and left

We also want an example with the order of integration reversed, i.e., an integral of the form int(int(f(x,y),x = g(y) .. h(y)),y = a .. b) . For that integral we are interested in the region with y between a and b, and x between the curves x = g(y) and x = h(y) .

> lowy := 1; highy := 4;
leftcurve := y -> y^2;
rightcurve := y -> y;
xrange := 0..16:
lines := {}:
for i from 0 to 5 do
yval := lowy + i*(highy - lowy)/5:
lines := lines union
{[[leftcurve(yval), yval],[highcurve(yval), yval]]}:
od:
plot({[leftcurve(y), y, y=lowy..highy],
[rightcurve(y), y, y=lowy..highy]} union lines,
x = xrange);

lowy := 1

highy := 4

leftcurve := proc (y) options operator, arrow; y^2 ...

rightcurve := proc (y) options operator, arrow; y e...

[Maple Plot]

N umeric integration

Some integrals will choke even Maple if done symbolically. If we simply want the numeric value of the definite integral, we compose evalf with the inert integral Int.

> Int(sqrt(9*x^4 - 6*x^2 + 2), x=-1..1);
`evalf(Int(sqrt(9*x^4 - 6*x^2 + 2), x=-1..1))`=evalf(Int(sqrt(9*x^4 - 6*x^2 + 2), x=-1..1));
Int(sqrt(9*x^4 - 6*x^2 + 2), x)= int(sqrt(9*x^4 - 6*x^2 + 2), x);
Int(sqrt(9*x^4 - 6*x^2 + 2), x=-1..1)=int(sqrt(9*x^4 - 6*x^2 + 2), x=-1..1);

Int(sqrt(9*x^4-6*x^2+2),x = -1 .. 1)

`evalf(Int(sqrt(9*x^4 - 6*x^2 + 2), x=-1..1))` = 2....

Int(sqrt(9*x^4-6*x^2+2),x) = 1/3*x*sqrt(9*x^4-6*x^2...
Int(sqrt(9*x^4-6*x^2+2),x) = 1/3*x*sqrt(9*x^4-6*x^2...

Int(sqrt(9*x^4-6*x^2+2),x = -1 .. 1) = 2/3*sqrt(5)+...
Int(sqrt(9*x^4-6*x^2+2),x = -1 .. 1) = 2/3*sqrt(5)+...
Int(sqrt(9*x^4-6*x^2+2),x = -1 .. 1) = 2/3*sqrt(5)+...

>

>