































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
































Floating Points, Rootfinding
L. Olson
Department of Computer Science University of Illinois at Urbana-Champaign
September 6, 2006
Adding c = a + b will result in a large error if a b a b Let
a = x.xxx · · · × 100 b = y.yyy · · · × 10 −^8
Then
︷ finite precision︸︸ ︷ x.xxx xxxx xxxx xxxx
addition: c = a + b if a b or a b subtraction: c = a − b if a ≈ b catastrophic: caused by a single operation, not by an accumulation of errors can often be fixed by mathematical rearrangement
x = 0 .37214 48693 and y = 0 .37202 14371. What is the relative error in x − y in a computer with 5 decimal digits of accuracy? |x − y − (x¯ − ¯y)| |x − y|
Consider x = 37. 593621 and y = 37. 584216.
2 −^11 < 1 − y x
So we lose 11 or 12 bits in the computation of x − y. yikes!
Back to the other example (5 digits): x = 0. 37214 and y = 0. 37202.
10 −^4 < 1 − y x
So we lose 4 or 5 bits in the computation of x − y. Here, x − y = 0. 00012 which
has only 1 significant digit that we can be sure about
So what to do? Mainly rearrangement.
f (x) =
x^2 + 1 − 1
Problem at x ≈ 0. One type of fix:
f (x) =
x^2 + 1 − 1
) (^ √x (^2) + 1 + 1 √ x^2 + 1 + 1
= x
2 √ x^2 + 1 + 1 no subtraction!
Then the function can be expressed as the nth^ Taylor Series approximation and a truncation error:
f (x) = fn(x) + Rn(x)
= f (x 0 ) + (x − x 0 ) df dx |x=x^0 +
(x − x 0 )^2 2
d^2 f dx^2 |x=x^0 +^ · · ·^ +
(x − x 0 )n n!
dnf ︸ ︷︷ dxn^ |x=x︸^0 fn(x)
n+ 1 (n + 1 )!
dn+^1 f dxn+^1 |x=ξ ︸ ︷︷ ︸ Rn(x)
Since d n+ (^1) f dxn+^1 is continuous on^ [a,^ b]^ it is bounded, so
Rn(x) = O( (x^ −^ x^0 )
(n+ 1 ) (n + 1 )! ) = O(hn+^1 )
We say that the truncation error is of ”order n + 1 ”
Questions: (^1) how fast does the approximation converge? (^2) how expensive is it to compute the approximation? (later)
Convergence rate
Let {yn}∞ n= 1 be a sequence:
y 0 , y 1 , y 2 ,... , yj,...
If α and K exist so that |y − yn| 6 K nα Then we say that {yn} converges to y with rate of convergence (^) n^1 α So we expect |en| = |y − yn| ≈ c (^) n^1 α
Then |en+ 1 | |en| ≈^ constant In general, a sequence is said to converge with rate r if
k^ lim→∞
|en+ 1 | |en|r^ =^ C
If r = 1 and C < 1 , then the rate is linear If r > 1 , then the rate is superlinear If r = 2 and C < 1 , then the rate is quadratic If r = 3 and C < 1 , then the rate is cubic
We need to study some iterations. iteratively finding a root to an equation iteratively finding the solution to an algebraic system iteratively finding solutions to Ordinary Differential Equations (ODEs) ...
Courtesy of G. Wright
Consider a planet in orbit around the sun ω is the frequency of orbit t is the time since the planet was last closest to the sun (perifocus) e =
1 − b a^22 is the eccentricity of the orbit Kepler’s Law say the location of the planet at time is
x = a(cos E − e) y = a
1 − e^2 sin E
E = ωt + e sin E is the eccentric anomaly cannot explicitly express E
Given a function f (x), find x so that f (x) = 0
Goals: Find roots to equations Compare usability of different methods Compare convergence properties of different methods (^1) bracketing methods (^2) Bisection Method (^3) Newton’s Method (^4) Secant Method (^5) (opt) fixed point iterations (^6) (opt) special Case: Roots of Polynomials