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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 4. NUMERICAL QUADRATURE AND DIFFERENTIATION 162<br />

Apply Simpson’s rule aga<strong>in</strong> to this <strong>in</strong>tegral <strong>with</strong> n =2to obta<strong>in</strong> the f<strong>in</strong>al approximation:<br />

[<br />

1<br />

6<br />

1<br />

6<br />

(<br />

f(0, 0) + 4f(0, 0.5) + f(0, 1) + 4(f(0.5, 0) + 4f(0.5, 0.5) + f(0.5, 1))<br />

+ f(1, 0) + 4f(1, 0.5) + f(1, 1)) ] . (4.7)<br />

Figure (4.2) displays the nodes used <strong>in</strong> the above calculation.<br />

1<br />

0.5<br />

0 0.5<br />

1<br />

Figure 4.2: Nodes of double Simpson’s rule<br />

For a specific example, consider the <strong>in</strong>tegral<br />

∫ 1 ∫ 1 ( π<br />

)( π<br />

)<br />

2 s<strong>in</strong> πx 2 s<strong>in</strong> πy dydx.<br />

0<br />

0<br />

This <strong>in</strong>tegral can be evaluated exactly, and its value is 1. It is used as a test <strong>in</strong>tegral<br />

for numerical quadrature rules. Evaluat<strong>in</strong>g equations (4.6) and(4.7) <strong>with</strong> f(x, y) =<br />

( π s<strong>in</strong> πx)( π<br />

s<strong>in</strong> πy) , we obta<strong>in</strong> the approximations given <strong>in</strong> the table below:<br />

2 2<br />

Simpson’s rule (9 nodes) Gauss-Legendre (4 nodes) Exact <strong>in</strong>tegral<br />

1.0966 0.93685 1<br />

The Gauss-Legendre rule gives a slightly better estimate than Simpson’s rule, but us<strong>in</strong>g less<br />

than half the number of nodes.<br />

The approach we have discussed can be extended to regions that are not rectangular,<br />

and to higher dimensions. More details, <strong>in</strong>clud<strong>in</strong>g algorithms for double and triple <strong>in</strong>tegrals<br />

us<strong>in</strong>g Simpson’s and Gauss-Legendre rule, can be found <strong>in</strong> Burden, Faires, Burden [4].<br />

There is however, an obvious disadvantage of the way we have generalized onedimensional<br />

quadrature rules to higher dimensions. Imag<strong>in</strong>e a numerical <strong>in</strong>tegration problem<br />

where the dimension is 360; such high dimensions appear <strong>in</strong> some problems from f<strong>in</strong>ancial<br />

eng<strong>in</strong>eer<strong>in</strong>g. Even if we used two nodes for each dimension, the total number of nodes would

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

Saved successfully!

Ooh no, something went wrong!