Docsity

Numerical Analysis - Error Analysis - Lecture Notes | MATH 475A, Study notes of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Chapter 1. Error Analysis
1.1 Computer Arithmetic
1.1.1 Floating Point Numbers
•
±0.d1d2. . . dp×10n,
where 0 ≤di≤9 for all iand, in particular, d1>0
•underflow and overflow
•p-digit rounding fl(x):
%round number x to normalized p-digit form
function x=fl(x,p)
if x~=0
deci=ceil(log10(abs(x)));
x=round(x*10^(p-deci))*10^(deci-p);
end
1.1.2 Roundoff Errors
•absolute and relative errors: letting x∗be an approximation to x, then
absolute error : |x−x∗|
relative error : ¯¯¯¯
x−x∗
x¯¯¯¯
,where x6= 0
•with p-digit rounding,
¯¯¯¯¯
x−fl(x)
x¯¯¯¯¯
≤0.5×10−p+1
•issue of cancellation: for example,
(a) 0.123x2+ 4.51x+ 0.103 = 0 with 3-digit rounding
(b) 1−cos x
x2over −5×10−8≤x≤5×10−8
1
pf2

Partial preview of the text

Download Numerical Analysis - Error Analysis - Lecture Notes | MATH 475A and more Study notes Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Chapter 1. Error Analysis

1.1 Computer Arithmetic

1.1.1 Floating Point Numbers

  • ± 0 .d 1 d 2... dp × 10 n, where 0 ≤ di ≤ 9 for all i and, in particular, d 1 > 0
  • underflow and overflow
  • p-digit rounding f l(x):

%round number x to normalized p-digit form function x=fl(x,p) if x~= deci=ceil(log10(abs(x))); x=round(x10^(p-deci))10^(deci-p); end

1.1.2 Roundoff Errors

  • absolute and relative errors: letting x∗^ be an approximation to x, then

absolute error : |x − x∗|

relative error :

∣∣ ∣∣^ x^ −^ x

∗ x

∣∣ ∣∣ , where x 6 = 0

  • with p-digit rounding, ∣∣ ∣∣ ∣

x − f l(x) x

∣∣ ∣∣ ∣ ≤^0.^5 ×^10

−p+

  • issue of cancellation: for example,

(a) 0. 123 x^2 + 4. 51 x + 0.103 = 0 with 3-digit rounding (b) 1 − cos x x^2 over − 5 × 10 −^8 ≤ x ≤ 5 × 10 −^8

1.2 Convergence

Suppose that {xn}∞ n=0 converges to x.

  • rate of convergence: for example,

(a) π = 4

[ 1 −

(−1)n 2 n + 1

]

(b) π = 4

( tan−^1

  • tan−^1

) , together with

tan−^1 x = x − x^3 3

x^5 5

x^7 7

(−1)nx^2 n+ 2 n + 1 +... , − 1 < x ≤ 1

  • big O notation
  • common stopping criteria:

|xn+1 − xn| < tol or (^) ∣∣ ∣∣^ xn+1^ −^ xn xn

∣∣ ∣∣ < tol;

for example, golden ratio again

1.3 Roundoff Error Growth

  • stable case: for example, with 5-digit rounding,

xn = 2xn− 1 − xn− 2 , n ≥ 2 , x 0 = 1, x 1 =

noting that the exact solution is

xn = 1 − 2 n 3

  • unstable case: for example, with 5-digit rounding,

xn =

xn− 1 − xn− 2 , n ≥ 2 , x 0 = 1, x 1 =

noting that the exact solution is

xn =

3 n