437/537 Homework #2

due at the beginning of class, Tuesday, Sep 18, 2006

Problems are from Sauer's book unless problem number starts with "X".

0.4

X1. [6 points] Estimate the maximum relative error involved in the floating point calculation of the quotient x/y of two numbers x and y which are not necessarily machine numbers. Your answer should be in terms of &epsilonmach.
You may find it useful to use Taylor approximations to get things out of the denominator. For example, 1/(1+&delta) = 1 - &delta + terms of quadratic and higher order in &delta. Recall &epsilonmach is a very small number (compared to 1).

1.2

X2. (a) [3 points] The functional iteration you did in HW1 with g(x) = cos(x) did converge to a fixed point of g, i.e. to a root of f(x) = cos(x) - x.
Evaluate g'(r) for that case and explain how this is consistent with Theorem 1.6.
(b) [1 point] The equation 4*x*(1-x) = x has a positive solution. What is it?
(c) [2 points] If you couldn't do (b) analytically, and tried iterating the function g(x) = 4*x*(1-x) to try to find the solution numerically, explain why Theorem 1.6 says you will be unsuccessful.
(d) [2 points] Run this code, hw2_ringland.m, and describe what actually happens when you iterate the function g in (b), starting with x0 = 0.4, for example.
(e) [1 point] What does the line starting "ia =" do? Note that the semi-colon (;) at the end of a line in Octave or Matlab suppresses the output. Remove the semi-colon to see the value of the evaluated expression.
(f) [1 point] What do the single-quotes (') do in the 3rd line from the bottom?
(g) [1 point] Observe that a PostScript graphics file has been produced by running the Octave code. How do you (i) view, (ii) print this file on the computer/operating system you're using?

1.4

2 (a) [4 points] (A few steps of Newton's method by hand.)

X3. GRADS ONLY, BUT UNDERGRADS CAN DO FOR EXTRA CREDIT.
( (a) 3 points, (b) 7 points )
(From Atkinson.) We want to create a method for calculating the square root of any (nonnegative) number, a, that uses a fixed number of Newton iterations. We can write
a = b * 2m
where m is an even integer and 1/4 <= b < 1. Then
sqrt(a) = sqrt(b) * 2m/2, 1/2 <= sqrt(b) < 1 .
Thus the problem reduces to calculating sqrt(b) for 1/4 <= b < 1. Use the linear interpolating formula
x0 = (2b+1)/3 for 1/4 <= b < 1
as an initial guess for Newton iteration to find sqrt(b).

(a) Bound the error sqrt(b)-x0.

(b) Estimate how many iterates are necessary in order that
0 <= | xi - sqrt(b) | <= 2-52
which is about the limit of IEEE double precision.

Hint for (b): Let f(x) = x2 - b. Write Taylor's theorem with the remainder at quadratic order, expanding at xi and evaluating at sqrt(b). I.e. f(sqrt(b)) (which = 0 ) = f(xi) + (sqrt(b)-xi) f'(xi) + R2. Use this to get a relationship between the error at step i and the error at step i+1.