Escolar Documentos
Profissional Documentos
Cultura Documentos
copyright 2009 by Jonathan Rosenberg based on an earlier M-book, copyright 2000 by Paul Green and Jonathan Rosenberg
Contents
y y y y y y y y y
Evaluating Triple Iterated Integrals Example 1 Problem 1 Finding the Limits Example 2 Problem 2 Example 3 Problem 3 Additional Problems:
Example 1
We will begin by considering the iterated integral
We can also evaluate the first integral only, and then use dblquad or numint2 for the remaining two integrations:
f=int(x*y*z,z,0,3 -x-y) secondans=numint2(f,y,0,3 -x,x,0,3) f =
(x*y*(x + y - 3)^2)/2
secondans = 1.0125
So in the new coordinates, the integral is over the box 0<x<3, 0<u<1, 0<v<1 and the integrand is
with accuracy
double(firstans -thirdans) ans = 0
But because dblquad is sometimes slow (and the same algorithm extrapolated to three dimensions would be even slower) or doesn't work very well, we have looked for an alternative, based on a freeware package of M-files called the numerical integration toolbox. This toolbox is much faster and more adaptable (though admittedly sometimes harder to use) than dblquad . Copy this package from http://www.math.umd.edu/users/jmr/241/mfiles/nit/ into a subdirectory of your working directory called nit. To use this package, first add the package with the command:
addpath nit
To see how it works, we first try out an alternative version of numint2 , based on nit, called newnumint2 . The syntax is the same as for numint2 , but there is an optional final parameter, which is the number of subdivision points to use in each direction. (The default is 20.) The higher this parameter, the more accurate the results; however, the running time of the algorithm is proportional to the square of this parameter, so be careful about increasing it.
fourthans=newnumint2(f,y,0,3 -x,x,0,3) fourthans = 1.0125
Note that this answer looks the same as the first two to four decimal places, but that we are spared all the annoying warning messages. The accuracy is:
double(firstans -fourthans) ans = 0
which is pretty good!! Now we try a totally numerical integration. The analogue of newnumint2 for triple integrals is called numint3 . Again there is an optional final parameter, which is the number of subdivision points to use in each direction. (The default is 8.) The higher this parameter, the more accurate the results; however, the running time of the algorithm is proportional to the cube of this parameter, so be extra careful about increasing it.
fourthans=numint3(x*y*z,z,0,3 -x-y,y,0,3-x,x,0,3) fourthans = 1.0125
Problem 1
Evaluate the threefold iterated integral
both symbolically and numerically. (For the numerical integration, first do the integral over z, then use newnumint2 on this intermediate result.)
Example 2
Let us consider the region above the paraboloid
We might begin by plotting the two surfaces simultaneously. Since z is never negative on or above the paraboloid, we are interested only in positive values of z. Consequently, we will solve the equation of the ellipsoid for positive z and use ezmesh to plot both surfaces.
ezmesh(sqrt(20 -3*x^2-2*y^2),[-3,3,-2,2]); hold on ezmesh(2*x^2+3*y^2, [ -3,3,-2,2]) view([1,2,3]) hold off;
From the viewpoint we have chosen, using MATLAB's view comand, we can see that there is a region inside the ellipsoid that is bounded below by the paraboloid and above by the ellipsoid. This determines the lower and upper limits for z. Accordingly, we set
z1=2*x^2 + 3*y^2 z2=sqrt(20 -3*x^2-2*y^2) z1 = 2*x^2 + 3*y^2
To determine the limits for x and y, it may be helpful to plot the curve along which the upper and lower limits for z coincide. We will do this using ezplot :
ezplot(z2 -z1, [-3, 3, -2, 2])
Although this looks like an ellipse, it is actually a quartic curve. We will establish the limits by solving the equation of the curve for y as a function of x. We expect two solutions, corresponding to the upper and lower y limits, and we should be able to determine the x limits by setting the y limits equal to each other.
ylims=solve(z2 -z1,y) ylims = ((4*(181 (- (8*x^2)/3 -((4*(181 -(- (8*x^2)/3 15*x^2)^(1/2))/9 - (8*x^2)/3 - (4*(181 - 15*x^2)^(1/2))/9 15*x^2)^(1/2))/9 - (8*x^2)/3 - (4*(181 - 15*x^2)^(1/2))/9 4/9)^(1/2)/2 4/9)^(1/2)/2 4/9)^(1/2)/2 4/9)^(1/2)/2
Here solve has found four solutions instead of two. This should not surprise us too much since the equation in question is quartic. Of the four solutions, however, two of them are complex, as we can see by substituting x=0.
double(subs(ylims,x,0)) ans = 1.1763 0.0000 + 1.2673i -1.1763 -0.0000 - 1.2673i
Thus solution #3 should be the lower limit for y, solution #1 should be the upper limit, and solutions #2 and 4 are complex and should be discarded. So we set
y1=ylims(3) y2=ylims(1) xlims=solve(y2 -y1,x) x1=double(xlims(2)) x2=double(xlims(1)) y1 = -((4*(181 - 15*x^2)^(1/2))/9 - (8*x^2)/3 - 4/9)^(1/2)/2
x1 = -1.3756
x2 = 1.3756
We can now check our limits for geometric plausibility. For this purpose we have written an M-file called viewSolid .
type viewSolid function viewSolid(zvar, F, G, yvar, f, g, xvar, a, b) %VIEWSOLID is a version for MATLAB of the routine on page 161 % of "Multivariable Calculus and Mathematica" for viewing the region % bounded by two surfaces for the purpose of setting up triple integrals. % The arguments are entered from the inside out. % There are two forms of the command --- either f, g, % F, and G can be vectorized functions, or else they can % be symbolic expressions. xvar, yvar, and zvar can be % either symbolic variables or strings. % The variable xvar (x, for example) is on the % OUTSIDE of the triple integral, and goes be tween CONSTANT limits a and b. % The variable yvar goes in the MIDDLE of the triple integral, and goes % between limits which must be expressions in one variable [xvar]. % The variable zvar goes in the INSIDE of the triple integral, and goes % between limits which must be expressions in two % variables [xvar and yvar]. The lower surface is plotted in red, the
% upper one in blue, and the "hatching" in cyan. % % Examples: viewSolid(z, 0, (x+y)/4, y, x/2, x, x, 1, 2) % gives the picture on page 163 o f "Multivariable Calculus and Mathematica" % and the picture on page 164 of "Multivariable Calculus and Mathematica" % can be produced by % viewSolid(z, x^2+3*y^2, 4 -y^2, y, -sqrt(4-x^2)/2, sqrt(4 -x^2)/2, ... % x, -2, 2,) % One can also type viewSolid('z', @(x,y) 0, ... % @(x,y)(x+y)/4, 'y', @(x) x/2, @(x) x, 'x', 1, 2) % if isa(f, 'sym') % case of symbolic input ffun=inline(vectorize(f+0*xvar),char(xvar)); gfun=inline(vectorize(g+0*xvar),char(xvar)); Ffun=inline( vectorize(F+0*xvar),char(xvar),char(yvar)); Gfun=inline(vectorize(G+0*xvar),char(xvar),char(yvar)); oldviewSolid(char(xvar), double(a), double(b), ... char(yvar), ffun, gfun, char(zvar), Ffun, Gfun) else oldviewSolid(char(xvar), double(a ), double(b), ... char(yvar), f, g, char(zvar), F, G) end %%%%%%% subfunction goes here %%%%%% function oldviewSolid(xvar, a, b, yvar, f, g, zvar, F, G) for counter=0:20 xx = a + (counter/20)*(b -a); YY = f(xx)*ones(1, 21)+((g(xx) -f(xx))/20)*(0:2 0); XX = xx*ones(1, 21); %% The next lines inserted to make bounding curves thicker. widthpar=0.5; if counter==0, widthpar=2; end if counter==20, widthpar=2; end %% Plot curves of constant x on surface patches. plot3(XX, YY, F(XX, YY).*ones(1,21), 'r', 'LineWidth', widthpar); hold on plot3(XX, YY, G(XX, YY).*ones(1,21), 'b', 'LineWidth', widthpar); end; %% Now do the same thing in the other direction. XX = a*ones(1, 21)+((b -a)/20)*(0:20); %% Normalize sizes of vectors. YY=0:2; ZZ1=0:20; ZZ2=0:20; for counter=0:20, %% The next lines inserted to make bounding curves thicker. widthpar=0.5; if counter==0, widthpar=2; end if counter==20, widthpar=2; end for i=1:21, YY(i)=f(XX(i))+(counter/20)*(g(XX(i)) -f(XX(i))); ZZ1(i)=F(XX(i),YY(i)); ZZ2(i)=G(XX(i),YY(i)); end; plot3(XX, YY, ZZ1, 'r', 'LineWidth',widthpar); plot3(XX, YY, ZZ2, 'b', 'LineWidth',widthpar); end; %% Now plot vertical lines. for u = 0:0.2:1, for v = 0:0.2:1,
x=a + (b-a)*u; y = f(a + (b -a)*u) +(g(a + (b -a)*u)-f(a + (ba)*u))*v; plot3([x, x], [y, y], [F(x,y), G(x, y)], 'c'); end; end; xlabel(xvar) ylabel(yvar) zlabel(zvar) hold off
It takes a proposed set of limits of integration (written from the inside to the outside) and draws a picture of the corresponding region.
viewSolid(z,z1,z2,y,y1,y2,x,x1,x2)
This looks reasonable; we may now use the limits we have found to integrate any function we like over the region in question.
Problem 2
Find the appropriate limits for integrating over the region bounded by the paraboloids
and
Check your results using viewSolid . What is special about the examples we have just considered is that the region in question is bounded by two surfaces, each of which has an equation specifying z as a function of x and y. The procedure we have used in this case will work for any such region, as long as solve is able to solve the associated equations. We will look now at an example of another sort.
Example 3
We consider the region interior to both of the elliptical cylinders, x^2+2y^2 = 9 and 2x^2+z^2 = 8 . We begin by observing that the condition that a point be interior to both cylinders constrains x^2 to be at most 4. We also observe that, for fixed x, the limits for y and z are determined independently of each other. So we'll want to put the x-integral on the outside. We can immediately set
x1=-2; x2=2; y1=-sqrt((9-x^2)/2); y2= -y1; z1=-sqrt(8-2*x^2); z2= -z1;
We can again use viewSolid to check the plausibility of these limits, although the resulting plot is more difficult to interpret in this case, since it shows only the upper and lower boundaries as surfaces; the side boundaries are shown as ensembles of vertical lines.
viewSolid(z,z1,z2,y,y1,y2,x,x1,x2)
Problem 3
Find limits appropriate for integrating over the solid region bounded by the paraboloid y cylinder x^2 + y^2 = 1 . Check your results with
dditional Problems:
1. Find the volume of each of the solid regions considered in Examples 2 and 3 and Problems 2 and 3 above. Use at least two different methods in each case and compare the answers. 2. Integrate the function x^2 + y*z over the solid region above the paraboloid z = x^2 + y^2 and below the plane x + y + z = 10 . 3. Integrate the function x^2 + 2y^2 + 3z^2 over the solid region interior to both the sphere x^2 + y^2 + z^2 = 9 and the cylinder (x-1)^2 + y^2 = 1 .
Published with MATLAB 7.8
ezsurf('sin(sqrt(x^2+y^2))' ,[0,pi,0,pi])
Multiple Integrals
Matlab can handle iterated multiple integrals easily just by nesting regular integrals. For example think about what the following command does. Hint: Think from the inside out.
syms x y; int(int(x*y,y,x^3,x^2),x,0,1)
Contents
y y y y y y y y y
M-Files and Publishing Parametrized Surfaces Surface Integrals of Functions Surface Integrals of Vector Fields. Line Integrals of Functions. Line Integrals of Vector Fields. Vector Fields Vector Fields in 3D Project 3
Parametrized Surfaces
Matlab can plot parametrized surfaces quite easily. If we have a surface parametrized as r(u,v)=x(u,v)i+y(u,v)j+z(u,v)k then we give this to Matlab as a vector. For example here is a cylinder defined in terms of theta and z. We'll call it rbar.
syms theta z rbar=[2*cos(theta),2*sin(theta),z];
We then plot this with ezsurf and that's when we give it the restrictions on u and v, or in this case z and theta. However ezsurf wants the three components separately so we access them like a vector. Note the axis equal command which makes sure that the aspect ratio is proper.
ezsurf(rbar(1),rbar(2),rbar(3),[0,2*pi,0,5]) axis equal
It's extremely important to know that the constraints are in alphabetical order so 0,2*pi corresponds to theta and the 0,5 corresponds to z. Here's another example, this time a piece of the plane 2x+y+z=10 with 0<=x<=5 and 2<=z<=2 . In this case we solve for y=10-2x-z:
syms x z rbar=[x,10 -2*x-z,z]; ezsurf(rbar(1),rbar(2),rbar(3),[0,5, -2,2]) axis equal
ans = 4*(sin(phi)^2)^(1/2)
So now here's the really nice thing. Suppose we want to integrate the function f(x,y,z)=x^2+y^2 over that surface. This involves plugging the i,|j|,|k| components in for x, y, z, multiplying by that magnitude and integrate over the appropriate limits. Here it is all together:
clear
syms phi theta x y z; rbar=[2*sin(phi)*cos(theta),2*sin(phi)*sin(theta),2*cos(phi)] f=x^2+y^2; mylength=@(u) sqrt(u*transpose(u)); mag=simplify(mylen gth(cross(diff(rbar,phi),diff(rbar,theta)))); sub=subs(f,[x,y,z],rbar); int(int(sub*mag,phi,0,pi/2),theta,0,3*pi/2) rbar = [ 2*cos(theta)*sin(phi), 2*sin(phi)*sin(theta), 2*cos(phi)]
ans = 16*pi
Make sure you read this carefully (after the clear ) to see what each line does. The first line sets the symbolic variables. The second line is the parametrization of the surface. The third line is the function to integrate. The fourth line creates a length function we'll need later. The fifth line find the magnitude of the cross product of the derivatives. The sixth line substitutes the components from the parametrization into the real-valued function we want to integrate. The seventh and final line does the double integral required.
Again read this carefully. After the clear the first line sets the symbolic variables. The second sets the parametrization and the third sets the vector field. The fourth finds the cross product of the derivatives. The fifth substitutes the parametrization into the vector field. The sixth does the double integral of the dot product as required for the surface integral of a vector field.
Back in the first guide we figured out how to plot curves. we can do line integrals in a systematic way like we did surface integrals. For example here's example 1 from page 1006 of the text. Read this carefully to see how it works!
clear syms t x y z; rbar=[t,-3*t,2*t]; f=x+y^2-2*z; mylength=@(u) sqrt(u*transpose(u)); mag=simplify(mylength(diff(rbar,t))); sub=subs(f,[x,y,z],rbar); int(sub*mag,t,0,1) ans = (3*14^(1/2))/2
Vector Fields
Matlab can plot vector fields using the quiver command, which basically draws a bunch of arrows. This is not completely obvious though. First we have to set up a grid of points for which to plot arrows. Suppose we want our grid to have x going from -5 to 5 of x and the same for y. We do
[x,y]=meshgrid( -5:1:5,-5:1:5);
Now suppose we wish to plot the vector field F(x,y)=(y/5)i -(x/5)j . To do this we type
quiver(x,y,y/5, -x/5,0);
A window will pop up with the vector field on it. The 0 at the end just ensures that Matlab does not do any tricky rescaling of the vectors, something it usually does to make things fit nicely. Just so you know the first two entries x,y indicate that vectors should be placed at x,y. The second two entries form the vector itself. A note of caution. Suppose we want the vector field F(x,y)=(y/5)i -(x/y)j . Since x and y are collections of numbers, to divide them we can't use /, we must use ./ instead. This is a Matlab quirk since we're not working with individual numbers. Thus we would need
quiver(x,y,y/5, -x./y,0)
Vector Fields in 3D
For 3D vector fields we use quiver3 . Here's an example. It's the only one we'll do because they can be pretty overwhelming.
[x,y,z]=meshgrid( -5:2:5,-5:2:5,-5:2:5); quiver3(x,y,z, -y./sqrt(x.^2+y.^2),x./sqrt(x.^2+y.^2),0)
Project 3
See the project on the main course page.
Published with MATLAB 7.8
Suppose, for example, that we wish to use Matlab to plot the surface represented by the function
`z=sqrt(x^2+y^2)`.
A standard drawing technique involves drawing traces of the function in the coordinate planes. For example, to see the trace in the `xz` -plane, set `y=0` to obtain `z=sqrt(x^2)`, whose graph is shown in Figure 1 ( Recall that `sqrt(x^2)=|x|`.)
In similar fashion, set `x=0` in `z=sqrt(x^2+y^2)` to obtain the trace in the `yz`-plane having equation `z=sqrt(y^2)`. See Figure 2.
Setting
`z=0`
in
`z=sqrt(x^2+y^2)`
yields
`0=sqrt(x^2+y^2)`,
or
equivalently, `0=x^2+y^2`, whose graph is the single point `(0 ,0)`. Thus, the trace in the `xy`-plane is the point `(0,0)`.
To flesh out the rest of the surface, we take parallel cross sections for various values of `z`.
If we let `z=1` in `z=sqrt(x^2+y^2)`, we eventually arrive at `x^2+y^2=1`, which is a circle of radius 1, which we sketch at a height of `z=1`.
If we let `z=2` in `z=sqrt(x^2+y^2)`, we eventually arrive at `x^2+y^2=4`, which is a circle of radius 2, which we sketch at a height of `z=2`.
Putting together the traces and the parallel cross sections leads us to believe that the surface defined by `z=sqrt(x^2+y^2)` is a cone.
x=linspace(-3,3,40);
y=linspace(-3,3,40); [x,y]=meshgrid(x,y);
Note that the above commands set up a grid of points on the domain
`{(x,y):\ -3 le x, y le 3}`.
Next, calculate the value of `z` (using `z=y^2`) at each point in the grid determined by the matrices x and y returned by the meshgrid command. You can either enter the following commands in a script or you can execute them at the Matlab prompt in the comm and window.
z=sqrt(x.^2+y.^2);
Use the mesh
mesh(x,y,z)
Add a grid and turn "on" the box, adding depth to the visualization. We can also "tighten" the axes to the surface with the axis tight command.
Finally, rotate the view into the standard orientation used in class.
view([130,30])
The above sequence of commands will produce the image in Figure 3.
The result in Figure 3 is adequate, but somewhat disappointing. The traces in the `xz`- and `yz`-planes are certainly the "V's" we saw in Figures 1 and 2, and it's easy to note that cross sections parallel to the `xy` -plane are circles. Still, the image in Figure 3 is not what we usually think of when we hear the word "cone." We're more apt to think of something shaped like a paper snowcone holder.
Cylindrical Coordinates
In Figure 4, we rotate the `xz`-plane through an angle `theta`, then move outward a radial distance `r`, then upward a distance `z`. The cylindrical coordinates of the point `P` are then `(r,theta,z)`.
The connection to polar coordinates in Figure 4 is clear, as the `x` -, `y`- and `z`-values of point `P` are given by the equatio ns of transformation
`r=sqrt(x^2+y^2)`.
Now,
substitute
this
last
result
in
our
equation
of
the
cone,
`z=r`.
In `z=r`, it is important to note that `z` is a function of `r` and `theta`, even though `theta` is not explicitly mentioned. That is, `z=f(r,theta)`. This indicates that we must use Matlab's meshgrid command to create a grid of `(r,theta)` points to substitute into the equation `z=r`.
Let's choose `r` so that `0 le r le 2` (remember that parallel cross section that was a circle of radius 2?). Also, let's choose `theta` such that `0 le theta le 2 pi`. The reason for this last choice is clear if you examine anew Figure 4. Clearly, to obtain the desired cone, we must allow a complete revolution about the `z`-axis.
Now we use the equations that transform cylindrical coordinates into Cartesian coordinates, namely `x=r cos theta` and `y=r sin theta`. Remember, r and theta are matrices, so we use array notation.
x=r.*cos(theta); y=r.*sin(theta);
Next, compute `z`.
z=r;
Draw the mesh.
mesh(x,y,z)
Add the usual amendments and annotations.
grid on box on axis tight view([130,30]) xlabel('x-axis') ylabel('y-axis') zlabel('z-axis') title('The graph space.')
of
sqrt(x^2
y^2)
in
three-
The above sequence results in the beautifully formed cone shown in Figure 5.
`x^2+y^2=1`.
, the sketch of `x^2+y^2=1` was a cylinder of radius 1. If we use the cylindrical transformation `r=sqrt(x^2+y^2)`, `r^2=1`. or equivalently, `r^2=x^2+y^2`, then `x^2+y^2=1` becomes
`r=1`.
There is no need for the negative square root of 1 here as making a complete revolution in `theta` (`0 le theta le 2 pi`) allows access to all octants in th ree space. Indeed, `r=1` is completely expected, as `x^2+y^2=1` is a cylinder of radius 1.
To plot the surface defined by `r=1` in Matlab, we must first realize that `r` is a function of `z` and `theta`, even though they are not explicitly mentioned in the equation `r=1`. That is, `r=f(z,theta)`. We need to make this observation in order to understand that we must create a grid of `(z,theta)` points to substitute into the equation `r=1`.
Let's choose `z` so that `-2 le z le 2`. Let's choose `theta` again so that `0 le theta le 2 pi`.
r=1;
Compute `x` and `y` using the equations that transform cylindrical into Cartesian coordinates.
x=r*cos(theta); y=r*sin(theta);
Note that `r=1` is a scalar, so ordinary multiplication is used in this case.
mesh(x,y,z)
Add the usual amendments and annotations.
Matlab Files
Although the following file features advanced use of Matlab, we include it here for those interested in discovering how we generated the images for this activity. You can download the Matlab file at the following link. Download the file to a directory or folder on your system.
coordcyl.m
The file coordcyl.m is designed to be run in "cell mode." Open the file coordcyl.m in the Matlab editor, then enable cell mode from the Cell Menu.
After that, use the entries on the Cell Menu or the icons on the toolbar to execute the code in the cells provided in the file. There are options for executing both single and multiple cells. After executing a cell, examine the contents of your folder and note that a PNG file was generated by executing the cell.
Exercises
For each of the following exercises, include the following in your homework submission:
Pencil and paper calculations needed to change the given equation to cylindrical coordinates.
1. Use cylindrical coordinates to sketch the surface defined by the equation `z=x^2+y^2`. This surface is called a paraboloid.
2. Use cylindrical coordinates to sketch the surface defined by the equation `x^2+y^2=9`.
3. Use cylindrical coordinates to sketch the sur face defined by the equation `y=2 sqrt(x^2+z^2)`.
Hint: Note that in this case `y` is a function of `x` and `z`; i.e., `y=f(x,z)`. Thus, you need to set up a grid of `(x,z)` points to substitute into the function.
Additional hint: Instead of the rotation shown in Figure 4, imagine a rotation of the of the `xy` -plane about the `y`axis by an angle of `theta`, then moving outward a radial distance `r`, then upward a distance `y` (provide a hand drawn sketch of this image). Show then that the cylindrical coordinate transformations become:
Use
these
transformations
to
sketch
the
surface
4. Sketch
the
cylindrical
surface
defined
by
the
equ ation
Surface Integrals
copyright 2009 by Jonathan Rosenberg based on an earlier M-book, copyright 2000 by Paul Green and Jonathan Rosenberg
Contents
y y y y y y y y y y y
Surface Area and Surface Integrals Example 1 Example 2 Problem 1 Flux Integrals Example 3 Problem 2 The Divergence Theorem Example 4 Problem 3 Additional Problems
Since P is vector-valued,
are vectors, and their cross-product is a vector with two important properties: it is normal to the surface parametrized by P, and its length gives the scale factor between area in the parameter space and the corresponding area on the surface. Thus, taking lengths on both sides of the above formula above gives
which enables us to compute the area of a parametrized surface, or to integrate any function along the surface with respect to surface area.
Example 1
To see how this works, let us compute the surface area of the ellipsoid whose equation is
We may parametrize this ellipsoid as we have done in the past, using modified spherical coordinates:
syms x y z p t ellipsoid=[2*sin(p)*cos(t),3*sin(p)*sin(t),cos(p)] ellipsoid = [ 2*cos(t)*sin(p), 3*sin(p)*sin(t), cos(p)]
...
This is going to be too complicated to integrate symbolically, so we do a numerical integration, using the numerical integration toolbox at http://www.math.umd.edu/users/jmr/241/mfiles/nit/.
addpath nit area=newnumint2(surffactor,p,0,pi,t,0,2*pi) area = 48.8822
over the surface, we must express it in terms of the parameters and insert the result as a factor in the integrand.
integral = 100.5002
Example 2
Here's another example: suppose we want the surface area of the portion of the cone z^2 = x^2 + y^2 between z = 0 and z = 4. The equation of the cone in cylindrical coordinates is just z = r, so we can take as our parameters r and t (representing theta).
syms r; cone=[r*cos(t),r*sin(t),r] cone = [ r*cos(t), r*sin(t), r]
Since r is positive, we can ignore the sign csgn(r) , and the surface area is
conesurf=symint2(2^(1/2)*r,r,0,4,t,0,2*pi) conesurf = 16*pi*2^(1/2)
This is right since we can also "unwrap" the cone to a sector of a circular disk, with radius 4*sqrt(2) and outer circumference 8*pi (compared to 8*pi*sqrt(2) for the whole circle), so the surface area is
Problem 1
(a) Compute the surface area of the portion of the paraboloid z = 9 - x^2 - y^2 that lies above the xy-plane. (b) Evaluate
where Sigma is the surface whose area you found in part (a).
Flux Integrals
The formula
Example 3
Let us compute
where the integral is taken over the ellipsoid E of Example 1, F is the vector field defined by the following input line, and n is the outward normal to the ellipsoid.
F = [x,y,z] ndS = cross(diff(ellipsoid,p),diff(ellipsoid,t)) F = [ x, y, z]
We can check that we have the outward normal by setting p=pi/2 and t=0, giving us the point of the ellipsoid that is on the positive x-axis. The outward normal should point in the positive x direction.
subs(ndS,[p,t],[pi/2,0]) ans = 3.0000 0 0.0000
Before we can evaluate the integral, we must evaluate F in terms of the parameters.
Fpar = subs(F,[x,y,z],ellipsoid) flux = symint2(realdot(Fpar,ndS),p,0,pi,t,0,2*pi) Fpar = [ 2*cos(t)*sin(p), 3*sin(p)*sin(t), cos(p)]
flux =
24*pi
Problem 2
Evaluate
where Sigma is the surface of Problem 1 and G is defined by the input line below.
G=[2*x,y,z -2] G = [ 2*x, y, z - 2]
We must now parametrize the solid ellipsoid. We can do this most easily by adding a radial factor r that takes values between 0 and 1. Note that since ellipsoid is a vector, all we have to do is "scalar multiply" it by r:
syms r solid = r*ellipsoid solid = [ 2*r*cos(t)*sin(p), 3*r*sin(p)*sin(t), r*cos(p)]
Recall that to integrate in the coordinates r, p, and t, we are going to have to insert a scale factor, the absolute value of the determinant of the Jacobian matrix of the change of variables. As we indicated is last week's lesson, it's usually easiest to leave off the absolute value at first, and then change the sign if the scale factor comes out negative.
That's clearly positive, and it's simple enough to make a symbolic integration feasible.
answer = int(symint2(3*scale,r,0,1,p,0,pi),t,0,2*pi) answer = 24*pi
This agrees with our calculation of the flux. The numerical value is:
double(24*pi) ans = 75.3982
Problem 3
With G and Sigma as in Problems 1 and 2, integrate the divergence of G over the solid region bounded above by Sigma and below by the xy-plane. Why is your answer not the same as the answer to Problem 2?
Additional Problems
1. Check the accuracy of the computation in Example 1 above by repeating the integration over the ellipsoid, using x and y as the parameters and solving for z as a function of x and y. (Hint: since there are two solutions for z, but the surface is symmetric, just integrate over the top half of the ellipsoid and then double the result.) 2. Let
both directly and by using the Divergence Theorem. 3. Let T be the torus with equation z^2 + (r-2)^2 = 1 in cylindrical coordinates. Parametrize the torus and use the answer to compute the surface area. 4. Let T be the same torus as in Additional Problem 3 just above. Compute the volume enclosed by the torus two ways: by triple integration, and by computing the flux of the vector field F = (x, y, z) through T and by using the Divergence Theorem. Check
that the results agree, and also that they agree with the prediction of Pappus's Theorem (see Ellis and Gulick): the volume of a solid obtained by rotating a region R in the xzplane around the z-axis is the area of R times the circumference of the circle traced out by the center of mass of R as it rotates around the z-axis.
Published with MATLAB 7.8
Helix
Here is a way to plot a helix on a cylinder. It will use a parametric description of the cylinder. The cylinder is a right circular cylinder of radius 1 centered on the z-axis. It is the set of all points of the form
I begin by making a 50x50 mesh of the points [U,V] I'll use in the graph.
u=linspace(0,2*pi,50); v=linspace(0,6*pi,50); [U,V]=meshgrid(u,v);
To be able to get a thick curve for the helix, I use the plot3 command. I plot the helix as a very thick curve and use the command surf to plot the cylinder. The command colormap white prevents shading of the cylinder.
t=linspace(0,6*pi,300); plot3(cos(t),sin(t),t, 'LineWidth' ,3), hold on title('Helix on a cylinder' ) surf(cos(U),sin(U),V), colormap white, hold off