Lecture notes on Vritionl nd Approximte Metods in Applied Mtemtics - A Peirce UBC 1 Lecture 5: Numericl Integrtion Compiled 15 September 1 In tis lecture we introduce tecniques for numericl integrtion, wic re primrily bsed on integrting interpolting polynomils nd wic led to te so-clled Newton-Cotes Integrtion Formule. We derive te clssic integrtion scemes suc s te trpezium rule nd Simpson s rule nd give teir error estimtes. We demonstrte ow tese error estimtes cn be used to obtin improved estimtes of te integrl vi process clled Ricrdson Extrpoltion. In fct, repeted extrpoltion using te trpezium rule yields Simpson s rule nd ll te iger order Newton-Cotes Formule Key Concepts: Numericl Integrtion, Newton-Cotes Formule, Trpezium Rule, Simpson s Rule, Ricrdson Extrpoltion. 5 Numericl Integrtion - Newton-Cotes Formule 5.1 Integrtion derived from integrting polynomil interpolnts f 1 f f N f Bsic Ide: Integrte polynomil interpolnts to pproximte integrls. x = x 1 x x N = b Outline: fx = p n x + f N+1 ξ N + 1! = = N k= N k= N N x x j ξ, x N p N x = f k l k x j= p N x dx + f N+1 ξ N + 1! f k l k x dx + f N+1 ξ N + 1! f k w k + f N+1 ξ N + 1! N x x j dx j= N x x j dx j= N x x j dx j= k= Closed Formule Trpezium Rule Adptive Integrtion Ricrdson Extrpoltion nd Simpson s Rule Singulr integrls nd open formule Midpoint Rule Subtrcting out te singulrity Guss-Legendre qudrture
Te Trpezium Rule: f p = E p f = 1 + p f 1 + p f fx dx x = + p, 1 dx = dp f + p f dp ] 1 = [f p + p f [ = f + 1 ] f 1 f = [f + f 1 ] Trpezoidl Rule x 1 Error Term: fx = p 1 x + f ξ x x x 1! [f + f 1 ] + f ξ x x x 1 dx = [f + f 1 ] + f ξ = [f + f 1 ] + f ξ = [f + f 1 ] + f ξ 1 1 pp 1 dp p pdp [ p p ] 1 x = + p x = p x x 1 = + p x 1 = p 1 1 1 = = 1 6 6 [f + f 1 ] f ξ 1
Interpoltion Composite Rule: Assume uniform mes f + f 1 + f 1 + f + + f N 1 + f N { N f ξ k ξ 1 ξ ξ x 1 x x N = = b 1 ] { [f + f 1 + + f N 1 + f N f b f + 4 f b f 1 7 [f + f 1 + + f N 1 + f N ] 1 b f ξ ξ, b by MV Teorem. Note: 1 Trpezoidl Rule is excellent for pproximting periodic functions Eg. If fx is periodic on [, b] i.e. f = fb ten Recll te DFT 1 π π Accurcy for periodic functions: e ikx fx dx 1 π N 1 N 1 π N j= k= f k e ik π N j f j = f k If If f = f b ten f = f b ten N 1 f j + O 4 j= N 1 f j + O 6 j=. If f k+1 = f k+1 b k =, 1,..., M ten Tis is were te spectrl ccurcy comes from. N 1 f j + O M+1 j=
4 Adptive Integrtion: Ide: Recursively refine te smpling of te integrnd until te difference between successive pproximte integrls is less tn some tolernce. N = 1 N = N = 1 1 1 4 5 + + + + k + 1 + + + k = + 1 k 1 1 = + k 1 1 = 1 + k 1 I 1 = f b 1 + f = f 1 + f i = N = 1 = b /i = b x = + [ ] b : : b =. I = 1 b b {I 1 + f = f 1 + f + f b = [f 1 + f + f ] 4 i = = = b / x = + [ ] b b : : b =, 4 4 I = 1 { I + f 4 + f 5 = 1 { b b [f 1 + f + f ] + f 4 + f 5 4 { b 4 = In generl : I k = 1 I k 1 + j k = 1 + k [f 1 + f + f 4 + f 5 + f ] b k j k + k j=j k +1 f j Trpezoidl Approximtion: Exmple: N 1 x dx 1 sin πx dx 1 sin πx dx.6559.5. 4.6485.6559.5 8.6581.6841744.5 16.66581.645715.5.66555894.66186.5 64.666781.664919.5. Exct.66666666 6.6661977.5 O? O O m
Interpoltion 5 Ricrdson Extrpoltion: Exploiting te error estimte to get n improved pproximtion: I I I 1 Becuse we ve n error estimte for te Trpezium rule of te form: I = I + c + c 4 4 I4 = I + c 16 + c 4 56 4 I = I + c 4 + c 4 16 4 eliminte te c nd get n improved estimte: Exmple: We cn continue wit tis process using te recursion 1 4I I = I 1c 4 4 4I I = I 4c 4 4 I = 1 sin πx dx I1/4 =.6559597 I1/8 =.68417465157 4I1/8 I1/4 =.67545.6661977 s = I s s = 1,..., k m s = m 1 s+1 + nd were expnsion for te error is of te form m 1 s+1 m 1 s s / s+m 1 γ 1 I = I + N C γk γ k s = 1,..., k m + 1 m =,..., k Note: Ricrdson extrpoltion combined wit dptive integrtion is known s Romberg integrtion.
6 Repeted Ricrd Extrpoltion: Successive Trpezoidl Approximtions to 1 sinπ x dx.7 Extrpoltion 1: 1 = I 1...666666666666667.5.5 I.6.5.4...1 Exct vlue =.66619776758 Extrpolted =.66666666666667 Trpezium =.5..4.6.8 1 Successive Trpezoidl Approximtions to.7 Extrpoltion : 1 = I.4 1...666666666666667.6616481771..5.5.6871187457698..5.65595974.1 I.6.5 Exct vlue =.66619776758 Extrpolted =.6616481771 Trpezium =.6559597..4.6.8 Successive Trpezoidl Approximtions to 1 sinπ x dx.7.6.5 I.4...1 Exct vlue =.66619776758 Extrpolted =.6661589898 Trpezium =.68417465157 Extrpoltion :..4.6.8 1 1 = I 1...666666666666667.6616481771.66615898979.5.5.6871187457698.66614478918.5.65595974.6675451817.15.684174651571
Interpoltion 7 Simpson s Rule: x 1 x Recll p = x x = + p dx = dp x E p f = 1 + p f = 1 + p + E p f 1 + p + pp 1 +... f! pp 1 f for polynomil of degree. f + p f + 1 p p f dp = {pf + p f + 1 p p { = f + f 1 f + 1 8 { = f 1 + 1 f f 1 + 1 f f f f 1 + f x {f + 4f 1 + f Simpson s Rule Requires intervls. Error involved: x x x x x 1 x x dx = x f ξ P x dx + x x x 1 x x dx! χ = x x 1 x = x 1 + χ x x χ + χχ dχ = {f + 4f 1 + f + x χ χ dχ =. f[, x 1, x, x]x x x 1 x x dx
8 Now x f[, x 1, x, x] f[, x 1, x, x ] = x x f[, x 1, x, x, x] x x f[, x 1, x, x]x x x 1 x x dx = + x fxdx = S + x f[, x 1, x, x, x]x x x 1 x x x x dx f 4 ξ 4! x x x x 1 x x dx = {f + 4f 1 + f x f[, x 1, x, x ]x x x 1 x x dx x x x 1 x x x x dx coose x = x 1 f 4 ξ 5 9 χ χ dχ = 5 5 5 6 1 = 5 = 45 15 15 Composite Rule: fxdx = [ fx + 4fx 1 + fx + 4fx +... + 4fx N 1 + fx N ] 5 N/ f 4 ξ k 9 ξ 1 ξ N/ fxdx = S 4 N/ 18 f 4 ξ k f 4 ξ k = S 4 f b f 18 = S 4 18 b f 4 ξ f 4 x dx = f b f
Interpoltion 9 Ricrd Extrpoltion leds to iger order Newton-Cotes formule: Net interprettion of te first extrpoltion formul for te trpezium rule: I = 4 I 1 I + O4 1 N 1 N I = 4 {f + f 1 + + f N 1 + f N 1 {f + f + + f N + f N = {f + 4f 1 + f + + f N + 4f N 1 + f N just Simpson s Rule. Note: If we repet tis process we obtin te iger order Newton-Cotes Formule. Closed Newton-Cotes Formule: x x x 4 f + f 1 1 f ξ Trpezium rule ξ, x 1 f + 4f 1 + f 5 9 f 4 ξ Simpson s rule ξ, x 8 f + f 1 + f + f 5 8 f 4 ξ ξ, x 45 7f + f 1 + 1f + f + 7f 4 87 945 f 6 ξ ξ x 1, x 4