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

a new <strong>in</strong>terval <strong>in</strong> the follow<strong>in</strong>g step, we will simply call the new <strong>in</strong>terval [a, b], overwrit<strong>in</strong>g<br />

the old one. Similarly, we will call the midpo<strong>in</strong>t p, and update it at each step.<br />

In [1]: function bisection(f::Function,a,b,eps,N)<br />

n=1<br />

p=0. # to ensure the value of p carries out of the while loop<br />

while n

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

Saved successfully!

Ooh no, something went wrong!