Homework 6  Due Wed. Oct. 11th
Math 224  Fall 2011
Dr. Mauro Maggioni
Office hours
: Tue 45, in office 293 Physics Bldg.
Phone
: 6602825
Web page
: www.math.duke.edu/˜ mauro
Email
: mauro.maggioni
at
duke.edu
Homework policies
: as in homework 1. All the materials (code, figures, etc...) have to be turned in (as
printouts!) with your homework, or the homework will not be graded.
Assignment
Study Lectures 15,16 in the book.
Exercises
These exercises are taken/adapted from Heath’s book “Scientific Computing”:
1
. Write a program to compute the absolute and relative errors in Stirling’s approximation
n
!
≈
√
2
πn
(
n/e
)
n
for
n
= 1
, . . . ,
10. Does the absolute error grow or shrink as
n
increases? Does the relative error grow
or shrink as
n
increases?
2
.
In most floatingpoint systems, a quick approximation to the unit roundoff can be obtained by
evaluating the expression
ǫ
machine
≈ 
3
*
(4
/
3

1)

1

.
(a) Explain why this trick works.
(b) Try it in both double and single precision (if you are using Matlab, see help for
single
).
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Layton,A
 Math, Numerical Analysis, Summation, Equally Spaced Points, single precision, Dr. Mauro Maggioni, relative error grow

Click to edit the document details