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

Example 78. Approximate ∫ 1<br />

cos xdx us<strong>in</strong>g Gauss-Legendre quadrature <strong>with</strong> n =3nodes.<br />

−1<br />

Solution. From Table 4.1, and us<strong>in</strong>g two-digit round<strong>in</strong>g, we have<br />

∫ 1<br />

−1<br />

cos xdx ≈ 0.56 cos(−0.77) + 0.89 cos 0 + 0.56 cos(0.77) = 1.69<br />

and the true solution is s<strong>in</strong>(1) − s<strong>in</strong>(−1) = 1.68.<br />

So far we discussed <strong>in</strong>tegrat<strong>in</strong>g functions over the <strong>in</strong>terval (−1, 1). What if we have<br />

a different <strong>in</strong>tegration doma<strong>in</strong>? The answer is simple: change of variables! To compute<br />

∫ b<br />

f(x)dx for any a

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

Saved successfully!

Ooh no, something went wrong!