Module Five - Multiple Integration
MAT325: Calculus III: Multivariable Calculus
Student Name
Date
Introduction:
Module Five builds on one-dimensional integration by introducing double and triple integrals for functions of two
and three variables, respectively. Double and triple integrals in rectangular, cylindrical, and spherical coordinate
system are studied, and general approaches to change of variables in multiple integrals is presented.
In this MATLAB assignment, you'll learn how to evaluate double and triple integrals in various coordinate
systems.
Review the code and comments provided in the "Examples" section below, and then use this information to
complete the problems listed in the "Problems" section.
Make sure to run your code so all relevant computations/results are displayed, delete the "Introduction" and
"Examples" sections, and then export your work as a PDF file for submission (your submission only needs to
contain the "Problems" section that you completed).
Examples:
Example 1 - Double Integral in Rectangular Coordinates
In this example, we'll compute the integral .
% Example 1 Code - Double Integral in Rectangular Coordinates
% Clear the workspace
clear all;
% To perform double-integration over a rectangular region, it is usually
% helpful to define x and y as symbolic variables
syms x y;
% Define the function the function handle for f(x,y)
f = @(x,y) x.*y;
% The integral2() function can be used to evaluate double integrals
1
% For the rectangular region be [0,4] X [0,5] we have:
format long;
xMin = 0;
xMax = 4;
yMin = 0;
yMax = 5;
integral2(f,0,4,0,5)
ans =
100
We can verify the integral2() results manually be computing:
Example 2 - Double Integral in Polar Coordinates
Consider the integral where R is a circle of radius 2 in the xy-plane. For this circular region, we
can describe R as the set of points , where . Thus, the integral to evaluate is
.
For calling the integral2() function in MATLAB, we must define an integral using variables x and y. We can
re-write the integral above by making the substitutions , , resulting in the integral:
We are now ready to use integral2() to compute the numerical value of this integral.
% Example 2 Code - Double Integral in Polar Coordinates
% Clear the workspace
clear all;
%setup the function
clear all;
f = @(x,y) (1+y.^2).*y;
%setup limits of integration
xmin = 0;
xmax = 2*pi;
ymin = 0;
ymax = 2;
%compute the integral
format long;
integral2(f,xmin,xmax,ymin,ymax,'Method','tiled')
2
ans =
37.699111843085738
Example 3 - Triple Integral in Spherical Coordinates
Consider the integral in spherical coordinates .
The region of integration can be visualized numerically using meshgrid() and the trisurf() function.
%setup a rectangular grid
x = linspace(-1,1,50);
y = linspace(-1,1,50);
z = linspace(-1,1,50);
[X,Y,Z] = meshgrid(x,y,z);
%convert to a spherical grid
rho = sqrt(X.^2 + Y.^2 + Z.^2);
theta = atan(Y./X);
phi = atan(sqrt(X.^2 + Y.^2)./Z);
%find the indices that satisfy the integral limits
plotInd = (phi>=0 & phi<=pi/4) & (rho>=0 & rho<=cos(phi));
%plot the surface using the trisurf function()
figure;
K1 = convhull(X(plotInd),Y(plotInd),Z(plotInd));
trisurf(K1,X(plotInd),Y(plotInd),Z(plotInd),'Facecolor','cyan');
xlim([-1 1]);
ylim([-1 1]);
xlabel('x');
ylabel('y');
zlabel('z');
3
The integral can be evaluated using the integral3() function. Note that the limits on are a function of , so an
additional function handle is needed to define those integral limits.
For calling the integral3() function in MATLAB, we must define an integral using variables , and z. We can
re-write the integral above by making the substitutions , and . The resulting integral is:
We are now ready to use integral3() to compute the numerical value of this integral.
%setup the function
clear all;
f = @(x,y,z) (z.^2.*sin(y));
%setup limits of integration
xmin = 0;
xmax = 2*pi;
ymin = 0;
ymax = pi/4;
zmin = 0;
zmax = @(x,y) cos(y); % Note: This function handle define the upper limits
on z as a function of variable y
%compute the integral
4
format long;
integral3(f,xmin,xmax,ymin,ymax,zmin,zmax,'Method','tiled')
ans =
0.392699081696143
Problems:
Problem 1: Use MATLAB and the integral2() function to evaluate the integral of the
function over the rectangular region .
% Problem 1 Code Here
Problem 2: Use MATLAB and the integral2() function to evaluate the integral
over the region .
Put your math/explanation here...
% Problem 2 Code Here
Problem 3: Use MATLAB and the integral3() function to evaluate the integral
. Use the trisurf() function to visualize the region of
integration over the rectangular region .
Put your math/explanation here...
% Problem 3 Code Here