Multiple Integrals 

 

In this worksheet we will explore computing multiple integrals in rectangular, cylindrical, and spherical coordinates. In addition, there are a few examples using Jacobians toward the end of the file. For the most part we will stick to using the "solve" command to help us determine bounds and then used nested copies of "int" to compute iterated integrals. 

 

Maple worksheet: multiple_integrals.mw 

 

> restart;
with(plots):
with(VectorCalculus):
 

 

Example: We can parametrize any surface of the form: z = f(x, y) using two parameters (say s and t) as follows: x = s, y = t, and z = f(s, t). We can then plot such a surface using plot3d either in the "old" way or the "new" (parametric) way.  

 

Consider the function f(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(4, VectorCalculus:-`-`(VectorCalculus:-`*`(`*`(`^`(x, 2)), `/`(1, 8)))), VectorCalculus:-`-`(VectorCalculus:-`*`(`*`(`^`(y, 2)), `/`(1, 8)))) plotted over the square `<=`(-5, x), `<=`(y, 5). The top plot3d command plots the graph of z = f(x, y) the "old way" and the bottom plot3d command plots the graph thought as a parametric surface [note since we used the rectangular coordinate system to parameterize our surface, the plots look identical]. 

 

> f := (x,y) -> 4 - x^2/8 - y^2/8:
'f(x,y)' = f(x,y);

plot3d(f(x,y),x=-5..5,y=-5..5,axes=boxed);

plot3d([s,t,f(s,t)],s=-5..5,t=-5..5,axes=boxed);
 

 

 

f(x, y) = `+`(4, `-`(`*`(`/`(1, 8), `*`(`^`(x, 2)))), `-`(`*`(`/`(1, 8), `*`(`^`(y, 2)))))
Plot_2d
Plot_2d
 

 

We can compute the volume under this paraboloid using the iterated integral  int(int(VectorCalculus:-`+`(VectorCalculus:-`+`(4, VectorCalculus:-`-`(VectorCalculus:-`*`(`*`(`^`(x, 2)), `/`(1, 8)))), VectorCalculus:-`-`(VectorCalculus:-`*`(`*`(`^`(y, 2)), `/`(1, 8)))), y = -5 ..... 

 

> int(int(f(x,y),y=-5..5),x=-5..5);
 

`/`(575, 3) (1)
 

 

Maple can handle plots defined over "x-simple" regions (regions whose left & right sides are graphs of functions) or "y-simple" regions (regions whose top & bottoms are graphs of functions). For example, let's graphf(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(4, VectorCalculus:-`-`(VectorCalculus:-`*`(`/`(1, 8), `*`(`^`(x, 2))))), VectorCalculus:-`-`(VectorCalculus:-`*`(`/`(1, 8), `*`(`^`(y, 2))))) over the region (inside a circle centered at the origin with radius 4). This region Ris both x and y-simple. Let's consider it as x-simple first. We find bounds for x in terms of VectorCalculus:-`*`(diff(y, x), s) and then constant ybounds.  

 

Although I will use Maple to solve for these bounds, this is certainly overkill. We could easy find them "by hand" or by merely looking at it and writing down the "obvious" answers. 

 

> xBounds := solve(x^2+y^2=16,x);
 

`*`(`^`(`+`(16, `-`(`*`(`^`(y, 2)))), `/`(1, 2))), `+`(`-`(`*`(`^`(`+`(16, `-`(`*`(`^`(y, 2)))), `/`(1, 2))))) (2)
 

> solve({xBounds},y);
 

{y = 4}, {y = -4} (3)
 

 

So we get the bounds: `and`(`<=`(VectorCalculus:-`-`(sqrt(VectorCalculus:-`+`(VectorCalculus:-`-`(`*`(`^`(y, 2))), 16))), x), `<=`(x, sqrt(VectorCalculus:-`+`(VectorCalculus:-`-`(`*`(`^`(y, 2))), 16)))) and `and`(`<=`(-4, y), `<=`(y, 4)). 

 

> plot3d(f(x,y),x=-sqrt(16-y^2)..sqrt(16-y^2),y=-4..4,scaling=constrained,axes=boxed,orientation=[45,55,0]);
 

Plot_2d
 

 

Now let's compute the volume under z = f(x, y) using the double integral and these bounds. 

 

> Int(Int(f(x,y),x=-sqrt(16-y^2)..sqrt(16-y^2)),y=-4..4) = int(int(f(x,y),x=-sqrt(16-y^2)..sqrt(16-y^2)),y=-4..4);
 

Int(Int(`+`(4, `-`(`*`(`/`(1, 8), `*`(`^`(x, 2)))), `-`(`*`(`/`(1, 8), `*`(`^`(y, 2))))), x = `+`(`-`(`*`(`^`(`+`(16, `-`(`*`(`^`(y, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(16, `-`(`*`(`^`(y, 2)))), `/`(1... (4)
 

 

Of course it would make far more sense to convert to polar coordinates and compute the integral that way... 

 

> Int(Int((4-r^2/8)*r,r=0..4),theta=0..2*Pi) = int(int(f(r*cos(theta),r*sin(theta))*r,r=0..4),theta=0..2*Pi);
 

Int(Int(`*`(`+`(4, `-`(`*`(`/`(1, 8), `*`(`^`(r, 2))))), `*`(r)), r = 0 .. 4), theta = 0 .. `+`(`*`(2, `*`(Pi)))) = `+`(`*`(48, `*`(Pi))) (5)
 

 

Example: Find the average value of f(x, y, z) = xyz over the region inside the sphere centered at the origin of radius 2 lying in the first octant. Note that the average value of f over a region E is -- that is -- the integral of f over E divided by the volume of E. 

 

> f := (x,y,z) -> x*y*z:
'f(x,y,z)' = f(x,y,z);
 

f(x, y, z) = `*`(x, `*`(y, `*`(z))) (6)
 

 

To plot the region of integral let's plot the surfaces which make up the sides of region. For the part of the ball of radius 2 lying in the first octant, I need the sphere of radius 2 (this makes up the top, front, and right side), part of the xy-plane (the bottom), part of the yz-plane (the back), and part of the xz-plane (the left side). 

 

> sPlot := plot3d(sqrt(4-x^2-y^2),x=0..2,y=0..sqrt(4-x^2),color=blue):
xyPlot := plot3d(0,x=0..2,y=0..sqrt(4-x^2),color=green):
yzPlot := plot3d([0,y,z],y=0..sqrt(4-z^2),z=0..2,color=red):
xzPlot := plot3d([x,0,z],x=0..2,z=0..sqrt(4-x^2),color=gray):
display({sPlot,xyPlot,yzPlot,xzPlot},scaling=constrained,axes=boxed,orientation=[-115,-40,35]);
 

Plot_2d
 

> vol := int(int(int(1       , z=0..sqrt(4-x^2-y^2)), y=0..sqrt(4-x^2)), x=0..2);
 

`+`(`*`(`/`(4, 3), `*`(Pi))) (7)
 

> fint := int(int(int(f(x,y,z), z=0..sqrt(4-x^2-y^2)), y=0..sqrt(4-x^2)), x=0..2);
 

`/`(4, 3) (8)
 

> "Average Value" = fint / vol;
 

Average Value (9)
 

> Int(Int(Int(f(x,y,z), z=0..sqrt(4-x^2-y^2)), y=0..sqrt(4-x^2)), x=0..2) / Int(Int(Int(1       , z=0..sqrt(4-x^2-y^2)), y=0..sqrt(4-x^2)), x=0..2) = fint / vol;
 

`/`(`*`(Int(Int(Int(`*`(x, `*`(y, `*`(z))), z = 0 .. `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2))), `-`(`*`(`^`(y, 2)))), `/`(1, 2)))), y = 0 .. `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2)))), `/`(1, 2)))), x = 0 .. 2)), `... (10)
 

 

Note: To explain the last "weird" command. "Int" is called an inert command -- Maple leaves the integral inert -- it does not actually compute the integral. It just prints it out. In general if I want to display what I'm computing, I like to type something like "Inert commands = normal commands" so that Maple prints what I'm computing on the left hand side of the equation and actually computes the answers for the right hand side. For example: 

 

> Int(sin(x),x=0..Pi) = int(sin(x),x=0..Pi);
 

Int(sin(x), x = 0 .. Pi) = 2 (11)
 

 

Example: Consider the sphere centered at the origin with radius 5. In rectangular coordinates it is described by VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))) = `^`(5, 2), but in spherical coordinates we have the much simpler equation "rho = 5" (rho is equal to 5). Using these coordinates, we see that:x = VectorCalculus:-`*`(VectorCalculus:-`*`(5, cos(theta)), sin(`ϕ`)), y = VectorCalculus:-`*`(VectorCalculus:-`*`(5, sin(theta)), sin(`ϕ`)), and z = VectorCalculus:-`*`(5, cos(`ϕ`))  where   `and`(`<=`(0, theta), `<=`(theta, VectorCalculus:-`*`(2, Pi)))   and   `and`(`<=`(0, `ϕ`), `<=`(`ϕ`, Pi)). Let's plot our sphere using a 3D parametric plot. 

 

> plot3d([5*cos(theta)*sin(phi),5*sin(theta)*sin(phi),5*cos(phi)],theta=0..2*Pi,phi=0..Pi,axes=boxed);
 

Plot_2d
 

 

This looks a lot nicer than what we would get with "implicitplot3d" or plotting the upper and lower halves together using plot3d... 

 

> implicitplot3d(x^2+y^2+z^2=5^2,x=-5..5,y=-5..5,z=-5..5,axes=boxed);

display({ plot3d( sqrt(5^2-x^2-y^2),x=-5..5,y=-sqrt(5^2-x^2)..sqrt(5^2-x^2)),
         plot3d(-sqrt(5^2-x^2-y^2),x=-5..5,y=-sqrt(5^2-x^2)..sqrt(5^2-x^2)) }, axes=boxed, orientation=[-55,65,15]);
 

 

Plot_2d
Plot_2d
 

 

Now let's compute the volume of the sphere first using rectangular coordinates (whose bounds come from the pair of plot3d plots) and then spherical coordinates (whose bounds come from the parametric plot). 

 

> int(int(int(1,z=-sqrt(5^2-x^2-y^2)..sqrt(5^2-x^2-y^2)),y=-sqrt(5^2-x^2)..sqrt(5^2-x^2)),x=-5..5);
 

`+`(`*`(`/`(500, 3), `*`(Pi))) (12)
 

> int(int(int(1*rho^2*sin(phi),rho=0..5),phi=0..Pi),theta=0..2*Pi);
 

`+`(`*`(`/`(500, 3), `*`(Pi))) (13)
 

 

Example: Let E  be the region in `*`(`^`(real, 3)) bounded by z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) and z = 2. 

 

First, let's make a plot of E  (Well, actually, we'll plot the outer surface of the solid region E). 

 

Notice that these two surfaces intersect when VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))) = `^`(2, 2). So we should plot over the disk of radius 2 centered at the origin in the xy-plane. The bottom of this region is given by y = VectorCalculus:-`-`(sqrt(VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(x, 2)))))) and the top by y = sqrt(VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(x, 2))))). These semicircular arcs range from x = -2 to x = 2. So the bounds for x and y in our plot3d commands should be "y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2". The top of the region is given by the horizontal plane "z = 2" and the bottom is given by the cone "z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))))". 

 

> top := plot3d(2,y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2):
 

> bottom := plot3d(sqrt(x^2+y^2),y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2):
 

> display({top,bottom});
 

Plot_2d
 

 

Alternatively, we could plot these surfaces parametrically. The most natural coordinates to use are "cylindrical coordinates". In this case z = 2 is still z = 2, but  z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) becomes z = r.  We have x and y ranging over the interior of the disk centered at the origin of radius 2. In cylindrical coordinates, `<=`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), 4)translates to `and`(`<=`(0, r), `<=`(r, 2)) and `and`(`<=`(0, theta), `<=`(theta, VectorCalculus:-`*`(2, Pi))). Thus the top surface z = 2 translates to x = VectorCalculus:-`*`(r, cos(theta)), y = VectorCalculus:-`*`(r, sin(theta)), z = 2. The bottom surface (the cone) z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) translates to x = VectorCalculus:-`*`(r, cos(theta)), y = VectorCalculus:-`*`(r, sin(theta)), z = r. 

 

> top := plot3d([r*cos(theta),r*sin(theta),2],r=0..2,theta=0..2*Pi):
bottom := plot3d([r*cos(theta),r*sin(theta),r],r=0..2,theta=0..2*Pi):
display({top,bottom});
 

Plot_2d
 

 

Notice that translating to cylindrical coordinates yields a nicer looking plot (because we're using the "proper" coordinate system). 

 

 

Next, let's compute the triple integral . We need to write it as an iterated integral. 

 

 

First, we will compute this integral using rectangular coordinates (and do it in all 6 orders of integration). Of course, you we should get the SAME answer each time so this is kind of a silly thing to do. [WARNING: Maple kind of "chokes" on some of these integrals. We have to add an "evalf" command to get a "real" answer.] 

 

For the first two integrals, we focus on the top and bottom surfaces. The lower surface is  z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) and upper surface is z = 2. So these provide our z bounds for the first two integrals. The x and y bounds are the same as those in the plot3d commands. 

 

The next two integrals require x bounds first. So we need to find the back and front of the region. Solving  z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) for x we get x = `&+-`(sqrt(VectorCalculus:-`+`(`*`(`^`(z, 2)), VectorCalculus:-`-`(`*`(`^`(y, 2)))))). To get the y and z bounds we need to consider what the region "squished" onto the yz-plane would look like. Looking the plots, we can see this is just the slice of the region when cut through by the yz-plane. Setting we get z = sqrt(`*`(`^`(y, 2))) which is z = abs(y). Intersecting this with z = 2 we get y-limits of y = `&+-`(2). So if z comes first, our bounds are z = abs(y) .. 2 and y = -2 .. 2. If y comes first we need to integrate from the left branch of the absolute value function to the right branch. This gives us the bounds y = VectorCalculus:-`-`(z) .. z and z = 0 .. 2. 

 

The last two integrals are just like the middle two integrals (we just need to interchange x's and y's). 

 

> plot({abs(y),2},y=-2..2,labels=[y,z],color=[red,red],title="The projection of E onto the yz-plane");
 

Plot_2d
 

> f := (x,y,z) -> x^2+y*z:
'f(x,y,z)' = f(x,y,z);
 

f(x, y, z) = `+`(`*`(`^`(x, 2)), `*`(y, `*`(z))) (14)
 

> Int(Int(Int(f(x,y,z),z=sqrt(x^2+y^2)..2),y=-sqrt(4-x^2)..sqrt(4-x^2)),x=-2..2) =
evalf(int(int(int(f(x,y,z),z=sqrt(x^2+y^2)..2),y=-sqrt(4-x^2)..sqrt(4-x^2)),x=-2..2));
 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), z = `*`(`^`(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `/`(1, 2))) .. 2), y = `+`(`-`(`*`(`^`(`+`(4, `-`(`*`(`^`(x, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(4, `-... (15)
 

> Int(Int(Int(f(x,y,z),z=sqrt(x^2+y^2)..2),x=-sqrt(4-y^2)..sqrt(4-y^2)),y=-2..2) =
evalf(int(int(int(f(x,y,z),z=sqrt(x^2+y^2)..2),x=-sqrt(4-y^2)..sqrt(4-y^2)),y=-2..2));
 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), z = `*`(`^`(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `/`(1, 2))) .. 2), x = `+`(`-`(`*`(`^`(`+`(4, `-`(`*`(`^`(y, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(4, `-... (16)
 

> Int(Int(Int(f(x,y,z),x=-sqrt(z^2-y^2)..sqrt(z^2-y^2)),y=-z..z),z=0..2) =
int(int(int(f(x,y,z),x=-sqrt(z^2-y^2)..sqrt(z^2-y^2)),y=-z..z),z=0..2);
 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), x = `+`(`-`(`*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(y, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(y, 2)))), `/`(1, 2)))), y = `+`(... (17)
 

> Int(Int(Int(f(x,y,z),x=-sqrt(z^2-y^2)..sqrt(z^2-y^2)),z=abs(y)..2),y=-2..2) =
evalf(int(int(int(f(x,y,z),x=-sqrt(z^2-y^2)..sqrt(z^2-y^2)),z=abs(y)..2),y=-2..2));
 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), x = `+`(`-`(`*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(y, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(y, 2)))), `/`(1, 2)))), z = abs(... (18)
 

> Int(Int(Int(f(x,y,z),y=-sqrt(z^2-x^2)..sqrt(z^2-x^2)),x=-z..z),z=0..2) =
int(int(int(f(x,y,z),y=-sqrt(z^2-x^2)..sqrt(z^2-x^2)),x=-z..z),z=0..2);
 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), y = `+`(`-`(`*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(x, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(x, 2)))), `/`(1, 2)))), x = `+`(... (19)
 

> Int(Int(Int(f(x,y,z),y=-sqrt(z^2-x^2)..sqrt(z^2-x^2)),z=abs(x)..2),x=-2..2) =
evalf(int(int(int(f(x,y,z),y=-sqrt(z^2-x^2)..sqrt(z^2-x^2)),z=abs(x)..2),x=-2..2));
 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), y = `+`(`-`(`*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(x, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(`*`(`^`(x, 2)))), `/`(1, 2)))), z = abs(... (20)
 

 

So  

 

Of course this is kind of a silly way to compute this triple integral. Cylindrical coordinates should make this much easier to compute. Let's convert the integral to cylindrical coordinates and compute the answer. First, let's translate our function... 

 

> "f in cylindrical coordinates" = f(r*cos(theta),r*sin(theta),z);
 

f in cylindrical coordinates (21)
 

 

Next, the lower bound for z is `and`(z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))), sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) = r) and the upper bound is z = 2. Then in the xy-plane our bounds are the same as when we plotted the region using parameterized surfaces: `and`(`<=`(0, r), `<=`(r, 2)) and `and`(`<=`(0, theta), `<=`(theta, VectorCalculus:-`*`(2, Pi))). [Don't forget the Jacobian "r"!!] 

 

> Int(Int(Int(f(r*cos(theta),r*sin(theta),z)*r,z=r..2),r=0..2),theta=0..2*Pi)=
int(int(int(f(r*cos(theta),r*sin(theta),z)*r,z=r..2),r=0..2),theta=0..2*Pi);
 

Int(Int(Int(`*`(`+`(`*`(`^`(r, 2), `*`(`^`(cos(theta), 2))), `*`(r, `*`(sin(theta), `*`(z)))), `*`(r)), z = r .. 2), r = 0 .. 2), theta = 0 .. `+`(`*`(2, `*`(Pi)))) = `+`(`*`(`/`(8, 5), `*`(Pi))) (22)
 

 

Next, let's convert the integral to spherical coordinates and compute the answer (yet again). It's easy to see that we're are integrating "all the way around" so that "theta = 0 .. VectorCalculus:-`*`(2, Pi)" (just like cylindrical coordinates). Also, `ϕ` ranges from 0 to the side of the cone. Converting the cone z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) 

to spherical coordinates, we get VectorCalculus:-`*`(rho, cos(`ϕ`)) = VectorCalculus:-`*`(rho, sin(`ϕ`)). So we must have tan(`ϕ`) = 1 which tells us that `ϕ`'s upper bound is `^`(45, omicron) = VectorCalculus:-`*`(Pi, `/`(1, 4)). Finally, notice that rho should range from 0 until we hit the plane z = 2. Converting this to spherical coordinates, we get`and`(2 = z, z = VectorCalculus:-`*`(rho, cos(`ϕ`))). So the upper bound for rho is VectorCalculus:-`*`(2, sec(`ϕ`)). [Don't forget the Jacobian "VectorCalculus:-`*`(`*`(`^`(rho, 2)), sin(phi))"!!] 

 

> "f in spherical coordinates" = f(rho*cos(theta)*sin(phi),rho*sin(theta)*sin(phi),rho*cos(phi));
 

f in spherical coordinates (23)
 

> Int(Int(Int(f(rho*cos(theta)*sin(phi),rho*sin(theta)*sin(phi),rho*cos(phi))*rho^2*sin(phi),rho=0..2*sec(phi)),theta=0..2*Pi),phi=0..Pi/4)=
int(int(int(f(rho*cos(theta)*sin(phi),rho*sin(theta)*sin(phi),rho*cos(phi))*rho^2*sin(phi),rho=0..2*sec(phi)),theta=0..2*Pi),phi=0..Pi/4);
 

Int(Int(Int(`*`(`+`(`*`(`^`(rho, 2), `*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 2)))), `*`(`^`(rho, 2), `*`(sin(theta), `*`(sin(phi), `*`(cos(phi)))))), `*`(`^`(rho, 2), `*`(sin(phi)))), rho = 0 .. `+`... (24)
 

 

Example: Let's plot the region of integration of the integral: and then use that to rewrite the integral in the other 5 orders of intergration. The bounds on the integrals tell us that we are integrating over the solid region bounded by  z = 0,  z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)),   y = sqrt(x),  and  x = 0. [It turns out that the other bounds (the upper bounds on the outer two integrals): y = 1 and x = 1are extraneous. If we plot them along with the bounds listed above, they will just make it harder to "see" what's going on.]  Let's simultaneously plot all of the relevant surfaces and then make the proper restrictions to get a plot of our "mystery" solid.  

 

First, we'll create plots for the surfaces z = 0 and z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)) using a standard plot3d command (since these are graphs of functions of x and y). We'll restrict our inputs as follows: `<=`(0, x), `<=`(y, 1) (this seems like a reasonable first guess given the bounds for x and y in the integral above). Notice that graphs of functions of x and y should give us a "top" and "bottom". 

 

> bottom := plot3d(0,x=0..1,y=0..1,color=blue):

top := plot3d(1-y,x=0..1,y=0..1,color=green):
 

 

Next, if we wish to find a "front" and a "back" we need surfaces be of the form: x = g(y, z)(if we wanted to plot "left and right sides", we should have surfaces of the form: y = h(x, z)). Let's plot x = 0(the back) and x = `*`(`^`(y, 2)) (the front -- we got this by solving y = sqrt(x) for x). Again we'll restrict our inputs y and z to the square: `<=`(0, y), `<=`(z, 1) because it seems like a reasonable place to start. 

 

Now this time we can't just use a standard plot3d command (it handles z = f(x, y) type graphs). Instead these new plots must be done "parametrically". We let x = g(y, z), y = y, and z = z. So first, x = 0, y = y, z = z and then x = `*`(`^`(y, 2)), y = y, z = z. 

 

> back := plot3d([0,y,z],y=0..1,z=0..1,color=red):

front := plot3d([y^2,y,z],y=0..1,z=0..1,color=yellow):
 

> display({bottom,top,back,front},axes=normal,labels=[x,y,z],viewpoint=circleleft);
 

Plot_2d
 

 

From this we can see how to "cut off" irrelevant parts of our surfaces. 

 

> bottom := plot3d(0,x=0..1,y=sqrt(x)..1,color=blue):
top := plot3d(1-y,x=0..1,y=sqrt(x)..1,color=green):
back := plot3d([0,y,z],y=0..1,z=0..1-y,color=red):
front := plot3d([y^2,y,z],y=0..1,z=0..1-y,color=yellow):

display({bottom,top,back,front},axes=normal,labels=[x,y,z],viewpoint=circleleft);
 

Plot_2d
 

 

Using this graph, we can better "see" how to write down the remaining 5 iterated integrals. For the rest of the example, let's assume the function is f(x, y, z) = VectorCalculus:-`+`(`*`(`^`(x, 2)), VectorCalculus:-`*`(y, z)) and then compute all 6 iterated integrals. [If our answers are right, we should get the same result each time.] 

 

First, "squash out" the z-direction and see what region in the xy-plane we are dealing with (go back to out "cut-down" plot and look at it from "above"). 

 

> display({bottom,top,back,front},axes=normal,labels=[x,y,z],orientation=[270,0,0]);
 

Plot_2d
 

 

So the y bounds are `and`(`<=`(sqrt(x), y), `<=`(y, 1)) and then `and`(`<=`(0, x), `<=`(x, 1)).  Or in the other order, the x bounds are `and`(`<=`(0, x), `<=`(x, `*`(`^`(y, 2)))) and `and`(`<=`(0, y), `<=`(y, 1)). 

 

> Int(Int(Int(x^2+y*z,z=0..1-y),y=sqrt(x)..1),x=0..1) = int(int(int(x^2+y*z,z=0..1-y),y=sqrt(x)..1),x=0..1);

Int(Int(Int(x^2+y*z,z=0..1-y),x=0..y^2),y=0..1) = int(int(int(x^2+y*z,z=0..1-y),x=0..y^2),y=0..1);

 

 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), z = 0 .. `+`(1, `-`(y))), y = `*`(`^`(x, `/`(1, 2))) .. 1), x = 0 .. 1) = `/`(1, 70)
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), z = 0 .. `+`(1, `-`(y))), x = 0 .. `*`(`^`(y, 2))), y = 0 .. 1) = `/`(1, 70) (25)
 

 

In the next two integrals we will place dx first, so let's see what region of theyz-plane we are dealing with when the x's are "squashed out". 

 

> display({bottom,top,back,front},axes=normal,labels=[x,y,z],orientation=[-90,0,90]);
 

Plot_2d
 

 

So after integrating from x = 0 to x = `*`(`^`(y, 2)) (eliminating x) we need to let z range from 0 to VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)) and then y to range from 0 to 1. Interchanging y and z yields similar bounds. 

 

> Int(Int(Int(x^2+y*z,x=0..y^2),z=0..1-y),y=0..1) = int(int(int(x^2+y*z,x=0..y^2),z=0..1-y),y=0..1);

Int(Int(Int(x^2+y*z,x=0..y^2),z=0..1-y),y=0..1) = int(int(int(x^2+y*z,x=0..y^2),y=0..1-z),z=0..1);
 

 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), x = 0 .. `*`(`^`(y, 2))), z = 0 .. `+`(1, `-`(y))), y = 0 .. 1) = `/`(1, 70)
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), x = 0 .. `*`(`^`(y, 2))), z = 0 .. `+`(1, `-`(y))), y = 0 .. 1) = `/`(1, 70) (26)
 

 

In the final two integrals we will place dy first, so let's see what region of thexz-plane we are dealing with when the y's are "squashed out". 

 

> display({bottom,top,back,front},axes=normal,labels=[x,y,z],orientation=[180,90,-90]);
 

Plot_2d
 

 

y ranges from the yellow surface to green surface (y = sqrt(x) to y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(z))). In the xz-plane, x and z range from 0 to the curve determined by where the yellow and green surfaces intersect z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)) and x = `*`(`^`(y, 2)). So y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(z)) and thus `and`(x = `*`(`^`(y, 2)), `*`(`^`(y, 2)) = `*`(`^`(VectorCalculus:-`+`(1, VectorCalculus:-`-`(z)), 2))) and sqrt(x) = VectorCalculus:-`+`(1, VectorCalculus:-`-`(z)). 

 

> Int(Int(Int(x^2+y*z,y=sqrt(x)..1-z),z=0..1-sqrt(x)),x=0..1) = int(int(int(x^2+y*z,y=sqrt(x)..1-z),z=0..1-sqrt(x)),x=0..1);

Int(Int(Int(x^2+y*z,y=sqrt(x)..1-z),x=0..(1-z)^2),z=0..1) = int(int(int(x^2+y*z,y=sqrt(x)..1-z),x=0..(1-z)^2),z=0..1);
 

 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), y = `*`(`^`(x, `/`(1, 2))) .. `+`(1, `-`(z))), z = 0 .. `+`(1, `-`(`*`(`^`(x, `/`(1, 2)))))), x = 0 .. 1) = `/`(1, 70)
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(z))), y = `*`(`^`(x, `/`(1, 2))) .. `+`(1, `-`(z))), x = 0 .. `*`(`^`(`+`(1, `-`(z)), 2))), z = 0 .. 1) = `/`(1, 70) (27)
 

 

Example: Consider the solid region E bounded by y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)), z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(`*`(`^`(x, 2)))), y = 0, x = 0, and z = 0and let  f(x, y, z) = VectorCalculus:-`+`(VectorCalculus:-`+`(x, `*`(`^`(y, 2))), `*`(`^`(z, 3))).    

 

> f := (x,y,z) -> x+y^2+z^3:
'f(x,y,z)' = f(x,y,z);
 

f(x, y, z) = `+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))) (28)
 

 

First, we will plot the 5 surfaces (in the same plot window) which define the bounded region E. The top and bottom z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(`*`(`^`(x, 2)))) and z = 0 can be plotted using the standard plot3d command. The other surfaces have to be treated as parametric surfaces. For example, y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)) is handled using the parametrization x = x, y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)), and z = z. In so in the plot3d command we have "[x,1-x,z]". 

 

> top := plot3d(1-x^2,x=0..1,y=0..1,color=blue):
bottom := plot3d(0,x=0..1,y=0..1,color=green):
front := plot3d([x,1-x,z],x=0..1,z=0..1,color=red):
back := plot3d([0,y,z],y=0..1,z=0..1,color=yellow):
side := plot3d([x,0,z],x=0..1,z=0..1,color=grey):

display({top,bottom,front,back,side}, viewpoint=circleleft);
 

Plot_2d
 

 

Now we get rid of the unnecessary parts of the boundary surfaces. We can find these bounds by intersecting pairs of surfaces. For example, the blue surface is cut by the red surface. So y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)) provides us with a bound for the blue surface.   

 

> top := plot3d(1-x^2,x=0..1,y=0..1-x,color=blue):
bottom := plot3d(0,x=0..1,y=0..1-x,color=green):
front := plot3d([x,1-x,z],x=0..1,z=0..1-x^2,color=red):
back := plot3d([0,y,z],y=0..1,z=0..1,color=yellow):
side := plot3d([x,0,z],x=0..1,z=0..1-x^2,color=grey):

display({top,bottom,front,back,side},viewpoint=circleleft);
 

Plot_2d
 

 

Let's compute the integral  in all 6 orders of integration. We'll start with the integrals with dz coming first. 

 

The z bounds are z = 0 and z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(`*`(`^`(x, 2)))). Next, we'll look at the region of integration after "squishing out" the z direction. 

 

> display({bottom,top,back,front,side},axes=normal,labels=[x,y,z],orientation=[270,0,0]);
 

Plot_2d
 

 

So x and y are bounded by 0 below and y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)) above. 

 

> Int(Int(Int(f(x,y,z),z=0..1-x^2),x=0..1-y),y=0..1) = int(int(int(f(x,y,z),z=0..1-x^2),x=0..1-y),y=0..1);

Int(Int(Int(f(x,y,z),z=0..1-x^2),y=0..1-x),x=0..1) = int(int(int(f(x,y,z),z=0..1-x^2),y=0..1-x),x=0..1);
 

 

Int(Int(Int(`+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))), z = 0 .. `+`(1, `-`(`*`(`^`(x, 2))))), x = 0 .. `+`(1, `-`(y))), y = 0 .. 1) = `/`(683, 2520)
Int(Int(Int(`+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))), z = 0 .. `+`(1, `-`(`*`(`^`(x, 2))))), y = 0 .. `+`(1, `-`(x))), x = 0 .. 1) = `/`(683, 2520) (29)
 

 

In the final two integrals we will place dy first, so let's see what region of thexz-plane we are dealing with when the y's are "squashed out". 

 

> display({bottom,top,back,front,side},axes=normal,labels=[x,y,z],orientation=[180,90,-90]);
 

Plot_2d
 

 

The blue surface provides an upper bound for x and z that is z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(`*`(`^`(x, 2)))). 

 

> Int(Int(Int(f(x,y,z),y=0..1-x),x=0..sqrt(1-z)),z=0..1) = int(int(int(f(x,y,z),y=0..1-x),x=0..sqrt(1-z)),z=0..1);

Int(Int(Int(f(x,y,z),y=0..1-x),z=0..1-x^2),x=0..1) = int(int(int(f(x,y,z),y=0..1-x),z=0..1-x^2),x=0..1);
 

 

Int(Int(Int(`+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))), y = 0 .. `+`(1, `-`(x))), x = 0 .. `*`(`^`(`+`(1, `-`(z)), `/`(1, 2)))), z = 0 .. 1) = `/`(683, 2520)
Int(Int(Int(`+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))), y = 0 .. `+`(1, `-`(x))), z = 0 .. `+`(1, `-`(`*`(`^`(x, 2))))), x = 0 .. 1) = `/`(683, 2520) (30)
 

 

In the next two integrals we will place dx first, so let's see what region of theyz-plane we are dealing with when the x's are "squashed out". 

 

> display({bottom,top,back,front,side},axes=normal,labels=[x,y,z],orientation=[270,180,270]);
 

Plot_2d
 

 

Notice that even though y and z are ranging over the square `<=`(0, y), `<=`(z, 1), it is broken into 2 pieces. So we will need to break our integral into 2 parts. 

 

The yellow surface x = 0 provides a lower bound for both pieces. The upper bound is given by z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(`*`(`^`(x, 2)))) (blue) and y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x))  (red). To find bounds for y and z we need to intersect these 2 surfaces: x = VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)) and so `*`(`^`(x, 2)) = `*`(`^`(VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)), 2)) and thus z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(`*`(`^`(VectorCalculus:-`+`(1, VectorCalculus:-`-`(y)), 2)))) and also y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(sqrt(VectorCalculus:-`+`(1, VectorCalculus:-`-`(z))))). 

 

> Int(Int(Int(f(x,y,z),x=0..sqrt(1-z)),y=0..1-sqrt(1-z)),z=0..1)+Int(Int(Int(f(x,y,z),x=0..1-y),y=1-sqrt(1-z)..1),z=0..1) = int(int(int(f(x,y,z),x=0..sqrt(1-z)),y=0..1-sqrt(1-z)),z=0..1)+int(int(int(f(x,y,z),x=0..1-y),y=1-sqrt(1-z)..1),z=0..1);

Int(Int(Int(f(x,y,z),x=0..sqrt(1-z)),z=1-(1-y)^2..1),y=0..1)+Int(Int(Int(f(x,y,z),x=0..1-y),z=0..1-(1-y)^2),y=0..1) = int(int(int(f(x,y,z),x=0..sqrt(1-z)),z=1-(1-y)^2..1),y=0..1)+int(int(int(f(x,y,z),x=0..1-y),z=0..1-(1-y)^2),y=0..1);
 

 

`+`(Int(Int(Int(`+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))), x = 0 .. `*`(`^`(`+`(1, `-`(z)), `/`(1, 2)))), y = 0 .. `+`(1, `-`(`*`(`^`(`+`(1, `-`(z)), `/`(1, 2)))))), z = 0 .. 1), Int(Int(Int(`+`(x, `*`(`...
`+`(Int(Int(Int(`+`(x, `*`(`^`(y, 2)), `*`(`^`(z, 3))), x = 0 .. `*`(`^`(`+`(1, `-`(z)), `/`(1, 2)))), z = `+`(1, `-`(`*`(`^`(`+`(1, `-`(y)), 2)))) .. 1), y = 0 .. 1), Int(Int(Int(`+`(x, `*`(`^`(y, 2)... (31)
 

 

Example:  Let f(x, y, z) = VectorCalculus:-`+`(`*`(`^`(x, 2)), VectorCalculus:-`*`(y, z)) and consider the region T which is bounded by and z = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)). 

 

> f := (x,y,z) -> x^2+y*z:
'f(x,y,z)' = f(x,y,z);
 

f(x, y, z) = `+`(`*`(`^`(x, 2)), `*`(y, `*`(z))) (32)
 

 

To plot the region of integral I will plot the surfaces which make up the sides of region. This consists of the xy, xz, and yz-planes and two planes which form a "roof" for T.  

 

Note: Be careful: regular "plot3d(function, ranges);" doesn't really pay attention to the parameter names you use like "x=...." and "y=...."  It will use the first range as a range of "x's" and the second range as a range of "y's". So, for example, "plot3d(1, y=0..2, x=0..1);  is not the same as plot3d(1, x=0..1, y=0..2); The second command has x and y in the "correct" order. 

 

A few notes on where the bounds for various variables come from... 

 

The gray side's boundary is determined by line of intersection of the green and blue planes projected onto the xz-plane. The blue plane's equation is y=2-2z and the green's is z=1-x. So in the xz-plane they cross at z=1-x. Thus the bounds for the gray side should change to "z=0..1-x" 

 

The green and blue plane cross where y=2-2z and z=1-x both hold. To find green bounds we need to project this intersection into the xy-plane (the green plane's bounds are given in terms of x and y). Thus subbing z=1-x into y=2-2z, we get y=2-2(1-x) so that y=2x. So the bounds for y (for the green plane) should start at y=0 and go up to y=2x. 

 

The blue plane is drawn using the parameters x and z. So we should eliminate y from the equations z=1-x and y=2-2z. But this is already done in the first equation: z=1-x. So z should range from 0 to 1-x. [This is the same as the gray plane.] 

 

> xyPlot := plot3d(0,x=0..1,y=0..2,color=pink):
yzPlot := plot3d([0,y,z],y=0..2-2*z,z=0..1,color=red):
xzPlot := plot3d([x,0,z],x=0..1,z=0..1-x,color=gray):
top1Plot := plot3d([x,2-2*z,z],x=0..1,z=0..1-x,color=blue):
top2Plot := plot3d(1-x,x=0..1,y=0..2*x,color=green):
display({xyPlot,yzPlot,xzPlot,top1Plot,top2Plot},scaling=constrained,axes=boxed,viewpoint=circleleft);
 

Plot_2d
 

 

Next, let's compute this integral using all 6 orders of integration. We can use the bounds found while fixing the graph above to help with the integrals below. Notice that the orders "dz dy dx" and "dz dx dy" require us to split the integral into 2 pieces (1 with a "blue roof" and 1 with a "green roof"). The first two integrals go from bottom (z=0) to top. However, the top has two pieces. The green piece: z=1-x and the blue piece: z=1-y/2. After z is integrated out, the piece of the xy-plane the solid sits over must be divided into two pieces (two triangles). These 

triangles are separated by the line y=2x (the intersection of the planes projected down). 

 

> int(int(int(f(x,y,z),z=0..1-x), y=0..2*x), x=0..1) + int(int(int(f(x,y,z),z=0..1-y/2), y=2*x..2), x=0..1);
 

`/`(7, 30) (33)
 

> int(int(int(f(x,y,z),z=0..1-x), x=y/2..1), y=0..2) + int(int(int(f(x,y,z),z=0..1-y/2), x=0..y/2), y=0..2);
 

`/`(7, 30) (34)
 

> int(int(int(f(x,y,z),y=0..2-2*z), z=0..1-x), x=0..1);
 

`/`(7, 30) (35)
 

> int(int(int(f(x,y,z),y=0..2-2*z), x=0..1-z), z=0..1);
 

`/`(7, 30) (36)
 

> int(int(int(f(x,y,z),x=0..1-z), z=0..1-y/2), y=0..2);
 

`/`(7, 30) (37)
 

> int(int(int(f(x,y,z),x=0..1-z), y=0..2-2*z), z=0..1);
 

`/`(7, 30) (38)
 

 

Example: Let's plot the surfaces which bound the region of integration E where E is bounded by z = 0 and z = VectorCalculus:-`+`(VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(x, 2)))), VectorCalculus:-`-`(`*`(`^`(y, 2)))) and `>=`(y, 0).  

 

By intersecting z = 0 and z = VectorCalculus:-`+`(VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(x, 2)))), VectorCalculus:-`-`(`*`(`^`(y, 2)))) we get VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))) = 4. So the paraboloid should be plotted over a region inside the circle of radius 2. Noting that `>=`(y, 0), we have the bounds `and`(`<=`(0, y), `<=`(y, sqrt(VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(x, 2))))))) and then `and`(`<=`(-2, x), `<=`(x, 2)). 

 

> top := plot3d(4-x^2-y^2,x=-2..2,y=0..sqrt(4-x^2),color=red):
bottom := plot3d(0,x=-2..2,y=0..sqrt(4-x^2),color=green):
side := plot3d([x,0,z],x=-2..2,z=0..4-x^2,color=blue):
display({bottom,top,side},scaling=constrained,axes=boxed,viewpoint=circleleft);
 

Plot_2d
 

 

Let's compute the integral by using the 6 different orders of integration. 

 

> Int(Int(Int(x^2+y^2, z=0..4-x^2-y^2), y=0..sqrt(4-x^2)), x=-2..2) = int(int(int(x^2+y^2, z=0..4-x^2-y^2), y=0..sqrt(4-x^2)), x=-2..2);
 

> Int(Int(Int(x^2+y^2, z=0..4-x^2-y^2), x=-sqrt(4-y^2)..sqrt(4-y^2)), y=0..2) = int(int(int(x^2+y^2, z=0..4-x^2-y^2), x=-sqrt(4-y^2)..sqrt(4-y^2)), y=0..2);
 

> Int(Int(Int(x^2+y^2, y=0..sqrt(4-x^2-z)), z=0..4-x^2), x=-2..2) = int(int(int(x^2+y^2, y=0..sqrt(4-x^2-z)), z=0..4-x^2), x=-2..2);
 

> Int(Int(Int(x^2+y^2, y=0..sqrt(4-x^2-z)), x=-sqrt(4-z)..sqrt(4-z)), z=0..4) = int(int(int(x^2+y^2, y=0..sqrt(4-x^2-z)), x=-sqrt(4-z)..sqrt(4-z)), z=0..4);
 

> Int(Int(Int(x^2+y^2, x=-sqrt(4-y^2-z)..sqrt(4-y^2-z)), z=0..4-y^2), y=0..2) = int(int(int(x^2+y^2, x=-sqrt(4-y^2-z)..sqrt(4-y^2-z)), z=0..4-y^2), y=0..2);
 

> Int(Int(Int(x^2+y^2, x=-sqrt(4-y^2-z)..sqrt(4-y^2-z)), y=0..sqrt(4-z)), z=0..4) = int(int(int(x^2+y^2, x=-sqrt(4-y^2-z)..sqrt(4-y^2-z)), y=0..sqrt(4-z)), z=0..4);
 

 

 

 

 

 

Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), z = 0 .. `+`(4, `-`(`*`(`^`(x, 2))), `-`(`*`(`^`(y, 2))))), y = 0 .. `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2)))), `/`(1, 2)))), x = -2 .. 2) = `+`(`*`(`/`(16, ...
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), z = 0 .. `+`(4, `-`(`*`(`^`(x, 2))), `-`(`*`(`^`(y, 2))))), x = `+`(`-`(`*`(`^`(`+`(4, `-`(`*`(`^`(y, 2)))), `/`(1, 2))))) .. `*`(`^`(`+`(4, `-`(`*`(`^...
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), y = 0 .. `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2))), `-`(z)), `/`(1, 2)))), z = 0 .. `+`(4, `-`(`*`(`^`(x, 2))))), x = -2 .. 2) = `+`(`*`(`/`(16, 3), `*`(Pi)))
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), y = 0 .. `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2))), `-`(z)), `/`(1, 2)))), x = `+`(`-`(`*`(`^`(`+`(4, `-`(z)), `/`(1, 2))))) .. `*`(`^`(`+`(4, `-`(z)), `/`(1,...
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), x = `+`(`-`(`*`(`^`(`+`(4, `-`(`*`(`^`(y, 2))), `-`(z)), `/`(1, 2))))) .. `*`(`^`(`+`(4, `-`(`*`(`^`(y, 2))), `-`(z)), `/`(1, 2)))), z = 0 .. `+`(4, `-...
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), x = `+`(`-`(`*`(`^`(`+`(4, `-`(`*`(`^`(y, 2))), `-`(z)), `/`(1, 2))))) .. `*`(`^`(`+`(4, `-`(`*`(`^`(y, 2))), `-`(z)), `/`(1, 2)))), y = 0 .. `*`(`^`(`... (39)
 

 

This problem is more naturally set in terms of cylindrical coordinates. In cylindrical coordinates, we have z = VectorCalculus:-`+`(4, VectorCalculus:-`-`(`*`(`^`(r, 2)))), `and`(`<=`(0, r), `<=`(r, 2)), and `and`(`<=`(0, theta), `<=`(theta, Pi)). Also, our function simplifies to VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))) = `*`(`^`(r, 2)) (and don't forget the Jacobian "r"). Let's plot the region again using parametric descriptions coming from cylindrical coordinates and then recompute the integral. Notice that by choosing the "correct" coordinate system, our plot looks a bit nicer and Maple doesn't have to work as hard computing the integral. 

 

> top := plot3d([r*cos(theta),r*sin(theta),4-r^2],r=0..2,theta=0..Pi,color=red):
bottom := plot3d([r*cos(theta),r*sin(theta),0],r=0..2,theta=0..Pi,color=green):
side := plot3d([r*cos(theta),0,4-r^2],r=0..2,theta=0..Pi,color=blue):
display({bottom,top,side},scaling=constrained,axes=boxed,viewpoint=circleleft);

Int(Int(Int(r^2*r,z=0..4-r^2),r=0..2),theta=0..Pi) = int(int(int(r^2*r,z=0..4-r^2),r=0..2),theta=0..Pi);
 

 

Plot_2d
Int(Int(Int(`*`(`^`(r, 3)), z = 0 .. `+`(4, `-`(`*`(`^`(r, 2))))), r = 0 .. 2), theta = 0 .. Pi) = `+`(`*`(`/`(16, 3), `*`(Pi))) (40)
 

 

Example: Let f(x, y, z) = VectorCalculus:-`+`(`*`(`^`(x, 2)), VectorCalculus:-`*`(y, exp(z))) and consider the region E which is bounded by and z = `*`(`^`(x, 2)). 

 

> f := (x,y,z) -> x^2+y*exp(z):
'f(x,y,z)' = f(x,y,z);
 

f(x, y, z) = `+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))) (41)
 

 

To plot the region of integral we will plot the surfaces which make up the sides of region. This consists of the xy and xz-planes as well asx = 1and two more surfaces which form the "roof" of E. As before, intersecting surfaces helps us find bounds. 

 

> solve({z=x^2,y=0});
solve({z=x^2,y=3-3*z});
 

 

{x = x, y = 0, z = `*`(`^`(x, 2))}
{x = x, y = `+`(3, `-`(`*`(3, `*`(`^`(x, 2))))), z = `*`(`^`(x, 2))} (42)
 

> xyPlot := plot3d(0,x=0..1,y=0..3,color=pink):
yzPlot := plot3d([1,y,z],y=0..3-3*z,z=0..1,color=red):
xzPlot := plot3d([x,0,z],x=0..1,z=0..x^2,color=gray):
top1Plot := plot3d([x,3-3*z,z],x=0..1,z=0..x^2,color=blue):
top2Plot := plot3d(x^2,x=0..1,y=0..3-3*x^2,color=green):
display({xyPlot,yzPlot,xzPlot,top1Plot,top2Plot},scaling=constrained,axes=boxed,viewpoint=circleleft);
 

Plot_2d
 

 

Now let's compute this integral using all 6 orders of integration.  

 

Note: For the orders of integration "dz dy dx" and "dz dx dy", the we will need to split the integral into 2 pieces (1 with a "blue roof" and 1 with a "green roof"). 

 

> Int(Int(Int(f(x,y,z),z=0..1-1/3*y), y=3-3*x^2..3), x=0..1) + Int(Int(Int(f(x,y,z),z=0..x^2), y=0..3-3*x^2), x=0..1) = evalf(int(int(int(f(x,y,z),z=0..1-1/3*y), y=3-3*x^2..3), x=0..1) + int(int(int(f(x,y,z),z=0..x^2), y=0..3-3*x^2), x=0..1));

Int(Int(Int(f(x,y,z),z=0..1-1/3*y), x=sqrt(1-1/3*y)..1), y=0..3) + Int(Int(Int(f(x,y,z),z=0..x^2), x=0..sqrt(1-1/3*y)), y=0..3) = evalf(int(int(int(f(x,y,z),z=0..1-1/3*y), x=sqrt(1-1/3*y)..1), y=0..3) + int(int(int(f(x,y,z),z=0..x^2), x=0..sqrt(1-1/3*y)), y=0..3));

Int(Int(Int(f(x,y,z),y=0..3-3*z), z=0..x^2), x=0..1) = evalf(int(int(int(f(x,y,z),y=0..3-3*z), z=0..x^2), x=0..1));

Int(Int(Int(f(x,y,z),y=0..3-3*z), x=sqrt(z)..1), z=0..1) = evalf(int(int(int(f(x,y,z),y=0..3-3*z), x=sqrt(z)..1), z=0..1));

Int(Int(Int(f(x,y,z),x=sqrt(z)..1), z=0..1-1/3*y), y=0..3) = evalf(int(int(int(f(x,y,z),x=sqrt(z)..1), z=0..1-1/3*y), y=0..3));

Int(Int(Int(f(x,y,z),x=sqrt(z)..1), y=0..3-3*z), z=0..1) = evalf(int(int(int(f(x,y,z),x=sqrt(z)..1), y=0..3-3*z), z=0..1));
 

 

 

 

 

 

`+`(Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))), z = 0 .. `+`(`-`(`*`(`/`(1, 3), `*`(y))), 1)), y = `+`(3, `-`(`*`(3, `*`(`^`(x, 2))))) .. 3), x = 0 .. 1), Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`...
`+`(Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))), z = 0 .. `+`(`-`(`*`(`/`(1, 3), `*`(y))), 1)), x = `+`(`*`(`/`(1, 3), `*`(`^`(`+`(`-`(`*`(3, `*`(y))), 9), `/`(1, 2))))) .. 1), y = 0 .. 3), I...
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))), y = 0 .. `+`(3, `-`(`*`(3, `*`(z))))), z = 0 .. `*`(`^`(x, 2))), x = 0 .. 1) = 1.37309042
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))), y = 0 .. `+`(3, `-`(`*`(3, `*`(z))))), x = `*`(`^`(z, `/`(1, 2))) .. 1), z = 0 .. 1) = 1.37309042
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))), x = `*`(`^`(z, `/`(1, 2))) .. 1), z = 0 .. `+`(`-`(`*`(`/`(1, 3), `*`(y))), 1)), y = 0 .. 3) = 1.37309042
Int(Int(Int(`+`(`*`(`^`(x, 2)), `*`(y, `*`(exp(z)))), x = `*`(`^`(z, `/`(1, 2))) .. 1), y = 0 .. `+`(3, `-`(`*`(3, `*`(z))))), z = 0 .. 1) = 1.37309042 (43)
 

 

Example: Let f(x, y, z) = VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(`*`(`^`(x, 3)), `*`(`^`(y, 2))), z), exp(VectorCalculus:-`+`(VectorCalculus:-`+`(x, VectorCalculus:-`*`(2, y)), VectorCalculus:... and consider the region E which is above below z = 2, in front of x = 0, bounded on the left by x = y, and on the right by y = VectorCalculus:-`+`(2, VectorCalculus:-`-`(`*`(`^`(x, 2)))).  

 

> f := (x,y,z) -> x^3*y^2*z*exp(x+2*y+3*z):
'f(x,y,z)' = f(x,y,z);
 

f(x, y, z) = `*`(`^`(x, 3), `*`(`^`(y, 2), `*`(z, `*`(exp(`+`(x, `*`(2, `*`(y)), `*`(3, `*`(z)))))))) (44)
 

 

    To plot the region of integration I will plot the surfaces which make up the sides of region.  

 

> solve({y=x, y=2-x^2});
 

{x = -2, y = -2}, {x = 1, y = 1} (45)
 

> bottomPlot := plot3d(1,x=0..1,y=x..2-x^2,color=blue):
  topPlot := plot3d(2,x=0..1,y=x..2-x^2,color=red):
 backPlot := plot3d([0,y,z],y=0..2,z=1..2,color=gray):
 leftPlot := plot3d([x,x,z],x=0..1,z=1..2,color=green):
rightPlot := plot3d([x,2-x^2,z],x=0..1,z=1..2,color=yellow):
display({bottomPlot,topPlot,backPlot,leftPlot,rightPlot},scaling=constrained,axes=boxed,viewpoint=circleleft);
 

Plot_2d
 

 

Let's compute this integral in all 6 orders of integration.  

 

Note: dx dy dz and dx dz dy (thinking of E as an simple region) will need to be split into 2 pieces (1 with from "gray" to "green" and 1 from "gray" to "yellow"). 

 

> evalf(int(int(int(f(x,y,z),z=1..2), y=x..2-x^2), x=0..1));
 

920.198348 (46)
 

> evalf(int(int(int(f(x,y,z),z=1..2), x=0..y), y=0..1) + int(int(int(f(x,y,z),z=1..2), x=0..sqrt(2-y)), y=1..2));
 

920.198348 (47)
 

> evalf(int(int(int(f(x,y,z),y=x..2-x^2), z=1..2), x=0..1));
 

920.198348 (48)
 

> evalf(int(int(int(f(x,y,z),y=x..2-x^2), x=0..1), z=1..2));
 

920.198348 (49)
 

> evalf(int(int(int(f(x,y,z),x=0..y), z=1..2), y=0..1) + int(int(int(f(x,y,z),x=0..sqrt(2-y)), z=1..2), y=1..2));
 

920.198348 (50)
 

> evalf(int(int(int(f(x,y,z),x=0..y), y=0..1), z=1..2) + int(int(int(f(x,y,z),x=0..sqrt(2-y)), y=1..2), z=1..2));
 

920.198348 (51)
 

 

Example: Consider the solid region E bounded by the surfaces z = VectorCalculus:-`+`(VectorCalculus:-`*`(`*`(`^`(x, 2)), `/`(1, 4)), VectorCalculus:-`*`(`*`(`^`(y, 2)), `/`(1, 9)))and z = 1. Let's begin by graphing this region. Notice that the bottom of the region is an ellipsoid opening upward and the top is a horizontal plane. The intersection of these two surfaces is the ellipseVectorCalculus:-`+`(VectorCalculus:-`*`(`*`(`^`(x, 2)), `/`(1, 4)), VectorCalculus:-`*`(`*`(`^`(y, 2)), `/`(1, 9))) = 1. 

 

> solve(x^2/4+y^2/9=1,y);
 

`+`(`*`(`/`(3, 2), `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2)))), `/`(1, 2))))), `+`(`-`(`*`(`/`(3, 2), `*`(`^`(`+`(4, `-`(`*`(`^`(x, 2)))), `/`(1, 2)))))) (52)
 

> bottom := plot3d(x^2/4+y^2/9,x=-2..2,y=-3/2*sqrt(4-x^2)..3/2*sqrt(4-x^2)):
top := plot3d(1,x=-2..2,y=-3/2*sqrt(4-x^2)..3/2*sqrt(4-x^2)):

display({bottom,top},scaling=constrained,axes=boxed,orientation=[35,75,10]);
 

Plot_2d
 

 

Let's compute the centriod of this region.  

 

> m := int(int(int(1,z=x^2/4+y^2/9..1),y=-3*sqrt(1-x^2/4)..3*sqrt(1-x^2/4)),x=-2..2);

Myz := int(int(int(x,z=x^2/4+y^2/9..1),y=-3*sqrt(1-x^2/4)..3*sqrt(1-x^2/4)),x=-2..2);
Mxz := int(int(int(y,z=x^2/4+y^2/9..1),y=-3*sqrt(1-x^2/4)..3*sqrt(1-x^2/4)),x=-2..2);
Mxy := int(int(int(z,z=x^2/4+y^2/9..1),y=-3*sqrt(1-x^2/4)..3*sqrt(1-x^2/4)),x=-2..2);

Centroid := (Myz/m,Mxz/m,Mxy/m);
 

 

 

 

 

`+`(`*`(3, `*`(Pi)))
0
0
`+`(`*`(2, `*`(Pi)))
0, 0, `/`(2, 3) (53)
 

 

Example:  Consider the region of integration E where E is bounded above by VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))) = 25 and below by z = 4.  

 

> top := plot3d(sqrt(25-x^2-y^2), x=-3..3, y=-sqrt(9-x^2)..sqrt(9-x^2), color=red):
bottom := plot3d(4, x=-3..3, y=-sqrt(9-x^2)..sqrt(9-x^2), color=green):

sphereGhost := plot3d(5-0.05,theta=0..2*Pi,phi=0..Pi/2,coords=spherical,color=gray,style=line):
display({bottom,top,sphereGhost},scaling=constrained,axes=boxed,orientation=[45,45,0]);
 

Plot_2d
 

 

Let's compute .  First, we'll compute the integral in spherical coordinates (a natural choice). 

 

ρ ranges from the plane out to the sphere. The plane z = 4 becomes VectorCalculus:-`*`(rho, cos(`ϕ`)) = 4 or rho = VectorCalculus:-`*`(4, sec(`ϕ`)) in spherical coordinates. The sphere becomes rho = 5. Obviously θ ranges from 0 to 2π. Finally, φ ranges from 0 to the circle where the sphere and the plane intersect. So we have VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))) = 25 and z = 4. Thus VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), 16) = 25 and so VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))) = 9or r = 3. Recall that r = VectorCalculus:-`*`(rho, sin(`ϕ`)). On the sphere we have rho = 5 so we get 3 = VectorCalculus:-`*`(5, sin(`ϕ`)) and thus `ϕ` = arcsin(VectorCalculus:-`*`(3, `/`(1, 5))). 

 

> Int(Int(Int((rho^2)^(-1/2) * rho^2*sin(phi), rho=4*sec(phi)..5), phi=0..arcsin(3/5)), theta=0..2*Pi) = int(int(int((rho^2)^(-1/2) * rho^2*sin(phi), rho=4*sec(phi)..5), phi=0..arcsin(3/5)), theta=0..2*Pi);
 

Int(Int(Int(`/`(`*`(`^`(rho, 2), `*`(sin(phi))), `*`(`^`(`*`(`^`(rho, 2)), `/`(1, 2)))), rho = `+`(`*`(4, `*`(sec(phi)))) .. 5), phi = 0 .. arcsin(`/`(3, 5))), theta = 0 .. `+`(`*`(2, `*`(Pi)))) = Pi (54)
 

 

Now let's compute this integral using cylidrical coordinates. First, z ranges from the plane z = 4 to the (upper-half of the) sphere `and`(z = sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(25, VectorCalculus:-`-`(`*`(`^`(x, 2)))), VectorCalculus:-`-`(`*`(`^`(y, 2))))), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(25, VectorCalculus:.... In the last part we established that the circle where the sphere and plane intersect is r = 4.  

 

> Int(Int(Int((r^2+z^2)^(-1/2) * r, z=4..sqrt(25-r^2)), r=0..3), theta=0..2*Pi) = int(int(int((r^2+z^2)^(-1/2) * r, z=4..sqrt(25-r^2)), r=0..3), theta=0..2*Pi);
 

Int(Int(Int(`/`(`*`(r), `*`(`^`(`+`(`*`(`^`(r, 2)), `*`(`^`(z, 2))), `/`(1, 2)))), z = 4 .. `*`(`^`(`+`(25, `-`(`*`(`^`(r, 2)))), `/`(1, 2)))), r = 0 .. 3), theta = 0 .. `+`(`*`(2, `*`(Pi)))) = Pi (55)
 

 

By the way, if you attempt to make Maple compute this integral directly in rectangular coordinates, Maple will choke. If you would like to see Maple choke and die, just remove the "#" (comment symbol) and hit enter. When working in rectangular coordinates, MAPLE GIVES THE WRONG ANSWER!!! 

 

> Int(Int(Int((x^2+y^2+z^2)^(-1/2),z=4..sqrt(25-x^2-y^2)),y=-sqrt(9-x^2)..sqrt(9-x^2)),x=-3..3) = int(int(int((x^2+y^2+z^2)^(-1/2),z=4..sqrt(25-x^2-y^2)),y=-sqrt(9-x^2)..sqrt(9-x^2)),x=-3..3);
 

Int(Int(Int(`/`(1, `*`(`^`(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)), `*`(`^`(z, 2))), `/`(1, 2)))), z = 4 .. `*`(`^`(`+`(25, `-`(`*`(`^`(x, 2))), `-`(`*`(`^`(y, 2)))), `/`(1, 2)))), y = `+`(`-`(`*`(`^`(`+`(... (56)
 

 

While we've gone to all this trouble setting up bounds and such, let's compute the centroid of our region of integration. 

 

> vol := int(int(int(rho^2*sin(phi),rho=4*sec(phi)..5),phi=0..arccos(4/5)),theta=0..2*Pi); Myz := int(int(int(rho*cos(theta)*sin(phi)*rho^2*sin(phi),rho=4*sec(phi)..5),phi=0..arccos(4/5)),theta=0..2*Pi);
Mxz := int(int(int(rho*sin(theta)*sin(phi)*rho^2*sin(phi),rho=4*sec(phi)..5),phi=0..arccos(4/5)),theta=0..2*Pi);
Mxy := int(int(int(rho*cos(phi)*rho^2*sin(phi),rho=4*sec(phi)..5),phi=0..arccos(4/5)),theta=0..2*Pi); Centroid := [Myz/vol, Mxz/vol, Mxy/vol];
 

 

 

 

 

`+`(`*`(`/`(14, 3), `*`(Pi)))
0
0
`+`(`*`(`/`(81, 4), `*`(Pi)))
[0, 0, `/`(243, 56)] (57)
 

 

Example: Consider the region of integration E where E is above the cone z = VectorCalculus:-`*`(5, sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))))) and inside the sphere VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))) = 4.  

 

First, let's plot (the surface of) our region. It makes sense to represent the cone using cylindrical coordinates (note the appearance of VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))). We have `and`(z = VectorCalculus:-`*`(5, sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))))), VectorCalculus:-`*`(5, sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))))) = VectorCalculus:-`*`(5, .... So parametrically the cone is `<,>`(VectorCalculus:-`*`(r, cos(theta)), VectorCalculus:-`*`(r, sin(theta)), VectorCalculus:-`*`(5, r))The sphere is more easily described in spherical coordinates as rho = 2, so parametrically we have `<,>`(VectorCalculus:-`*`(VectorCalculus:-`*`(2, cos(theta)), sin(`ϕ`)), VectorCalculus:-`*`(VectorCalculus:-`*`(2, sin(theta)), sin(`ϕ`)), VectorCalculus:-`*`(2, cos(`ϕ`))). For both surfaces (obviously) `and`(`<=`(0, theta), `<=`(theta, VectorCalculus:-`*`(2, Pi))). Also, 0 is a lower bound for both r and `ϕ`. The upper bound for both of these variables is determined by where the cone and sphere intersect. So we need to solve the equations z = VectorCalculus:-`*`(5, r) (the cone) and VectorCalculus:-`+`(`*`(`^`(r, 2)), `*`(`^`(z, 2))) = 4 (the sphere) simultaneously.  

 

> allvalues(solve({z=5*r,r^2+z^2=4}));
 

{r = `+`(`*`(`/`(1, 13), `*`(`^`(26, `/`(1, 2))))), z = `+`(`*`(`/`(5, 13), `*`(`^`(26, `/`(1, 2)))))}, {r = `+`(`-`(`*`(`/`(1, 13), `*`(`^`(26, `/`(1, 2)))))), z = `+`(`-`(`*`(`/`(5, 13), `*`(`^`(26,... (58)
 

 

So the upper bound for r is VectorCalculus:-`*`(sqrt(26), `/`(1, 13)). To find the upper bound for φ we need to solve `and`(VectorCalculus:-`*`(rho, cos(`ϕ`)) = z, `and`(z = VectorCalculus:-`*`(5, r), VectorCalculus:-`*`(5, r) = VectorCalculus:-`*`(VectorCalculus:-`*`(5, rho), sin(`ϕ`)))) (the cone in spherical coordinates) and the sphere). 

 

> solve({rho*cos(phi)=5*rho*sin(phi),rho=2});
 

{phi = arctan(`/`(1, 5)), rho = 2} (59)
 

 

Thus the upper bound for φ is arctan(`/`(1, 5)). 

 

> conePlot := plot3d([r*cos(theta),r*sin(theta),5*r],r=0..sqrt(2/13),theta=0..2*Pi, color=red):
sphPlot := plot3d([2*cos(theta)*sin(phi),2*sin(theta)*sin(phi),2*cos(phi)],theta=0..2*Pi,phi=0..arctan(1/5), color=blue):
display({sphPlot,conePlot},scaling=constrained,axes=boxed,orientation=[-40,60]);
 

Plot_2d
 

 

Now let's compute using spherical coordinates. While fixing our plot above, we did all of the "hard work" finding the bounds. 

 

> Int(Int(Int(rho^2*rho*cos(phi)*rho^2*sin(phi), rho=0..2), phi=0..arctan(1/5)), theta=0..2*Pi) = int(int(int(rho^2*rho*cos(phi)*rho^2*sin(phi), rho=0..2), phi=0..arctan(1/5)), theta=0..2*Pi);
 

Int(Int(Int(`*`(`^`(rho, 5), `*`(cos(phi), `*`(sin(phi)))), rho = 0 .. 2), phi = 0 .. arctan(`/`(1, 5))), theta = 0 .. `+`(`*`(2, `*`(Pi)))) = `+`(`*`(`/`(16, 39), `*`(Pi))) (60)
 

 

Next, let's compute using cylidrical coordinates. Again, we already found the bounds while fixing our plot. 

 

> Int(Int(Int((r^2+z^2)*z*r, z=5*r..sqrt(4-r^2)), r=0..sqrt(2/13)), theta=0..2*Pi) = int(int(int((r^2+z^2)*z*r, z=5*r..sqrt(4-r^2)), r=0..sqrt(2/13)), theta=0..2*Pi);
 

Int(Int(Int(`*`(`+`(`*`(`^`(r, 2)), `*`(`^`(z, 2))), `*`(z, `*`(r))), z = `+`(`*`(5, `*`(r))) .. `*`(`^`(`+`(4, `-`(`*`(`^`(r, 2)))), `/`(1, 2)))), r = 0 .. `+`(`*`(`/`(1, 13), `*`(`^`(26, `/`(1, 2)))... (61)
 

 

Example: Consider the region of integration E where E is above the xy-plane, inside the sphere VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))) = 4 and outside the cone z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))). First we will plot the surfaces which bound the region E. 

 

If we approach this problem using spherical and cylindrical coordinates, our plots and integrals will come out nice.  Let's where the sphere and cone intersect. To do this, we need to solve the equations: VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))) = 4 and z = sqrt(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)))) simultaneously. In spherical coordinates we have `*`(`^`(rho, 2)) = 4 (so and VectorCalculus:-`*`(rho, cos(`ϕ`)) = VectorCalculus:-`*`(rho, sin(`ϕ`)). 

 

> solve(2*cos(phi)=2*sin(phi),phi);
 

`+`(`*`(`/`(1, 4), `*`(Pi))) (62)
 

 

In cylindrical coordinates, the intersection of the cone and sphere amounts to solving VectorCalculus:-`+`(`*`(`^`(r, 2)), `*`(`^`(z, 2))) = 4 and z = r. Thus VectorCalculus:-`*`(2, `*`(`^`(r, 2))) = 4 and so r = sqrt(2). 

 

> bottom := plot3d(0, x=-2..2, y=-sqrt(4-x^2)..sqrt(4-x^2), color=green):
sphPlot := plot3d([2*cos(theta)*sin(phi),2*sin(theta)*sin(phi),2*cos(phi)],theta=0..2*Pi,phi=Pi/4..Pi/2, color=blue):
conePlot := plot3d([r*cos(theta),r*sin(theta),r],r=0..sqrt(2),theta=0..2*Pi, color=red):
display({bottom,sphPlot,conePlot},scaling=constrained,axes=boxed,orientation=[-40,60]);
 

Plot_2d
 

 

Let's compute using spherical coordinates. All of the "hard work" was done while we were finding bounds for our plot. 

 

> Int(Int(Int(rho^2*rho*cos(phi)*rho^2*sin(phi), rho=0..2), phi=Pi/4..Pi/2), theta=0..2*Pi) = int(int(int(rho^2*rho*cos(phi)*rho^2*sin(phi), rho=0..2), phi=Pi/4..Pi/2), theta=0..2*Pi);
 

Int(Int(Int(`*`(`^`(rho, 5), `*`(cos(phi), `*`(sin(phi)))), rho = 0 .. 2), phi = `+`(`*`(`/`(1, 4), `*`(Pi))) .. `+`(`*`(`/`(1, 2), `*`(Pi)))), theta = 0 .. `+`(`*`(2, `*`(Pi)))) = `+`(`*`(`/`(16, 3),... (63)
 

 

Now let's compute using cylidrical coordinates. Again, we've already done the "hard work". 

 

Note: I recommend integrating with respect to r before z. If you want to do z first, you'll need to break this up into two pieces. 

 

> Int(Int(Int((r^2+z^2)*z*r, r=z..sqrt(4-z^2)), z=0..sqrt(2)), theta=0..2*Pi) = int(int(int((r^2+z^2)*z*r, r=z..sqrt(4-z^2)), z=0..sqrt(2)), theta=0..2*Pi);
 

Int(Int(Int(`*`(`+`(`*`(`^`(r, 2)), `*`(`^`(z, 2))), `*`(z, `*`(r))), r = z .. `*`(`^`(`+`(4, `-`(`*`(`^`(z, 2)))), `/`(1, 2)))), z = 0 .. `*`(`^`(2, `/`(1, 2)))), theta = 0 .. `+`(`*`(2, `*`(Pi)))) =... (64)
 

 

Example: Let's compute the centroid of the "bumpy sphere" which is described by the spherical coordinate equation rho = VectorCalculus:-`+`(1, VectorCalculus:-`*`(VectorCalculus:-`*`(`/`(1, 5), sin(VectorCalculus:-`*`(6, theta))), sin(VectorCalculus:-`*`(5, `ϕ`)))) where `and`(`<=`(0, theta), `<=`(theta, VectorCalculus:-`*`(2, Pi))) and `and`(`<=`(0, `ϕ`), `<=`(`ϕ`, Pi)). 

 

> bumpyRho := 1 + (1/5)*sin(6*theta)*sin(5*phi);

plot3d([bumpyRho*cos(theta)*sin(phi),bumpyRho*sin(theta)*sin(phi),bumpyRho*cos(phi)],theta=0..2*Pi,phi=0..Pi,numpoints=5000,viewpoint=circleleft);
 

 

`+`(1, `*`(`/`(1, 5), `*`(sin(`+`(`*`(6, `*`(theta)))), `*`(sin(`+`(`*`(5, `*`(phi))))))))
Plot_2d
 

 

Looking at the bumpy sphere we might guess that its centroid is the origin. Let's verify this by computing some integrals. Frist, we compute the mass (i.e. volume) by integrating over 1 (don't forget to include the Jacobian since we're working in spherical coordinates). Then we integrate over x for the moment about the yz-plane, then over y for the moment about the xz-plane, and finally over z for the moment about the xy-plane.  

 

> m := int(int(int(1*rho^2*sin(phi),rho=0..bumpyRho),theta=0..2*Pi),phi=0..Pi);

Myz := int(int(int((rho*cos(theta)*sin(phi))*rho^2*sin(phi),rho=0..bumpyRho),theta=0..2*Pi),phi=0..Pi);
Mxz := int(int(int((rho*sin(theta)*sin(phi))*rho^2*sin(phi),rho=0..bumpyRho),theta=0..2*Pi),phi=0..Pi);
Mxy := int(int(int((rho*cos(phi))           *rho^2*sin(phi),rho=0..bumpyRho),theta=0..2*Pi),phi=0..Pi);
 

 

 

 

`+`(`*`(`/`(136, 99), `*`(Pi)))
0
0
0 (65)
 

 

Then the centroid is: VectorCalculus:-`*`(`/`(1, `*`(volume)), M[yz], M[xz], M[xy]) = (0, 0, 0). So the centroid is origin (just as we guessed). 

 

What if we want the centroid of the upper-half of this solid? (Restrict φ to range from 0 to π/2.) 

 

> top := plot3d([bumpyRho*cos(theta)*sin(phi),bumpyRho*sin(theta)*sin(phi),bumpyRho*cos(phi)],theta=0..2*Pi,phi=0..Pi/2,numpoints=2000):
bottom := plot3d([rho*cos(theta)*sin(Pi/2),rho*sin(theta)*sin(Pi/2),rho*cos(Pi/2)],rho=0..subs(phi=Pi/2,bumpyRho),theta=0..2*Pi):
display({top,bottom},scaling=constrained,numpoints=1000);
 

Plot_2d
 

> vol := int(int(int(rho^2*sin(phi), rho=0..bumpyRho), phi=0..Pi/2), theta=0..2*Pi);

Myz := int(int(int(rho*cos(theta)*sin(phi) * rho^2*sin(phi), rho=0..bumpyRho), phi=0..Pi/2), theta=0..2*Pi);
Mxz := int(int(int(rho*sin(theta)*sin(phi) * rho^2*sin(phi), rho=0..bumpyRho), phi=0..Pi/2), theta=0..2*Pi);
Mxy := int(int(int(rho*cos(phi) * rho^2*sin(phi), rho=0..bumpyRho), phi=0..Pi/2), theta=0..2*Pi);

Centroid := [Myz/vol, Mxz/vol, Mxy/vol];
 

 

 

 

 

`+`(`*`(`/`(68, 99), `*`(Pi)))
0
0
`+`(`*`(`/`(174937, 660000), `*`(Pi)))
[0, 0, `/`(524811, 1360000)] (66)
 

 

Example: Let R be the trapezoidal region with vertices (1,0), (2,0), (0,1), and (0,2). Consider the following integral:. Let's compute this integral using the following change of variables:u = VectorCalculus:-`+`(y, VectorCalculus:-`-`(x))and v = VectorCalculus:-`+`(x, y). We can compute the Jacobian of this transform using the "Jacobian" command. 

 

> InverseM, InverseJ := Jacobian([y-x,x+y],[x,y],determinant=true);
 

Matrix(%id = 18446744078118424814), -2 (67)
 

 

This isn't the correct Jacobian because we fed in the "new in terms of old" equations. We really, need to use equations which look like "x = ..." and "y = ...". Let's find these and compute the "right" Jacobian. 

 

> solve({u=y-x,v=x+y},[x,y]);
 

[[x = `+`(`-`(`*`(`/`(1, 2), `*`(u))), `*`(`/`(1, 2), `*`(v))), y = `+`(`*`(`/`(1, 2), `*`(v)), `*`(`/`(1, 2), `*`(u)))]] (68)
 

> M, J := Jacobian([-u/2+v/2,v/2+u/2],[u,v],determinant=true);
 

Matrix(%id = 18446744078118425054), -`/`(1, 2) (69)
 

 

Of course in the end the Jacobian of the inverse transformation is just the inverse of the Jacobian! Oh well, I guess we really didn't have to compute it this way after all. 

 

I have plotted the region of integration (in the xy-plane) below. Transform this region using the change of variables and plot the corresponding region in the uv-plane. 

 

> polygonplot([[1,0],[2,0],[0,2],[0,1]]);
 

Plot_2d
 

 

Before plotting...notice we could calculate this integral directly, but it's a little messy since the bottom of the region is made up of 2 pieces: y = VectorCalculus:-`+`(1, VectorCalculus:-`-`(x)) and y = 0. The top is given by: y = VectorCalculus:-`+`(2, VectorCalculus:-`-`(x)). 

 

> Int(Int(cos((y-x)/(x+y)),y=1-x..2-x),x=0..1)+
Int(Int(cos((y-x)/(x+y)),y=0..2-x),x=1..2)=
int(int(cos((y-x)/(x+y)),y=1-x..2-x),x=0..1)+
int(int(cos((y-x)/(x+y)),y=0..2-x),x=1..2);
 

`+`(Int(Int(cos(`/`(`*`(`+`(y, `-`(x))), `*`(`+`(x, y)))), y = `+`(1, `-`(x)) .. `+`(2, `-`(x))), x = 0 .. 1), Int(Int(cos(`/`(`*`(`+`(y, `-`(x))), `*`(`+`(x, y)))), y = 0 .. `+`(2, `-`(x))), x = 1 .....
`+`(Int(Int(cos(`/`(`*`(`+`(y, `-`(x))), `*`(`+`(x, y)))), y = `+`(1, `-`(x)) .. `+`(2, `-`(x))), x = 0 .. 1), Int(Int(cos(`/`(`*`(`+`(y, `-`(x))), `*`(`+`(x, y)))), y = 0 .. `+`(2, `-`(x))), x = 1 .....
(70)
 

> evalf(int(int(cos((y-x)/(x+y)),y=1-x..2-x),x=0..1)+
int(int(cos((y-x)/(x+y)),y=0..2-x),x=1..2));
 

1.262206477 (71)
 

 

Back to plotting...Map each point (1,0), (2,0), etc using the equations u = VectorCalculus:-`+`(y, VectorCalculus:-`-`(x)) and v = VectorCalculus:-`+`(x, y). I'll change the view so we can better see where the region lies. 

 

> polygonplot([[-1,1],[-2,2],[2,2],[1,1]],view=[-2..2,0..2],color=green);
 

Plot_2d
 

 

Now let's compute the integral using our change of variables. Notice the left hand side of the region is bounded by the line through (-2,2) and (-1,1) which is just v = VectorCalculus:-`-`(u). The right hand side is bounded by v = u. Also, this region is more naturally thought of as a type II region since it's "bottom" is kind of complicated (it's made up of 3 pieces: v = VectorCalculus:-`-`(u), v = 1, and v = u). So let's integrate with respect to u first and v second. Finally, don't forget the Jacobian!! 

 

> Int(Int(cos(u/v)*abs(-1/2),u=-v..v),v=1..2)=
int(int(cos(u/v)*abs(-1/2),u=-v..v),v=1..2);
 

Int(Int(`+`(`*`(`/`(1, 2), `*`(cos(`/`(`*`(u), `*`(v)))))), u = `+`(`-`(v)) .. v), v = 1 .. 2) = `+`(`*`(`/`(3, 2), `*`(sin(1)))) (72)
 

> 3/2*sin(1) = evalf(3/2*sin(1));
 

`+`(`*`(`/`(3, 2), `*`(sin(1)))) = 1.262206477 (73)
 

 

Therefore,  

[Notice that although we found the same answer without using the change of variables, it looked far more complicated and would have been a nightmare to compute "by hand".] 

 

 

Example: Let's make Maple compute the Jacobian for spherical coordinates. [The following command spits out a "Jacobian matrix" and the "Jacobian determinant". We just need the latter. Since the command spits out a sequence of answers, we put a sequence of labels on the left hand side of the assignment (i.e. "").] 

 

> M,J := Jacobian([rho*cos(theta)*sin(phi),rho*sin(theta)*sin(phi),rho*cos(phi)],[rho,phi,theta],'determinant');

J := simplify(J);
 

 

Matrix(%id = 18446744078118398062), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(rho, 2)))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(rho, 2)))), `*`(`^`(rho, 2), `*`(`^`(cos...
Matrix(%id = 18446744078118398062), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(rho, 2)))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(rho, 2)))), `*`(`^`(rho, 2), `*`(`^`(cos...
`*`(`^`(rho, 2), `*`(sin(phi))) (74)
 

 

Example: In this example we will consider a 4D version of spherical coordinates. Let's call our new fourth spherical coordinate tau (the greek letter tau) and the fourth rectangular coordinate t. 

 

x = VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(rho, cos(theta)), sin(`ϕ`)), sin(tau)),  y = VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(rho, sin(theta)), sin(`ϕ`)), sin(tau)),  z = VectorCalculus:-`*`(VectorCalculus:-`*`(rho, cos(`ϕ`)), sin(tau)),  and  t = VectorCalculus:-`*`(rho, cos(tau)) where `>=`(rho, 0), `and`(`<=`(0, theta), `<=`(theta, VectorCalculus:-`*`(2, Pi))), `and`(`<=`(0, `ϕ`), `<=`(`ϕ`, Pi)), and `and`(`<=`(0, tau), `<=`(tau, Pi)).   

 

> x := (rho,theta,phi,tau) -> rho*cos(theta)*sin(phi)*sin(tau):
'x(rho,theta,phi,tau)' = x(rho,theta,phi,tau);

y := (rho,theta,phi,tau) -> rho*sin(theta)*sin(phi)*sin(tau):
'y(rho,theta,phi,tau)' = y(rho,theta,phi,tau);

z := (rho,theta,phi,tau) -> rho*cos(phi)*sin(tau):
'z(rho,theta,phi,tau)' = z(rho,theta,phi,tau);

t := (rho,theta,phi,tau) -> rho*cos(tau):
't(rho,theta,phi,tau)' = t(rho,theta,phi,tau);
 

 

 

 

x(rho, theta, phi, tau) = `*`(rho, `*`(cos(theta), `*`(sin(phi), `*`(sin(tau)))))
y(rho, theta, phi, tau) = `*`(rho, `*`(sin(theta), `*`(sin(phi), `*`(sin(tau)))))
z(rho, theta, phi, tau) = `*`(rho, `*`(cos(phi), `*`(sin(tau))))
t(rho, theta, phi, tau) = `*`(rho, `*`(cos(tau))) (75)
 

 

Let's find the Jacobian matrix and determinant of this coordinate transformation. 

 

> M,J := Jacobian([x(rho,theta,phi,tau),y(rho,theta,phi,tau),z(rho,theta,phi,tau),t(rho,theta,phi,tau)],[rho,theta,phi,tau],'determinant');

J := simplify(J);
 

 

Matrix(%id = 18446744078118398422), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`(`^`(rho, 3))))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`...
Matrix(%id = 18446744078118398422), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`(`^`(rho, 3))))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`...
Matrix(%id = 18446744078118398422), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`(`^`(rho, 3))))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`...
Matrix(%id = 18446744078118398422), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`(`^`(rho, 3))))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`...
Matrix(%id = 18446744078118398422), `+`(`*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`(`^`(rho, 3))))), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 3), `*`(`^`(sin(tau), 4), `*`...
`*`(sin(phi), `*`(`^`(sin(tau), 2), `*`(`^`(rho, 3)))) (76)
 

 

The 4D sphere (centered at the origin with radius R) is defined by VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))), `*`(`^`(t, 2))) = `*`(`^`(R, 2)). Let's rewrite this in spherical coordinates and then compute the hyper-volume enclosed by this sphere (i.e. the quadruple intergral of 1 over  `<=`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2))), `*`(`^`(z, 2))), `*`(`^`(t, 2))), `*`(`^`(R, 2)))). 

 

> sphere := x(rho,theta,phi,tau)^2+y(rho,theta,phi,tau)^2+z(rho,theta,phi,tau)^2+t(rho,theta,phi,tau)^2=R^2;
sphere := simplify(sphere);

Int(Int(Int(Int(1*J,rho=0..R),theta=0..2*Pi),phi=0..Pi),tau=0..Pi) = int(int(int(int(1*J,rho=0..R),theta=0..2*Pi),phi=0..Pi),tau=0..Pi);
 

 

 

`+`(`*`(`^`(rho, 2), `*`(`^`(cos(theta), 2), `*`(`^`(sin(phi), 2), `*`(`^`(sin(tau), 2))))), `*`(`^`(rho, 2), `*`(`^`(sin(theta), 2), `*`(`^`(sin(phi), 2), `*`(`^`(sin(tau), 2))))), `*`(`^`(rho, 2), `...
`*`(`^`(rho, 2)) = `*`(`^`(R, 2))
Int(Int(Int(Int(`*`(sin(phi), `*`(`^`(sin(tau), 2), `*`(`^`(rho, 3)))), rho = 0 .. R), theta = 0 .. `+`(`*`(2, `*`(Pi)))), phi = 0 .. Pi), tau = 0 .. Pi) = `+`(`*`(`/`(1, 2), `*`(`^`(Pi, 2), `*`(`^`(R... (77)
 

 

The area of a circle of radius Ris Differentiate the formula for the area with respect to R and you get VectorCalculus:-`*`(VectorCalculus:-`*`(2, Pi), R) which is the circumference. The volume of a sphere of radius Ris Differentiate the formula for the volume with respect to R and you get 4VectorCalculus:-`*`(Pi, `*`(`^`(R, 2))) which is the surface area! If we differentiate the "hypervolume" of your sphere, you will get the volume of its "surface". Check out Wikipedia: https://en.wikipedia.org/wiki/Sphere