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

Remark 71. Both closed and open Newton-Cotes formulas us<strong>in</strong>g odd number of nodes (n<br />

is even), ga<strong>in</strong>s an extra degree of accuracy beyond that of the polynomial <strong>in</strong>terpolant on<br />

which it is based. This is due to cancellation of positive and negative error.<br />

There are some drawbacks of Newton-Cotes formulas:<br />

• In general, these rules are not of the highest degree of accuracy possible for the number<br />

of nodes used.<br />

• The use of large number of equally spaced nodes may <strong>in</strong>cur the erratic behavior associated<br />

<strong>with</strong> high-degree polynomial <strong>in</strong>terpolation. Weights for a high-order rule may<br />

be negative, potentially lead<strong>in</strong>g to loss of significance errors.<br />

• Let I n denote the Newton-Cotes estimate of an <strong>in</strong>tegral based on n nodes. I n may not<br />

converge to the true <strong>in</strong>tegral as n →∞for perfectly well-behaved <strong>in</strong>tegrands.<br />

Example 72. Estimate ∫ 1<br />

0.5 xx dx us<strong>in</strong>g the midpo<strong>in</strong>t, trapezoidal, and Simpson’s rules.<br />

Solution. Let f(x) =x x . The midpo<strong>in</strong>t estimate for the <strong>in</strong>tegral is 2hf(x 0 ) where h =<br />

(b − a)/2 =1/4 and x 0 =0.75. Then the midpo<strong>in</strong>t estimate, us<strong>in</strong>g 6-digits, is f(0.75)/2 =<br />

0.805927/2 =0.402964. The trapezoidal estimate is h [f(0.5) + f(1)] where h =1/2, which<br />

2<br />

results <strong>in</strong> 1.707107/4 =0.426777. F<strong>in</strong>ally, for Simpson’s rule, h =(b − a)/2 =1/4, and thus<br />

the estimate is<br />

h<br />

1<br />

[f(0.5) + 4f(0.75) + f(1)] = [0.707107 + 4(0.805927) + 1] = 0.410901.<br />

3 12<br />

Here is a summary of the results:<br />

Midpo<strong>in</strong>t Trapezoidal Simpson’s<br />

0.402964 0.426777 0.410901<br />

Example 73. F<strong>in</strong>d the constants c 0 ,c 1 ,x 1 so that the quadrature formula<br />

∫ 1<br />

has the highest possible degree of accuracy.<br />

0<br />

f(x)dx = c 0 f(0) + c 1 f(x 1 )<br />

Solution. We will f<strong>in</strong>d how many of the polynomials 1,x,x 2 , ... the rule can <strong>in</strong>tegrate exactly.<br />

If p(x) =1, then<br />

If p(x) =x, we get<br />

∫ 1<br />

0<br />

∫ 1<br />

p(x)dx = c 0 p(0) + c 1 p(x 1 ) ⇒ 1=c 0 + c 1 .<br />

0<br />

p(x)dx = c 0 p(0) + c 1 p(x 1 ) ⇒ 1 2 = c 1x 1

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

Saved successfully!

Ooh no, something went wrong!