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 4. NUMERICAL QUADRATURE AND DIFFERENTIATION 152<br />

Exercise 4.2-3:<br />

Determ<strong>in</strong>e the value of n required to approximate<br />

∫ 2<br />

0<br />

1<br />

x +1 dx<br />

to <strong>with</strong><strong>in</strong> 10 −4 , and compute the approximation, us<strong>in</strong>g the composite trapezoidal and composite<br />

Simpson’s rule.<br />

Composite rules and roundoff error<br />

As we <strong>in</strong>crease n <strong>in</strong> the composite rules to lower error, the number of function evaluations<br />

<strong>in</strong>creases, and a natural question to ask would be whether roundoff error could accumulate<br />

and cause problems. Somewhat remarkably, the answer is no. Let’s assume the roundoff error<br />

associated <strong>with</strong> comput<strong>in</strong>g f(x) is bounded for all x, by some positive constant ɛ. And let’s<br />

try to compute the roundoff error <strong>in</strong> composite Simpson rule. S<strong>in</strong>ce each function evaluation<br />

<strong>in</strong> the composite rule <strong>in</strong>corporates an error of (at most) ɛ, the total error is bounded by<br />

⎡<br />

⎤<br />

n<br />

2<br />

h<br />

−1 n/2<br />

∑ ∑<br />

⎣ɛ +2 ɛ +4 ɛ + ɛ⎦ ≤ h [ ( n<br />

) ( n<br />

) ]<br />

ɛ +2<br />

3<br />

3 2 − 1 ɛ +4 ɛ + ɛ = h (3nɛ) =hnɛ.<br />

2 3<br />

j=1<br />

j=1<br />

However, s<strong>in</strong>ce h =(b − a)/n, the bound simplifies as hnɛ =(b − a)ɛ. Therefore no matter<br />

how large n is, that is, how large the number of function evaluations is, the roundoff error is<br />

bounded by the same constant (b − a)ɛ which only depends on the size of the <strong>in</strong>terval.<br />

Exercise 4.2-4: (This problem shows that numerical quadrature is stable <strong>with</strong> respect<br />

to error <strong>in</strong> function values.) Assume the function values f(x i ) are approximated by ˜f(x i ),so<br />

that |f(x i ) − ˜f(x i )|

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

Saved successfully!

Ooh no, something went wrong!