Lecture 14 Numericl integrtion: dvnced topics Weinn E 1,2 nd Tiejun Li 2 1 Deprtment of Mthemtics, Princeton University, weinn@princeton.edu 2 School of Mthemticl Sciences, Peking University, tieli@pku.edu.cn No.1 Science Building, 1575
Outline Motivtions Gussin qudrture Adptive qudrture
Gussin qudrture n b f(x) dx k=1 n A k f(x k ), How to obtin the mximl ccurcy with fixed number of node points n nd suitble choice of coefficients A k?
Adptive integrtion Adptive integrtion Adptive grid for numericl integrtion The informtion of the function itself must be tken into ccount.
Outline Motivtions Gussin qudrture Adptive qudrture
Interpolted integrtion I = b f(x)dx k=0 n A k f(x k ) = I N x k A k E n(f) = I(f) I N (f). f P n, E n(f) = 0, (1) I N (f) (2) I N (f) x 0, x 1,..., x n n
: m, f(x) = 1, x, x 2,..., x m, f(x) = x m+1, m. : b f(x)dx f( + b )(b ). 2 f(x) = 1, x, f(x) = x 2 1
n n + k : 0 k n + 1, I N (f) d = n + k (1) I N (f) (2) ω n(x) = n k=0 (x x k) b ωn(x)p(x)dx = 0, p P k 1. : Newton-Cotes n n n + 1
Guss n b f(x) dx k=1 n A k f(x k ), (1) b ρ(x)f(x) dx k=1 n A k f(x k ), (2) ρ(x) > 0. n, x k A k,.,, Guss. 2n 2n 1.
Guss, [, b] = [ 1, 1], b f(x) dx = b 2 1 1 ( + b f 2 + b ) 2 t dt. (3) 2n (n,n ), f(x) 1, x, x 2,..., x 2n 1,. ρ(x) 1, 2n n k=1 A k f(x k ) = 1 j + 1 (bj+1 j+1 ), j = 0, 1, 2,..., 2n 1.,!
Guss n = 1 1 f(x) dx = A1f(x1), f(x) = 1 f(x) = x 1 A 1 = 2, x 1 = 0. Guss. b f(x)dx f( + b )(b ). 2
Guss n = 2 1 f(x) dx = A1f(x1) + A2f(x2), f(x) = 1, f(x) = x, 1 f(x) = x 2, f(x) = x 3 A 1 + A 2 = 2, A 1x 1 + A 2x 2 = 0, A 1x 2 1 + A 2x 2 2 = 2, 3 A 1x 3 1 + A 2x 3 2 = 0. A 1 = A 2 = 1, x 1 = 1 3, x 2 = 1 3. Guss b f(x) dx b ( ( + b f 2 2 3. b ) ( + b 2 + f 3 2 + b )) 2. 3
Guss! : ρ(x) (, b), f,g C[, b], (f, g) = f g, b ρ(x)f(x)g(x)dx b f 2 = (f, f) = ρ(x)f(x)f(x)dx f 2, ρ(x). : f,g C[, b], (f, g) = b ρ(x)f(x)g(x)dx = 0
(, b) {ϕ 0(x), ϕ 1(x), ϕ 2(x),, }, b ρ(x)ϕ j(x)ϕ l (x)dx = 0, j l, (4) [, b] ρ(x)., Grm-Schmidt {1, x, x 2,..., x k,... } ϕ 0(x) = 1 j ϕ j+1(x) = x j+1 (x j+1, ϕ i(x)) ϕi(x), j = 0, 1,... (ϕ i(x), ϕ i(x)) i=0
(1)Legendre [, b] = [ 1, 1], ρ(x) 1, ϕ 0(x) = 1, ϕ 1(x) = x, ϕ k+1 (x) = 2k + 1 k + 1 xϕ k(x) k k + 1 ϕ k 1(x), k = 1, 2,... (2)Chebyshev [, b] = [ 1, 1], ρ(x) = 1/ 1 x 2 T 0(x) = 1, T 1(x) = x, T k+1 (x) = 2xT k (x) T k 1 (x), k = 1, 2,... (3)Lguerre [, b) = [0, + ), ρ(x) = exp ( x) Q 0(x) = 1, Q 1(x) = 1 x, Q k+1 (x) = (1 + 2k x)q k (x) k 2 Q k 1 (x), k = 1, 2,... Hermite.
Guss : [, b] n n. x j Guss. Guss-Legendre : [, b] = [ 1, 1],ρ(x) 1, x j n Legendre. n = 1 n = 2 n = 3 1 1 1 1 1 1 f(x) dx 2f(0) ( f(x) dx f 1 ) 3 3 f(x) dx 5 9 f (. Guss-Chebyshev 1 1 5 ( 1 3 ) + f ) f(x) 1 x 2 dx π n + 8 9 f(0) + 5 ( 9 f 3 ) 5 n f(x j) j=1 x j [ 1, 1] n Chebyshev T n(x) ( 2j 1 ) x j = cos 2n π
Guss Guss-Lguerre e x f(x) dx 0 j=1 n A jf(x j) x j (, 0] n Lguerre Q n(x). n = 2,Guss-Lguerre 0 e x f(x) dx 2 + 2 4. f(2 2) + 2 2 f(2 + 2) 4 : ρ(x) = 1 [, b] 1 n + 1 q n+1(x) f C 2n+2 [, b] Guss-Legendre E(f) = f (2n+2) (ξ) (2n + 2)! b (ω n(x)) 2 dx.
Outline Motivtions Gussin qudrture Adptive qudrture
Composite trpezoid rule Consider, for exmple, the generl composite trpezoid rule I N (f) = nd the error estimte N i=1 I(f) I N (f) = x i x i 1 [f(x i 1 + f(x i)] 2 N f (η i)(x i x i 1) 3 i=1 where the nodes x i re not necessrily eqully spced. The contribution 12 f (η i)(x i x i 1) 3, η i (x i 1, x i) 12 depends on both the size of f (x) on the intervl (x i 1, x i) nd the size of x i x i 1.
Adptive ide In those prts of the intervl of integrtion (, b) where f (x) is smll, we cn tke subintervls of lrge size, while in regions where f (x) is lrge, we cn tke subintervls of smll size. This equi-prtition policy of errors is best if the gol is to minimize the number of subintervls nd hence the number of function evlutions, necessry to clculte I(f) to given ccurcy.
Adptive qudrture Suppose the object is to compute n pproximtion P to the integrl I(f) = b f(x)dx such tht P I(f) ɛ nd to do this using s smll number of function evlutions s possible. Define I i(f) = x i+1 f(x)dx, nd x i S i = h (f(x i) + 4f(x i + h ) 6 2 ) + f(xi+1) S i = h (f(x i) + 4f(x i + h 12 4 ) + 2f(xi + h 2 ) + 4f(xi + 3h ) 4 ) + f(xi+1)
Adptive qudrture From error estimtes I i(f) S i = f (4) (η 1) ( h 90 2 )5 Assume η 1 = η 2, then thus Substitute it bck we hve I i(f) S i = 2f (4) (η 2) ( h 90 4 )5 S i S i = f (4) h 5 ( 1 2 4 ) 2 5 90 2 4 f (4) h 5 2 5 90 = 24 ( S i S i) 1 2 4 I i(f) S i = S i S i 1 2 4 = 1 15 ( S i S i)
Adptive qudrture So the principle of equiprtition of errors gives E i = 1 15 ( S i S i) nd the pproximte integrtion is tken s h b ɛ N P = S i Adptive qudrture essentilly consists of pplying the Simpson s rule to ech of the subintervls covering [, b] until the bove inequlity of equiprtition of errors is stisfied. If the inequlity is not stisfied, those subintervls must be further subdivided nd the entire process repeted. i=1
Adptive qudrture Exmple I(f) = nd the error ɛ = 0.0005. Sketch of function f(x) = x 1 0 xdx f(x) 0 1 The curve is very steep in the vicinity of 0 while it is firly flt s x 1.
Adptive qudrture Step 1: Divide the intervl [0, 1] into [0, 1 2 ] nd [ 1 2, 1]. S[ 1, 1] = 0.43093403 2 then S[ 1, 1] = 0.43096219 2 E[ 1 2, 1] = 1 15 ( S S) = 0.0000018775 < 1/2 (0.0005) = 0.00025 1 The error criterion is stisfied, we ccept the vlue S[ 1, 1]. 2 Step 2: Compute the integrl in [0, 1 2 ]: S[0, 1 2 ] = 0.22449223 nd S[0, 1 2 ] = 0.23211709 E[0, 1 2 ] = 0.00043499 > 0.00025 The error criterion is not stisfied, we must subdivide [0, 1 2 ] gin.
Adptive qudrture Step 3: Compute the integrl in [ 1, 1 ]: 4 2 S[ 1 4, 1 2 ] = 0.15235819 S[ 1 4, 1 2 ] = 0.15236814 nd E[ 1 4, 1 2 ] = 0.664 10 6 < 1/4 (0.0005) = 0.000125 1 The error criterion is stisfied, we ccept the vlue S[ 1, 1 ]. 4 2 Step 4: Compute the integrl in [0, 1 ]: 4 S[0, 1 4 ] = 0.07975890 S[0, 1 4 ] = 0.08206578 nd E[0, 1 4 ] > 1/4 (0.0005) = 0.000125 1 The error criterion is not stisfied, we must subdivide [0, 1 ] gin. 4
Adptive qudrture Step 5: We repet the procedure bove gin nd gin until ll of the subintervls stisfies the condition. The subintervls re [0, 1 8 ], [ 1 8, 1 4 ], [ 1 4, 1 2 ], [ 1 2, 1], So we hve the pproximte integrtion vlues P = i S i = 0.66621524 We hve I(f) = 2, so 3 P F (f) = 0.00045142 < 0.0005 The subroutine for dptive qudrture is very complicte in generl. But it is very useful for lrge scle computtions.