hw1_solutions

# Scientific Computing

• Homework Help
• PresidentHackerCaribou10582
• 6
• 100% (1) 1 out of 1 people found this document helpful

This preview shows pages 1–3. Sign up to view the full content.

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 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 n =2 k terms where n = 2 k using the recurrence q 0 = x q k = q k - 1 + q k - 1 For (2) and (3) you may assume for simplicity that n 1 / max . 1

This preview has intentionally blurred sections. Sign up to view the full version.

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 .
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern