* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Intro to Numerical Methods
Survey
Document related concepts
Transcript
Intro to Numerical Methods APAM E4300 (1) ASSIGNMENT 2 – SOLUTIONS (ROUNDOFF AND TRUNCATION ERRORS) Due: Tuesday, February 26, 2013 Problem 1 [9 points]: 1. Write down the IEEE double precision representation for the following decimal numbers: a. 1.5, using round up. b. 5.1, using round to nearest. c. – 5.1, using round towards zero. d. – 5.1, using round down. 2. Write down the IEEE double precision representation for the decimal number 50.2, using round to nearest. 3. What is the gap between 2 and the next larger double precision number? Solution: Problem 2 [9 points]: Describe an algorithm to compare two double precision floating point numbers a and b to determine whether a < b, a = b, or a > b, by comparing each of their bits from left to right, stopping as soon as a differing bit is encountered. Solution: Problem 3 [8 points]: Consider a very limited system in which significands are only of the form 1. and the only exponents are 0, 1, and – 1. What is the machine precision for this system? Assuming that subnormal numbers are not used, what is the smallest positive number that can be represented in this system, and what is the largest number that can be represented? Express your answers in decimal form. Solution: Problem 4 [9 points]: Using Taylor series, derive the error term for the approximation 1 3 4 2. 2 Solution: Problem 5 [10 points]: Consider a forward difference approximation for the second derivative of the form 2. Use Taylor’s theorem to determine the coefficients A, B, and C that give the maximal order of accuracy and determine what this order is. Solution: