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

to get<br />

1<br />

4<br />

∫ 1<br />

0<br />

(<br />

f<br />

(<br />

) (<br />

))<br />

s +1<br />

2 , −1/√ 3+1 s +1<br />

+ f<br />

2<br />

2 , 1/√ 3+1<br />

ds.<br />

2<br />

Apply the Gauss-Legendre rule aga<strong>in</strong> to get<br />

[ (<br />

1<br />

f<br />

4<br />

+ f<br />

−1/ √ 3+1<br />

2<br />

(<br />

) (<br />

, −1/√ 3+1<br />

+ f<br />

2<br />

)<br />

1/ √ 3+1<br />

, −1/√ 3+1<br />

2 2<br />

Figure (4.1) displays the nodes used <strong>in</strong> this calculation.<br />

−1/ √ )<br />

3+1<br />

, 1/√ 3+1<br />

2 2<br />

(<br />

1/ √ )]<br />

3+1<br />

+ f<br />

, 1/√ 3+1<br />

. (4.6)<br />

2 2<br />

( − 1 ,<br />

3<br />

1<br />

3 ) 1 (<br />

1<br />

,<br />

3<br />

1<br />

3 )<br />

-1 1<br />

-1<br />

( − 1 ,− 1<br />

3 3 ) (<br />

1<br />

,− 1<br />

3 3 )<br />

Figure 4.1: Nodes of double Gauss-Legendre rule<br />

Next we derive the two-dimensional Simpson’s rule for the same <strong>in</strong>tegral,<br />

∫ 1 ∫ 1<br />

f(x, y)dydx, us<strong>in</strong>g n = 2, which corresponds to three nodes <strong>in</strong> the Simpson’s rule<br />

0 0<br />

(recall that n is the number of nodes <strong>in</strong> Gauss-Legendre rule, but n +1is the number of<br />

nodes <strong>in</strong> Newton-Cotes formulas).<br />

The <strong>in</strong>ner <strong>in</strong>tegral is approximated as<br />

∫ 1<br />

0<br />

f(x, y)dy ≈ 1 (f(x, 0) + 4f(x, 0.5) + f(x, 1)) .<br />

6<br />

Substitute this approximation for the <strong>in</strong>ner <strong>in</strong>tegral <strong>in</strong> ∫ (<br />

1 ∫ )<br />

1<br />

f(x, y)dy dx to get<br />

0 0<br />

1<br />

6<br />

∫ 1<br />

0<br />

(f(x, 0) + 4f(x, 0.5) + f(x, 1)) dx.

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

Saved successfully!

Ooh no, something went wrong!