Numerical Integration - (4.3) 1. The Degree of Accuracy of a Quadrature Formula:
The degree of accuracy of a quadrature formula Qf is the largest positive integer n such that
a b xkdx Qxk, k 0, 1, 2, . . . , n. Example
a b fxdx 9 4hfa h 34hfb, h b− a3 , 3h b − a. Find the degree of
accuracy
of this quadrature formula Qf 9
4 hfa h 34hfb. Consider fx 1, fx x, fx x2, . . . . It is known that
a b xkdx 1 k 1b k1− ak1. k fx 1 k 1b k1− ak1 9 4hfa h 34hfb 0 1 b− a 9 4h 34h 3h b − a 1 x 1 2 b 2 − a2 9 4ha h 34hb 3h4 3a h b b − a 4 3a b − a b b − a4 2a 2b 12b 2 − 1 2 a 2 2 x2 1 3 b 3− 1 3a 3 9 4ha h 2 3 4hb 2 1 3b 3 − 1 3a 3 3 x3 1 4 b 4− 1 4a 4 9 4ha h 3 3 4hb 3 − 1 9 ba 3 1 6 b 2a2 − 1 9 b 3a 5 18 b 4 − 2 9 a 4
So the degree of accuracy is 2
Example Suppose that the quadrature formula
0 2
fxdx c0f0 c1f1 c2f2
is exact for all polynomials of degree less than and equal to 2. Find c0, c1and c2
Qf c0f0 c1f1 c2f2 . fx 1, c0 c1 c2 2 1 fx x, 0 c1 2c2 2 2 fx x2, 0 c 1 4c2 8 3 3 3 − 2: 2c2 2 3, c2 13 Substitute it into2 : c1 2 − 2 1 3 43 Substitute both c1and c2into1 :
c0 2 − 4 3 − 13 13
02 fxdx 1 3f0 43f1 13f2 2. Numerical Quadrature:
a b fxdx ≈∑
i0 n aifxi.What are a0, a1, . . . , an? What is the approximation error?
a. Using Lagrange Interpolating Polynomials: If fx
∑
i0 n fxiLn,ix f n1c n 1!
i0 n x − xi then
a b fxdx ≈∑
i0 n fxi
a b Ln,ixdx ai
a b Ln,ixdx, i 0, 1, . . . , nThe corresponding approximation error is
Rint
a b fn1c n 1!
i0 n x − xidx. Trapezoidal Rule:Consider the 1st degree Lagrange interpolating polynomial P1x with data pairs a, fa and
b, fb . Let h b − a. P1x fa x − b a− b fb x − ab− a −fa x − bh fb x − ah
a b P1xdx
a b −fa x − b h fb x − ah dx − fa 2h x − b 2 fb 2h x − a 2 a b 1 2h fbh 2 fah2 h 2 fb faWeighted Mean Value Theorem for Integrals: (Page 9, Theorem 1.11 Suppose that F is continuous on a, b ,
a b
gxdx exists, and gx does not change sign on a, b .
Then there exists a number c in a, b with
a b Fxgxdx Fc
a b gxdx.The corresponding approximation error:
Consider Fx f ′′ c , and gx x − ax − b. gx does not change sign on a, b .
Rtrap
a b f ′′ c 2! x − ax − bdx 12f ′′ c
a b x − ax − bdx 1 2f ′′ c
a b x − ax − a − hdx 1 2f ′′ c
a b x − a2 − x − ah dx 1 2f ′′ c 1 3x − a 3− 1 2x− a 2h a b 1 2f ′′ c 1 3b − a 3 − 1 2b− a 2h 1 2f ′′ c 1 3h 3 − 1 2h 3 − 1 12f ′′ ch3b. Using Taylor Polynomials and Difference Formulas:
Though we can derive an numerical quadrature using the formula:
∑
in0fxi
a b Ln,ixdx, the remainder formula Rint
a b fn1c n 1!
i0 n x − xidxmay not be easy to use to derive the approximation error. To derive the approximation error for the Trapezoidal Rule, we use the Weighted Mean Value Theorem which has a condition: gx does not change sign on a, b . This condition is not always satisfied for f
n1c
n 1!
i0 nx − xi. For
example, to derive the approximation error for Simpson’s Rule (3 pairs of data, a 2nd degree Lagrange polynomial) Rint
a b f ′′′c 3! x − x0x − x1x − x2dx Here gx 13!x − x0x − x1x − x2 which does change sign over the interval x0, x2 . By Taylor Theorem, we know
fx Pnx Rnx, and
a b fxdx
a b Pnxdx
a b Rnxdx where Pnx fxi f ′ xi 1! x − xi f ′′xi 2! x − xi 2 f ′′′ xi 3! x − xi 3 . . . f n xi n! x − xi n Rnx f n1 c n 1! x − xin1The approximation error for
a b fxdx ≈
a b Pnxdx is Rint
a b f n1c n 1! x − xin1dx.Observe that the sign of f
n1
c
n 1! x − xin1does not change on the interval a, b . So by the
Weighted Mean-Value Theorem we know there exists a number c in a, b such that
ab f n1c n 1! x − xin1dx f n1c̄ n 1!
a b x − xin1dx fn1c̄ n 1! n 2 1 b− xi n2− a − x in2For the approximation error for Simpson’s Rule: choose xi x1, and use x0, x1, x2 :
x0 a x1 − h, x2 b x1 h, h b − a
2 Note that the interval a, b x0, x2 is symmetric about x x1. So,
x0 x2 x − x1mdx
x0 x1 x − x1mdx
x1 x2 x − x1mdx 0 if m is odd 2
x1 x2 x − x1mdx 2 m 1 x2 − x1 m1 2 m 1h m1 if m is even Consider
a b fxdx ≈
a b P3xdx
x0 x2 fx1 f ′ x1 1! x − x1 f ′′x1 2! x − x1 2 f ′′′ x1 3! x − x1 3 dx 2hfx1 f ′′ x1 2 2 3h 3Approximate f ′′x1 by the difference formula:
f ′′x fx h − fx fx − h
h2 − 112f4c1h
2
we have the numerical integral formula:
Qf 2hfx1 h 3 3 fx2 − fx1 fx0 h2 2hfx1 h3fx2 − fx1 fx0 h 3fx0 4fx1 fx2 and the approximation error:
Rint
x0 x2 f 4c1 4! x − x1 4 dx− h3 3 1 12f 4c 2h2 f 4 c̄1 4! 2 5h 5 − h5 36f 4c 2 f4c 1 60 − 136 h 5 − h5 90f 4c where c is in x0, x2 .Numerical integration formulas and approximation errors:
Name Approximation formula Approximation error
Trapezoidal Rule h 2 fb fa , h b − a − 112f ′′ ch3 Simpson’s Rule h 3 fx0 4fx1 fx2 , h b − a2 − h 5 90 f 4c Example Approximate
0 /4sinx2dx by the Trapezoidal Rule, and Simpson’s Rule . Estimate
corresponding approximation errors.
0.6 0.4 0.2 0 0.5 0.375 0.25 0.125 0 y sinx2, 0 ≤ x ≤ 4, dash yT, dashdots y Trapezoidal Rule: yT sin 2 16 −0 4 −0 x − 0 0 4 sin 2 16 yS −0. 151 162 9 0. 776 077 7x 0. 940 758 1x − 0. 392 699 12 h 4 − 0 4 , T 12 4 f0 f 4 8 0 sin 2 16 0. 227 164 h 1 2 4 − 0 8 , S 1 3 8 f0 4f 8 f 4 13 8 0 4 sin 2 64 sin 2 14 0. 165 250 46 True error: RT
0 /4 sinx2dx − 0. 227 164 −7. 000 933 252 893 539 95 10−2 RS
0 /4 sinx2dx − 0. 165 250 46 8. 095 792 5 10−3 Approximation errors: f ′′x −4sin x2x2 2 cos x2 f ′′′x −8cos x2x3 − 12sin x2xf4x 16sin x2x4 − 48cosx2x2 − 12 sin x2
0.8 0.6 0.4 0.2 0 2 1.5 1 0.5 0 x y x y y f ′′x 0.8 0.6 0.4 0.2 0 25 20 15 10 5 0 x y x y y |f4x|
f ′′x ≤ f ′′0 2, f 4x ≤ f 4 4 ≤ 16 sin 4 2 4 4 − 48 cos 4 2 4 2 − 12 sin 4 2 ≤ 28 ErrT − h3 12f ′′ ≤ 2 12 4 3 8. 074 551 10−2 ErrS − h5 90f4 ≤ 19028 8 5 2. 905 46 10−3 3. Newton-Cotes Formulas:
These formulas are derived using Lagrange interpolating polynomials.
Several numerical integration formulas are listed on Page 192-4: formulas (4.23)-(4.30). a. n 1 −point closed Newton - Cotes formulas:
x0 a, xn b, h b − an , xi a ih n # of pts # of sub-int. Formula (4.23)-(4.26) approx error c 1 2 1 h 1 2fx0 12fx1 − h 3 12 f ′′ c x0, x1 2 3 2 h 1 3 fx0 43fx1 13fx2 − h 5 90 f 4c x 0, x2 3 4 3 h 3 8 fx0 98 fx1 98 fx2 38 fx3 − 3h 5 80 f 4c x 0, x3 4 5 4 h 14 45 fx0 6445fx1 2445fx2 6445fx3 1445fx4 − 8h 7 945 f6c x0, x4 b. n 1 −point open Newton - Cotes formulas:
x−1 a, x0 a h, xn b − h, xn1 b, h b − an 2, xi xi−1 h.
The Midpoint formulas are open Newton - Cotes formulas.
n # of pts # of sub-int. Formula (4.27)-(4.30) approx error c 0 3 2 2hfx0 h 3 3 f ′′ c x−1, x1 1 4 3 h 3 2fx0 32fx1 3h3 4 f ′′ c x−1, x2 2 5 4 h 8 3fx0 − 43fx1 83fx2 14h5 45 f 4c x−1, x 3 3 6 5 h 55 fx 5 fx 5 fx 55fx 95h5 f4c x−1, x
Example Use the Midpoint Rule (4.28) and4. 29 to approximate
0
/4
sinx2dx and estimate the
approximation errors. a. (4.28): h 1 3 4 12, x0 12, x1 0 2 12 6 T1 3 2 12 fx0 fx1 8 sin 12 2 sin 6 2 0. 133 211 b. (4.29): h 1 4 4 16. xi 0 i 16 , i 0, 1, 2 T2 4h 3 2fx0 − fx1 2fx2 43 16 2 sin 16 2 − sin 8 2 2 sin 3 16 2 0. 158 022 True errors: Ra