{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

zeros - Chapter 4 Zeros and Roots This chapter describes...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 4 Zeros and Roots This chapter describes several basic methods for computing zeros of functions and then combines three of the basic methods into a fast, reliable algorithm known as zeroin ’. 4.1 Bisection Let’s compute 2. We will use interval bisection , which is a kind of systematic trial and error. We know that 2 is between 1 and 2. Try x = 1 1 2 . Because x 2 is greater than 2, this x is too big. Try x = 1 1 4 . Because x 2 is less than 2, this x is too small. Continuing in this way, our approximations to 2 are 1 1 2 , 1 1 4 , 1 3 8 , 1 5 16 , 1 13 32 , 1 27 64 , . . . . Here is a Matlab program, including a step counter. M = 2 a = 1 b = 2 k = 0; while b-a > eps x = (a + b)/2; if x^2 > M b = x else a = x end k = k + 1; end February 15, 2008 1
Image of page 1

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

View Full Document Right Arrow Icon
2 Chapter 4. Zeros and Roots We are sure that 2 is in the initial interval [a,b] . This interval is repeatedly cut in half and always brackets the answer. The entire process requires 52 steps. Here are the first few and the last few values. b = 1.50000000000000 a = 1.25000000000000 a = 1.37500000000000 b = 1.43750000000000 a = 1.40625000000000 b = 1.42187500000000 a = 1.41406250000000 b = 1.41796875000000 b = 1.41601562500000 b = 1.41503906250000 b = 1.41455078125000 ..... b = 1.41421356237311 a = 1.41421356237299 a = 1.41421356237305 a = 1.41421356237308 a = 1.41421356237309 b = 1.41421356237310 b = 1.41421356237310 Using format hex , here are the final values of a and b . a = 3ff6a09e667f3bcc b = 3ff6a09e667f3bcd They agree up to the last bit. We haven’t actually computed 2, which is irrational and cannot be represented in floating point. But we have found two successive floating-point numbers, one on either side of the theoretical result. We’ve come as close as we can using floating-point arithmetic. The process takes 52 steps because there are 52 bits in the fraction of an IEEE double-precision number. Each step decreases the interval length by about one bit. Interval bisection is a slow but sure algorithm for finding a zero of f ( x ), a real-valued function of a real variable. All we assume about the function f ( x ) is that we can write a Matlab program that evaluates it for any x . We also assume that we know an interval [ a, b ] on which f ( x ) changes sign. If f ( x ) is actually a continuous mathematical function, then there must be a point x somewhere in the interval where f ( x ) = 0. But the notion of continuity does not strictly apply to floating-point computation. We might not be able to actually find a point where f ( x ) is exactly zero. Our goal is as follows: Find a very small interval, perhaps two successive floating-point num- bers, on which the function changes sign. The Matlab code for bisection is
Image of page 2
4.2. Newton’s Method 3 k = 0; while abs(b-a) > eps*abs(b) x = (a + b)/2; if sign(f(x)) == sign(f(b)) b = x; else a = x; end k = k + 1; end Bisection is slow. With the termination condition in the above code, it always takes 52 steps for any function. But it is completely reliable. If we can find a starting interval with a change of sign, then bisection cannot fail to reduce that interval to two successive floating-point numbers that bracket the desired result.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern