Docsity

Computer Assignment 3 - Multivariable Calculus | MATH 340, Assignments of Calculus

Toggle sidebar
bg1
MATH 340 Sec. 0101
Computer Assignment 3: MATH 340, Fall 2008
Due Monday, November 24
You may work in groups of up to three people. Each group must submit a single printed solution. Solutions must
contain your relevant MATLAB input and output (do not include commands that didn’t work), and text that indicates
what your commands are doing and interprets your results. (You may find one of the following commands useful in
preparing your solutions: publish,notebook, or diary; see MATLAB’s online help for details.) Organization
and clarity count.
.................................................................................................
The MATLAB command dblquad numerically approximates a double integral over a rectangle. Simi-
larly, triplequadapproximates a triple integral over a box. In this assignment, we’ll use these commands
on integrals for which we know the correct answer, in order to assess their accuracy. In particular, for re-
gions of integration that are not rectangular, we’ll compare two approaches for numerical integration: one
is to define the function to be zero outside the region of integration (like in the definition of double and
triple integrals by Riemann sums), and the other is to make a change of coordinates so that the region of
integration is rectangular in the newcoordinates.
(a) Find the double integral of x2over the unit disk x2+y2≤1in R2by writing it as an it-
erated integral and using the MATLAB command int. Compare this exact answer with the
approximate answers found by dblquad, first using rectangular coordinates and then using
polar coordinates.
To do the integral in rectangular coordinates, use a command similar to last sample command in
the the last example in the online help for dblquad.
Then rewrite the integral in polar coordinates and use dblquad to approximate that integral.
In each case, observe how long it takes the command to run and how accurate the answer is.
How does the accuracy compare to the intended error tolerance of 10āˆ’6?
(b) Now use triplequad to approximate the volume of the unit ball x2+y2+z2≤1in R3,
using both rectangular and spherical coordinates. In each case, adjust the error tolerance (see the
online help) in order to see how many digits of accuracy you can get using at most 60 seconds
of computation time.
(c) Based on your results, discuss the relative merits of the two approaches to numerical integration
over a nonrectangular region. Why do the two approaches produce such different results?
Fall 2008 1 B. Hunt

Partial preview of the text

Download Computer Assignment 3 - Multivariable Calculus | MATH 340 and more Assignments Calculus in PDF only on Docsity!

MATH 340 Sec. 0101

Computer Assignment 3: MATH 340, Fall 2008

Due Monday, November 24

You may work in groups of up to three people. Each group must submit a single printed solution. Solutions must contain your relevant MATLAB input and output (do not include commands that didn’t work), and text that indicates what your commands are doing and interprets your results. (You may find one of the following commands useful in preparing your solutions: publish, notebook, or diary; see MATLAB’s online help for details.) Organization and clarity count.

................................................................................................. The MATLAB command dblquad numerically approximates a double integral over a rectangle. Simi- larly, triplequad approximates a triple integral over a box. In this assignment, we’ll use these commands on integrals for which we know the correct answer, in order to assess their accuracy. In particular, for re- gions of integration that are not rectangular, we’ll compare two approaches for numerical integration: one is to define the function to be zero outside the region of integration (like in the definition of double and triple integrals by Riemann sums), and the other is to make a change of coordinates so that the region of integration is rectangular in the new coordinates.

(a) Find the double integral of x^2 over the unit disk x^2 + y^2 ≤ 1 in R^2 by writing it as an it- erated integral and using the MATLAB command int. Compare this exact answer with the approximate answers found by dblquad, first using rectangular coordinates and then using polar coordinates. To do the integral in rectangular coordinates, use a command similar to last sample command in the the last example in the online help for dblquad. Then rewrite the integral in polar coordinates and use dblquad to approximate that integral. In each case, observe how long it takes the command to run and how accurate the answer is. How does the accuracy compare to the intended error tolerance of 10 āˆ’^6? (b) Now use triplequad to approximate the volume of the unit ball x^2 + y^2 + z^2 ≤ 1 in R^3 , using both rectangular and spherical coordinates. In each case, adjust the error tolerance (see the online help) in order to see how many digits of accuracy you can get using at most 60 seconds of computation time. (c) Based on your results, discuss the relative merits of the two approaches to numerical integration over a nonrectangular region. Why do the two approaches produce such different results?

Fall 2008 1 B. Hunt