This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS205 Homework #1 Solutions Problem 1 Arithmetic operations are subject to roundoff error when performed on a finite precision computer. In order to perform an operation x op y on the real numbers x and y we deviate from the analytic result when discretizing those values to machine precision as well as when we store the resulting value. Let ¯ x denote the discretized, floating point version of x that is stored on the computer. You may assume that ¯ x = (1 + ) x where is bounded as 0 ≤   < max where max 1 is the machine roundoff precision. Assume that the result of the arithmetic operation between two floating point numbers ¯ x and ¯ y is computed exactly, but when stored on the computer it is once again subject to roundoff error as x op y = (1 + )( x op y ) where the roundoff error obeys the same bounds 0 ≤   < max . The relative error of a computation is defined as E = Computed Result Analytic Result Analytic Result Provide a bound (in terms of max ) for the relative error induced by the following arith metic operations, or prove that the relative error is unbounded. 1. Subtraction, Multiplication and Division of two real numbers (for an example on ad dition see Heath, section 1.3.8) 2. Computing the sum s n = x + x + ··· + x  {z } n terms using the recurrence s 1 = x s k = s k 1 + x [Answer: ≈ n max / 2] 3. Computing the sum s n = s 2 k = q k = x + x + ··· + x  {z } n =2 k terms where n = 2 k using the recurrence q = x q k = q k 1 + q k 1 For (2) and (3) you may assume for simplicity that n 1 / max . 1 Solution For the following derivation we use the lemma: If 0 ≤  1  ,  2  , . . . ,  k  < max then there exists an ∈ [0 , max ) such that (1 + 1 )(1 + 2 ) ··· (1 + k ) = (1 + ) k , which holds by virtue of the intermediate value theorem. For every variable i used in the following derivations we will implicity assume it lies within the range 0 ≤  i  < max ....
View
Full
Document
This homework help was uploaded on 01/29/2008 for the course CS 205A taught by Professor Fedkiw during the Fall '07 term at Stanford.
 Fall '07
 Fedkiw

Click to edit the document details