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 73<br />

next iteration p 2 . If p 1 /∈ (a, b), then we will not accept p 1 as the next iteration: <strong>in</strong>stead<br />

the code will switch to the bisection method, determ<strong>in</strong>e which sub<strong>in</strong>terval among<br />

(a, p 0 ), (p 0 ,b) conta<strong>in</strong>s the root, updates the <strong>in</strong>terval (a, b) as the sub<strong>in</strong>terval that conta<strong>in</strong>s<br />

the root, and sets p 1 to the midpo<strong>in</strong>t of this <strong>in</strong>terval. Once p 1 is obta<strong>in</strong>ed, the<br />

code will check if the stopp<strong>in</strong>g criterion is satisfied. If it is satisfied, the code will<br />

return p 1 and the iteration number, and term<strong>in</strong>ate. If it is not satisfied, the code will<br />

use Newton’s method, <strong>with</strong> p 1 as the <strong>in</strong>itial guess, to compute p 2 . Then it will check<br />

whether p 2 ∈ (a, b), and cont<strong>in</strong>ue <strong>in</strong> this way. If the code does not term<strong>in</strong>ate after N<br />

iterations, output an error message similar to Newton’s method.<br />

Apply the hybrid method to:<br />

• a polynomial <strong>with</strong> a known root, and check if the method f<strong>in</strong>ds the correct root;<br />

• y =logx <strong>with</strong> (a, b) =(0, 6), for which Newton’s method failed <strong>in</strong> part (a).<br />

c) Do you th<strong>in</strong>k <strong>in</strong> general the hybrid method converges to the root, provided the <strong>in</strong>itial<br />

<strong>in</strong>terval (a, b) conta<strong>in</strong>s the root, for any start<strong>in</strong>g value p 0 ? Expla<strong>in</strong>.<br />

2.5 Muller’s method<br />

The secant method uses a l<strong>in</strong>ear function that passes through (p 0 ,f(p 0 )) and (p 1 ,f(p 1 )) to<br />

f<strong>in</strong>d the next iterate p 2 . Muller’s method takes three <strong>in</strong>itial approximations, passes a parabola<br />

(quadratic polynomial) through (p 0 ,f(p 0 )), (p 1 ,f(p 1 )), (p 2 ,f(p 2 )), and uses one of the roots<br />

of the polynomial as the next iterate.<br />

Let the quadratic polynomial written <strong>in</strong> the follow<strong>in</strong>g form<br />

P (x) =a(x − p 2 ) 2 + b(x − p 2 )+c. (2.13)<br />

Solve the follow<strong>in</strong>g equations for a, b, c<br />

P (p 0 )=f(p 0 )=a(p 0 − p 2 ) 2 + b(p 0 − p 2 )+c<br />

P (p 1 )=f(p 1 )=a(p 1 − p 2 ) 2 + b(p 1 − p 2 )+c<br />

P (p 2 )=f(p 2 )=c

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

Saved successfully!

Ooh no, something went wrong!