22M:28 Spring 05 J. Simon An example of computing a triple

advertisement
22M:28
Spring 05
J. Simon
An example of computing a triple integral
with several coordinate systems
>
> with(plots):with(linalg):
Warning, the name changecoords has been redefined
Warning, the protected names norm and trace have been redefined and
unprotected
Consider the solid cone W with radius R and height H.
Think of the cone as sitting on its vertex, with the vertex at the origin and the circular
base paralell to the
xy-plane at height H.
The simplest equation for a circular cone is z=sqrt(x^2+y^2) (note that intersects the xzplane in the graph z = |x|, which is what we want). But to have the cone attain radius = R
at height z=H, we need the slope to be H/R, not 1. So we modify the equation to z =
(H/R)*sqrt(x^2+y^2).
We can parametrize W by saying
x = -R .. R
y =-sqrt(R^2-x^2) .. sqrt(R^2-x^2)
z = (H/R)*sqrt(x^2+y^2) .. H
These would be the limits of integration (in xyz-coordinates) for the
integral of some function f(x,y,z) on W.
Let's use R=10, H=17
> R:=10;H:=17;
R := 10
H := 17
> DrawConeSurface:=plot3d([x,y,(H/R)*sqrt(x^2+y^2)], x=R..R, y=-sqrt(R^2-x^2)..sqrt(R^2-x^2), color=red,
style=patchnogrid):
> DrawTopDisk:=plot3d([x,y,H], x=-R..R, y=-sqrt(R^2x^2)..sqrt(R^2-x^2), color=blue, style=wireframe,
thickness=2, grid=[10,10]):
> display({DrawConeSurface, DrawTopDisk},
scaling=constrained, tickmarks=[1,1,0], axes=normal,
lightmodel=light2, orientation=[-44,60]);
Example: f(x,y,z) = x+y+z
> f:=x+y+z;
f := x + y + z
> TheIntegral:=Int(Int(Int(f, z=(H/R)*sqrt(x^2+y^2) .. H),y
=-sqrt(R^2-x^2) .. sqrt(R^2-x^2)), x = -R .. R);
10
100 − x
⌠
TheIntegral := ⌠

⌡-10
⌡
2
− 100 − x
2
17
⌠

⌡17
10
x + y + z dz dy dx
2
2
x +y
> Step1:=Int(Int(int(f, z=(H/R)*sqrt(x^2+y^2) .. H),y =sqrt(R^2-x^2) .. sqrt(R^2-x^2)), x = -R .. R);
10
⌠
Step1 := 



⌡-10
100 − x
⌠




⌡
2
− 100 − x
17 2 2 
17 2 2  289 289 2 289 2
x  17 −
x + y  + y  17 −
x + y  +
−
x −
y dy dx
10
10
2
200
200




2
> Step2:=Int(int(int(f, z=(H/R)*sqrt(x^2+y^2) .. H),y =sqrt(R^2-x^2) .. sqrt(R^2-x^2)), x = -R .. R);
10
⌠
578
289 2
Step2 := 
17 x 100 − x2 +
100 − x2 −
x 100 − x2


3
150

⌡-10
−
17 3
17
x ln( −( x − 10 ) ( x + 10 ) + 10 ) + x3 ln( − −( x − 10 ) ( x + 10 ) + 10 ) d x
20
20
> Step3:=int(int(int(f, z=(H/R)*sqrt(x^2+y^2) .. H),y =sqrt(R^2-x^2) .. sqrt(R^2-x^2)), x = -R .. R);
10
⌠
578
289 2
Step3 := 
17 x 100 − x2 +
100 − x2 −
x 100 − x2


3
150

⌡-10
−
17 3
17
x ln( −( x − 10 ) ( x + 10 ) + 10 ) + x3 ln( − −( x − 10 ) ( x + 10 ) + 10 ) d x
20
20
Notice Maple couldn't even calculate the antiderivative for Step 3.
> evalf(Step3);
22698.00692
######################################################################3
Let's see if the problem becomes easier if we use cylindrical coordinates.
Now
x = -R .. R
y =-sqrt(R^2-x^2) .. sqrt(R^2-x^2)
z = (H/R)*sqrt(x^2+y^2) .. H
becomes
theta = 0..2*Pi
r = 0..R
z = (H/R)*sqrt(r^2) .. H.
and
f(x,y,z) = x+y+z = r*cos(theta)+r*sin(theta)+z and we remember to multiply by the
Jacobian determinant = r.
> TheCylindricalIntegral:=
Int(Int(Int((r*cos(theta)+r*sin(theta)+z)*r, z =
(H/R)*sqrt(r^2)..H), r=0..R), theta=0..2*Pi);
2π
10
17
⌠ ⌠
TheCylindricalIntegral := ⌠

⌡0 
⌡0 
⌡17
10
( r cos( θ ) + r sin( θ ) + z ) r d z d r d θ
r
2
> Step1Cyl:=Int(Int(int((r*cos(theta)+r*sin(theta)+z)*r, z =
(H/R)*sqrt(r^2)..H), r=0..R), theta=0..2*Pi);
2π
⌠
Step1Cyl := 



⌡0
10
⌠
1 
289 2 
17 2 

r  289 −
r  + ( r cos( θ ) + r sin( θ ) ) r  17 −
r  d r d θ


2 
100 
10



⌡0
> Step2Cyl:=Int(int(int((r*cos(theta)+r*sin(theta)+z)*r, z =
(H/R)*sqrt(r^2)..H), r=0..R), theta=0..2*Pi);
2π
⌠ 7225 4250
4250
Step2Cyl := 
+
sin( θ ) +
cos( θ ) d θ


2
3
3

⌡0
> Step3Cyl:=int(int(int((r*cos(theta)+r*sin(theta)+z)*r, z =
(H/R)*sqrt(r^2)..H), r=0..R), theta=0..2*Pi);
Step3Cyl := 7225 π
> evalf(Step3Cyl);
22698.00693
NOTICE: (except for a little epsilon error in the numerical integral, we DO get the same
value as before. But this time the integral 7225*pi is something we could have calculated
by hand.
########################################################################
##################
Now let's see what the integral looks like in spherical coordinates.
ρ rho = distance from the origin (so rho >/= 0) (using notation >= for "greater than or
equal to")
ϕ phi = angle of declination from the vertical (0 </= phi </= Pi)
θ theta = usual polar angle as in cylindrical coordinates (theta any values, but usually
0 <= theta <= 2Pi)
The transformation to write x,y,z in terms of rho, phi, theta is a little complicated. But
here is how you can remember it.
First express z and polar r in terms of rho and phi:
z = rho*cos(phi)
r = rho*sin(phi)
z = ρ cos ϕ
ϕ
length ρ
r = ρ cos (complement of ϕ) = ρ sin (ϕ)
Then write x = r cos(theta), y = r sin(theta), z=z.
This gives x = rho sin(phi) cos(theta) , y = rho sin(phi) sin(theta) , z = rho cos(phi).
So the transformation for spherical coordinates is
x = r cos(theta) = rho sin(phi) cos(theta)
y = r sin(theta) = rho sin(phi) sin(theta)
z = rho cos(phi).
In addition to using the above transformation (x = expression in rho, phi, theta; etc.) to
rewrite the integrand f(x,y,z), we also need to compute the Jacobian determinant for the
transformation.
> jacobian([rho*sin(phi)*cos(theta),
rho*sin(phi)*sin(theta), rho*cos(phi)], [rho, phi, theta]);
sin( φ ) cos( θ ) ρ cos( φ ) cos( θ ) −ρ sin( φ ) sin( θ )
 sin( φ ) sin( θ ) ρ cos( φ ) sin( θ ) ρ sin( φ ) cos( θ ) 


−ρ sin( φ )
0
 cos( φ )

> det(%);
sin( φ )3 cos( θ )2 ρ2 + sin( φ )3 sin( θ )2 ρ2 + ρ2 cos( φ )2 cos( θ )2 sin( φ )
+ ρ2 sin( φ ) sin( θ )2 cos( φ )2
> simplify(%);
sin( φ ) ρ2
So we get rho^2*sin(phi) as the stretching factor that we need to use to change integrals
written in terms of x,y,z into integrals written in terms of spherical coordinates.
To write our integral in spherical coordinates, we need to describe the domain, that is the
solid cone.
The boundary cone surface is just phi = constant angle.
What angle?
From the little trig picture above, we see that the angle phi that describes this cone has
tan(phi) = R/H. So the cone angle (from the vertical to the cone) is arctan(R/H). Don't be
frightened by the arctangent. Remember (R/H) is just a constant, so is arctan(R/H).
What is the equation of the plane z=H in spherical coordinates?
z = H is the plane. In spherical coordinates, z = rho*cos(phi).
So the plane is rho*cos(phi) = H, i.e. rho = H/cos(phi).
We are now ready to rewrite the integral.
The integrand = x+y+z = rho*sin(phi)*cos(theta) + rho*sin(phi)*sin(theta) +
rho*cos(phi). To keep the limits of integration clear in what we are about to write, let's
introduce "g" to denote the integrand expressed in terms of rho, phi, theta.
> g:=rho*sin(phi)*cos(theta) + rho*sin(phi)*sin(theta) +
rho*cos(phi);
g := ρ sin( φ ) cos( θ ) + ρ sin( φ ) sin( θ ) + ρ cos( φ )
We also are going to have to multiply g by the stretching factor rho^2*sin(phi). Let's
call that whole new integrand G.
> G:=rho^2*sin(phi)*g;
G := ρ2 sin( φ ) ( ρ sin( φ ) cos( θ ) + ρ sin( φ ) sin( θ ) + ρ cos( φ ) )
> TheSphericalIntegral:=Int(Int(Int(G, rho=0..H/cos(phi)),
phi=0..arctan(R/H)), theta=0..2*Pi);
2π
TheSphericalIntegral := ⌠


⌡0
10
arctan 
 17 
⌠


⌡0
17
1
cos ( φ )
⌠


⌡0
ρ2 sin( φ ) ( ρ sin( φ ) cos( θ ) + ρ sin( φ ) sin( θ ) + ρ cos( φ ) ) d ρ d φ d θ
>
> Step1Spher:=Int(Int(int(G, rho=0..H/cos(phi)),
phi=0..arctan(R/H)), theta=0..2*Pi);
2π
⌠
Step1Spher := 



⌡0
10
arctan 
 17 
⌠




⌡0
83521 sin( φ ) ( sin( φ ) cos( θ ) + sin( φ ) sin( θ ) + cos( φ ) )
dφ dθ
4
cos( φ )4
> Step2Spher:=Int(int(int(G, rho=0..H/cos(phi)),
phi=0..arctan(R/H)), theta=0..2*Pi);
2π
⌠ 7225 4250
4250
Step2Spher := 
+
sin( θ ) +
cos( θ ) d θ


2
3
3

⌡0
> Step3Spher:=int(int(int(G, rho=0..H/cos(phi)),
phi=0..arctan(R/H)), theta=0..2*Pi);
Step3Spher := 7225 π
THIS IS IDENTICAL TO WHAT WE GOT BEFORE USING CYLINDRICAL
COORDINATES.
Download