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

and apply the quadrature rule aga<strong>in</strong>, us<strong>in</strong>g n 1 nodes, to get the approximation<br />

∑n 2<br />

j=1<br />

This gives the two-dimensional rule<br />

∫ b<br />

a<br />

(∫ d<br />

c<br />

(<br />

n1<br />

)<br />

∑<br />

w j w i f(x i ,y j ) .<br />

i=1<br />

)<br />

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

∑n 2 n 1<br />

j=1<br />

∑<br />

w i w j f(x i ,y j ).<br />

For simplicity, we ignored the error term <strong>in</strong> the above derivation, however, its <strong>in</strong>clusion is<br />

straightforward.<br />

For an example, let’s derive the two-dimensional Gauss-Legendre rule for the <strong>in</strong>tegral<br />

∫ 1 ∫ 1<br />

0<br />

0<br />

i=1<br />

f(x, y)dydx (4.5)<br />

us<strong>in</strong>g two nodes for each axis. Note that each <strong>in</strong>tegral has to be transformed to (−1, 1).<br />

Start <strong>with</strong> the <strong>in</strong>ner <strong>in</strong>tegral ∫ 1<br />

f(x, y)dy and use<br />

0<br />

t =2y − 1,dt=2dy<br />

to transform it to<br />

∫<br />

1 1<br />

(<br />

f x, t +1 )<br />

dt<br />

2 −1 2<br />

and apply Gauss-Legendre rule <strong>with</strong> two nodes to get the approximation<br />

( (<br />

) (<br />

))<br />

1<br />

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

+ f x, 1/√ 3+1<br />

.<br />

2<br />

2<br />

2<br />

Substitute this approximation <strong>in</strong> (4.5) for the <strong>in</strong>ner <strong>in</strong>tegral to get<br />

∫ ( (<br />

) (<br />

))<br />

1<br />

1<br />

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

+ f x, 1/√ 3+1<br />

dx.<br />

2<br />

2<br />

2<br />

0<br />

Now transform this <strong>in</strong>tegral to the doma<strong>in</strong> (−1, 1) us<strong>in</strong>g<br />

s =2x − 1,ds=2dx

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

Saved successfully!

Ooh no, something went wrong!