06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 2. SOLUTIONS OF EQUATIONS: ROOT-FINDING 80<br />

for g will not be helpful, s<strong>in</strong>ce g does not satisfy the first condition of Theorem<br />

40: g(x) /∈ [1, 3] for all x ∈ [1, 3] (g(3) = −5 /∈ [1, 3]).<br />

(b) S<strong>in</strong>ce p is a root for f, we have p 3 =2p 2 +1,orp =(2p 2 +1) 1/3 . Therefore, p is<br />

the solution to the fixed-po<strong>in</strong>t problem g(x) =x where g(x) =(2x 2 +1) 1/3 .<br />

• g is <strong>in</strong>creas<strong>in</strong>g on [1, 3] and g(1) = 1.44,g(3) = 2.67, thusg(x) ∈ [1, 3] for all<br />

x ∈ [1, 3]. Therefore, g satisfies the first condition of Theorem 40.<br />

• g ′ 4x<br />

(x) = and g ′ (1) = 0.64,g ′ (3) = 0.56 and g ′ is decreas<strong>in</strong>g on [1, 3].<br />

3(2x 2 +1) 2/3<br />

Therefore g satisfies the condition <strong>in</strong> Remark 41 <strong>with</strong> λ =0.64.<br />

Then, from Theorem 40 and Remark 41, the fixed-po<strong>in</strong>t iteration converges if<br />

g(x) =(2x 2 +1) 1/3 .<br />

2. Take λ = k =0.64 <strong>in</strong> Corollary 42 and use bound (4):<br />

|p − p n |≤(0.64) n max{1 − 1, 3 − 1} =2(0.64 n ).<br />

We want 2(0.64 n ) < 10 −4 , which implies n log 0.64 < −4 log 10 − log 2, or n ><br />

−4 log 10−log 2<br />

log 0.64<br />

≈ 22.19. Therefore n =23is the smallest number of iterations that ensures<br />

an absolute error of 10 −4 .<br />

<strong>Julia</strong> code for fixed-po<strong>in</strong>t iteration<br />

The follow<strong>in</strong>g code starts <strong>with</strong> the <strong>in</strong>itial guess p 0 (pzero <strong>in</strong> the code), computes p 1 = g(p 0 ),<br />

and checks if the stopp<strong>in</strong>g criterion |p 1 − p 0 |

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

Saved successfully!

Ooh no, something went wrong!