# HOMEWORK #5:TRIPLE INTEGRALS, DIVERGENCE THEOREM

```Engineering Mathematics IV (MATH 2ZZ3) — Winter 2012
1
HOMEWORK #5:TRIPLE INTEGRALS,
DIVERGENCE THEOREM AND THE HEAT
EQUATION.
Due: Monday, April 1 by midnight
Instructions:
• The assignment consists of two questions.
name as indicated on the course website; the file containing your assignment must be
named Name XXXXXXX hwN.m, where “Name” is your last name, “XXXXXXX” is your
student ID number, and “N” is the consecutive number of the assignment; hardcopy
submissions will not be accepted.
• It is obligatory to use the MATLAB template file available at
http://www.math.mcmaster.ca/gabardo/M2ZZ3/frames/template.m; submissions
non compliant with this template will not be accepted.
• Make sure to enter your name and student I.D. number in the appropriate section of
the template.
• Late submissions and submissions which do not comply with these guidelines will not
be accepted.
• All graphs should contain suitable titles and legends.
• Reference:
1. ”Numerical Mathematics” by M. Grasselli and D. Pelinovsky (Jones and
Bartlett, 2008), sections 7.7–7.8.
2. ”Advanced Engineering Mathematics” by D.G. Zill and W.S. Wright
(Jones and Bartlett, 4th edition), sections 9.15, 9.16, 13.3
In this assignment the letters a, b, c, d will denote the LAST four digits of your student
ID number.
(For example, if you student ID number is 1234567, then a = 4, b = 5, c = 6 and d = 7.)
1. [10] Let r = a + 1, s = b + 1 and t = c + 1.
2
2
2
Consider the solid region V inside the ellipsoid xr2 + ys2 + zt2 = 1 and let S be its
boundary surface, oriented using the outward pointing normal. Let F be the vector
field
F(x, y, z) = x2 y z 3 i + x2 y j + x y z k.
(a) Use Matlab to compute the flux of F through S directly (i.e. without using the
divergence theorem). Note that the point (x0 , y 0 , z 0 ), where x0 = x/r, y 0 = y/s
and z 0 = z/t lies on a sphere of radius 1 centered at the origin if (x, y, z) lies
on the ellipsoid. Use this fact as well as spherical coordinates to parametrize the
ellipsoid above. Use the Matlab function dblquad to evaluate numerically the
Engineering Mathematics IV (MATH 2ZZ3) — Winter 2012
2
(b) Compute numerically the flux of F through S using the divergence theorem with
the help of the Matlab command triplequad. Set up the integral as a triple
integral in the cartesian coordinate x, y, z (Note that the hint given for Assignment
(c) Use Matlab to plot a picture of S and of its units normals (pointing outward) at
the points where the vertical straight lines through the points
(x, y, z) = (r/2, 0, 0), (−r/2, 0, 0), (0, s/2, 0), (0, −s/2, 0)
intersect the surface S. The graph should appear as Figure1.
2. [10] In this problem k = 1 + d/10 and the function f (x) is defined for 0 < x < π by


a,
f (x) = b,


c,
0 < x < π4 ,
π
π
4 < x < 2,
π
2 < x < π.
(a) Consider the heat equation where the endpoints are kept at zero temperature:

∂u
∂2u


= k 2 , 0 < x < π, t > 0,

∂t
∂x
u(0, t) = u(π, t) = 0, t > 0



u(x, 0) = f (x), 0 < x < π.
Use the Matlab function quad to compute the first 100 sine Fourier coefficients
bn of the function f (x) on the interval (0, π). Plot the function f (x) as well as
the solution u(x, t) (as a function of x) for t = m(0.5), m = 1, 2, . . . , 6, on the
same graph using a subdivision obtained by dividing the interval [0, π] into 100
subintervals. To plot u(x, t), use the approximation obtained by taking only the
first 100 terms of the series solution for u(x, t). The graph should appear as
Figure2.
(b) Consider the heat equation where the endpoints are now insulated:

∂u
∂2u


= k 2 , 0 < x < π, t > 0,

∂t
∂x
∂u
∂u
 ∂x (0, t) = ∂x (π, t) = 0, t > 0


u(x, 0) = f (x), 0 < x < π.
Use the Matlab function quad to compute the first 101 cosine Fourier coefficients
an , 0 ≤ n ≤ 100, of the function f (x) on the interval (0, π). Plot the function f (x)
as well as the solution u(x, t) (as a function of x) for t = m(0.2), m = 1, 2, . . . , 5,
on the same graph using a subdivision obtained by dividing the interval [0, π] into
100 subintervals. To plot u(x, t), use the approximation obtained by taking only
the first 101 terms of the series solution for u(x, t). The graph should appear as
Figure3.
```