CSC 431

We covered most of section 1.3
(with additional material from O'Leary and Goldberg's
paper on floating-point
arithmetic). We will finish it next week and start on chapter 2 (Linear
Systems). I suggest you refresh your matrix algebra, if you haven't seen
matrices in a while. For example, check out
SOS Math.

Check out Thomas Huckle's page on
software bugs. It
contains information on Ariane 5, the patriot missile failure and the Vancouver
stock market disaster.

We saw the following examples from Heath's book:

The web-page for the book also has lecture notes, errata, etc.

**Submission**: you can submit the homework by hardcopy
in class or by sending it to me as an email.

1. [Machine Precision, 10pt] Do Problem 1.42 on page 41 of the textbook.

2. [Forward and Backwards Error, 15pt] Do Exercise 1.6 on page 42 of the book.

3. [Machine epsilon, 15pt] Pick some programming system of your choice.

a) Determine the machine epsilon by finding for the smallest floating point number ε so that 1 + ε > 1.

b) Determine the machine epsilon by evaluating |3*(4/3-1)-1| (This might not work if your system truncates the answer. It works in Python.) Explain why this works on systems that do not truncate the answer.

c) What floating point format does your system use? *Hint*: most
likely it will be single precision or double precision.

4. [Improving formulas, 15pt] Consider the formula (a+b)/2 for computing the midpoint (average) of two floating point numbers a and b.

a) Show that there are numbers a and b for which this formula will give a bad
result even though a and b are machine representable floating point numbers. *
Hint*: the midpoint may end up lying outside the interval [a,b]

b) Consider the following two alternative formulas: (a/2)+(b/2) and a+(b-a)/2. Discuss whether these formulas are better/worse than the obvious formula (a+b)/2 in terms of accuracy. In particular, do they suffer from the problem you found in a)? Which formula would you use?

5. [Euler's e, 15pt] Do Exercise 1.4 on page 45 of the book.

6. [Multiplication versus repeated Addition, 15pt] Do Problem 1.6 on page 45 of the book.

Marcus Schaefer

Last updated: January 22nd, 2010.