21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Illustration of idea of Newton’s method for n = 2:<br />

✄<br />

Sought: intersection point x ∗ of the curves<br />

F 1 (x) = 0 and F 2 (x) = 0.<br />

Idea: x (k+1) = the intersection of two straight<br />

lines (= zero sets of the components of the<br />

model function, cf. Ex. 2.5.11) that are approximations<br />

of the original curves<br />

x 2<br />

F 2 (x) = 0<br />

˜F 1<br />

x ∗ (x) = 0<br />

F 1 (x) = 0<br />

x (k+1) x (k)<br />

˜F 2 (x) = 0<br />

x 1<br />

Code 3.4.2: Newton iteration in 2D<br />

1 F = @( x ) [ x ( 1 )^2−x ( 2 ) ^4; x ( 1 )−x ( 2 ) ^3 ] ;<br />

2 DF = @( x ) [2∗ x ( 1 ) , −4∗x ( 2 ) ^3; 1 , −3∗x ( 2 ) ^ 2 ] ;<br />

Realization of Newton iteration (3.4.1): 3 x = [ 0 . 7 ; 0 . 7 ] ; x_ast = [ 1 ; 1 ] ; t o l = 1E−10;<br />

4<br />

1. Solve LSE<br />

(<br />

2x1 −4x 3 )<br />

5 res = [ 0 , x ’ , norm( x−x_ast ) ] ;<br />

1 −3x 2 ∆x (k) 6 s = feval (DF, x ) \ feval ( F , x ) ; x = x−s ;<br />

=<br />

7 2<br />

res = [ res ; 1 ,x ’ , norm( x−x_ast ) ] ; k =2;<br />

(<br />

x 2<br />

− 1 − x 4 )<br />

8 while (norm( s ) > t o l ∗norm( x ) )<br />

2<br />

x 1 − x 3 9,<br />

s = DF( x ) \ F ( x ) ; x = x−s ;<br />

2<br />

where x (k) = (x 1 , x 2 ) T 10 res = [ res ; k , x ’ , norm( x−x_ast ) ] ;<br />

.<br />

11 k = k +1;<br />

2. Set x (k+1) = x (k) + ∆x (k) 12 end<br />

13<br />

14 l o g d i f f = d i f f ( log ( res ( : , 4 ) ) ) ;<br />

15 r a t e s = l o g d i f f ( 2 : end ) . / l o g d i f f ( 1 : end−1) ;<br />

Ôº¿¼½ ¿º<br />

Ôº¿¼¿ ¿º<br />

MATLAB template for Newton method:<br />

Solve linear system:<br />

A\b = A −1 b → Chapter 2<br />

F,DF: function handles<br />

A posteriori termination criterion<br />

MATLAB-CODE: Newton’s method<br />

function x = newton(x,F,DF,tol)<br />

for i=1:MAXIT<br />

s = DF(x) \ F(x);<br />

x = x-s;<br />

if (norm(s) < tol*norm(x))<br />

return; end;<br />

end<br />

k x (k) ǫ k := ‖x ∗ − x (k) ‖ 2<br />

0 (0.7, 0.7) T 4.24e-01<br />

1 (0.87850000000000, 1.064285714285714) T 1.37e-01<br />

2 (1.01815943274188, 1.00914882463936) T 2.03e-02<br />

3 (1.00023355916300, 1.00015913936075) T 2.83e-04<br />

4 (1.00000000583852, 1.00000002726552) T 2.79e-08<br />

5 (0.999999999999998, 1.000000000000000) T 2.11e-15<br />

6 (1, 1) T ✸<br />

Example 3.4.1 (Newton method in 2D).<br />

(<br />

x 2<br />

F(x) = 1 − x 4 )<br />

2<br />

x 1 − x 3 , x =<br />

2<br />

( x1<br />

x 2<br />

)<br />

Jacobian (analytic computation): DF(x) =<br />

(<br />

∈ R 2 1<br />

with solution F<br />

1)<br />

(<br />

∂x1 F 1 (x) ∂ x2 F 1 (x)<br />

∂ x1 F 2 (x) ∂ x2 F 2 (x)<br />

= 0 .<br />

) (<br />

2x1 −4x<br />

= 3 1 −3x 2 2<br />

)<br />

!<br />

New aspect for n ≫ 1 (compared to n = 1-dimensional case, section. 3.3.2.1):<br />

Computation of the Newton correction is eventually costly!<br />

Remark 3.4.3 (Affine invariance of Newton method).<br />

Ôº¿¼¾ ¿º<br />

An important property of the Newton iteration (3.4.1): affine invariance → [11, Sect .1.2.2]<br />

set G(x) := AF(x) with regular A ∈ R n,n so that F(x ∗ ) = 0 ⇔ G(x ∗ ) = 0 .<br />

✗<br />

✖<br />

affine invariance: Newton iteration for G(x) = 0 is the same for all regular A !<br />

✔<br />

✕<br />

Ôº¿¼ ¿º

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!