Download Numerical Analysis: Computer Arithmetic and Root Finding Algorithms - Prof. Erin K. Mcneli and more Study notes Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity! MATH 441/541 - Numerical Analysis Second Meeting: Computer Arithmetic Continued & Root Finding Algorithms Thursday, August 30th, 2007 1 Preliminary Material (Continued) • Internal Number Representation 1. Bases (Binary, Decimal, Hexidecimal, Converting) 2. Computer (Floating-Point) Representation of Numbers (IEEE Standard) – BINARY y = (−1)s 2(c−shift) (1 + f) where s = sign bit c− shift = shifted exponent (characteristic) f = fractional part (mantissa) with double precision-floating point numbers using 64 bit representation: 1 bit for sign, s 11 bits for exponent, c 52 bits for fraction, f (a) The number of numbers we can represent exactly. (b) The range of the numbers we can represent. (c) Plotting computer numbers (to see the meshing pattern). (d) Determining the pattern: i. Increasing/decreasing number of bits for c =⇒ ? ii. Increasing/decreasing number of bits for f =⇒ ? (e) Definitions: i. Underflow ii. Overflow iii. Machine Epsilon, iv. Unit Roundoff, u 3. Normalized k-Digit DECIMAL Floating-Point Representation of Numbers ± 0.d1d2d3 · · · dk × 10n, d1 6= 0, di ∈ {0, 1, · · · , 9} (a) Rounding vs. Chopping (b) Absolute and Relative Error (c) Significant Digits • Computer Arithmetic 1. Definition of fl(x), floating-point representation of x: fl(x) = x (1 + δ), where |δ| < u (unit roundoff) 2. Operations: ⊕, ,⊗,÷© 3. Stable Operations (proving or disproving) 4. Handout on Computations to Be Wary Of • Rates of Convergence and Terminology 1. {αn} → α with a rate of convergence O(βn) 2 Root Finding (i.e. Solving Nonlinear Equations) in One Variable • Introductory Thoughts: 1. How are root finding and solving nonlinear equations the same thing? 2. What are the challenges to doing this analytically? • Section 2.1: The Bisection Method (a.k.a. the Binary Search Method) 1. The Problem: – Given: Suppose you have a continuous function f defined on [a, b] with f(a) and f(b) having opposite signs. – Some Conclusions: The Intermediate Value Theorem guarantees that f has at least one root on [a, b], call it p. – The Big Question: How do you go about finding the root p given this information and the formula for f? 2. “Bracketing the Root”: 3. The Process and A Picture: 4. The Bisection Method Algorithm: OBJECTIVE: Given the continuous function f on the interval [a, b] where f(a) and f(b) have opposite signs, find a solution to f(x) = 0. INPUT: endpoints a and b; tolerance TOL; maximum number of iterations N (and f). OUTPUT: approximate solution p or message of failure. 5. Other Possible Stopping Criteria: 6. Convergence Issues: – Will it converge? – How fast will it converge? – Example: The equation x cos(x) = 3 + 8x − x3 has a solution on the interval [2, 5]. How many iterations will you need, at most, to find the solution with an accuracy of 10−4? 7. Strengths and Weaknesses of the Bisection Method: