Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Numerical Methods Contents - SAM
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
MATLAB-CODE: <strong>Numerical</strong> differentiation of exp(x)<br />
log 10 (h) relative error<br />
h = 0.1; x = 0.0;<br />
-1 0.05170918075648<br />
for i = 1:16<br />
-2 0.00501670841679<br />
-3 0.00050016670838<br />
df = (exp(x+h)-exp(x)) /h;<br />
-4 0.00005000166714<br />
-5 0.00000500000696<br />
fprintf(’%d %16.14f\n’,i,df-1);<br />
-6 0.00000049996218<br />
h = h*0.1;<br />
-7 0.00000004943368<br />
end<br />
-8 -0.00000000607747<br />
-9 0.00000008274037<br />
Obvious cancellation → error amplification<br />
-10 0.00000008274037<br />
-11 0.00000008274037<br />
⎫<br />
-12 0.00008890058234<br />
f ′ f(x + h) − f(x) ⎬<br />
-13 -0.00079927783736<br />
(x) − → 0<br />
h<br />
Impact of roundoff → ∞ ⎭ for h → 0 . -14 -0.00079927783736<br />
-15 0.11022302462516<br />
-16 -1.00000000000000<br />
What is this mysterious cancellation (ger.: Auslöschung) ?<br />
errors<br />
Cancellation<br />
ˆ=<br />
Subtraction of almost equal numbers<br />
(➤ extreme amplification of relative errors)<br />
Example 3.4.8 (cancellation in decimal floating point arithmetic).<br />
x, y afflicted with relative errors ≈ 10 −7 :<br />
Analysis for f(x) = exp(x):<br />
x = 0.123467∗<br />
← 7th digit perturbed<br />
y = 0.123456∗<br />
← 7th digit perturbed<br />
x − y = 0.000011∗ = 0.11∗000 · 10 −4 ← 3rd digit perturbed<br />
Ôº¿¼ ¿º<br />
padded zeroes<br />
Ôº¿½½ ¿º<br />
✸<br />
3.4.2 Convergence of Newton’s method<br />
⇒<br />
e x+h (1 + δ 1 ) − e x (1 + δ 2 )<br />
df =<br />
( h )<br />
= e x e h − 1<br />
+ δ 1e h − δ 2<br />
(<br />
h h<br />
)<br />
|df| ≤ e x e h −1<br />
h +eps 1+eh<br />
h<br />
correction factors take into account roundoff:<br />
(→ "‘axiom of roundoff analysis”, Ass. 2.4.2)<br />
|δ 1 |, |δ 2 | ≤ eps .<br />
1 + O(h) O(h −1 ) für h → 0<br />
Newton iteration (3.4.1) ˆ= fixed point iteration (→ Sect. 3.2) with<br />
Φ(x) = x − DF(x) −1 F(x) .<br />
[“product rule” : DΦ(x) = I − D(DF(x) −1 )F(x) − DF(x) −1 DF(x) ]<br />
F(x ∗ ) = 0 ⇒ DΦ(x ∗ ) = 0 .<br />
relative error:<br />
e x ∣<br />
−df ∣∣∣<br />
∣ e x ≈ h + 2eps<br />
h → min for h = √ 2eps .<br />
√<br />
In double precision: 2eps = 2.107342425544702 · 10 −8<br />
Lemma 3.2.7 suggests conjecture:<br />
Local quadratic convergence of Newton’s method, if DF(x ∗ ) regular<br />
Example 3.4.9 (Convergence of Newton’s method).<br />
✸<br />
Ôº¿½¼ ¿º<br />
Ex. 3.4.1 cnt’d: record of iteration errors, see Code 3.4.1:<br />
Ôº¿½¾ ¿º