Lecture notes on Vritionl nd Approximte Methods in Applied Mthemtics - A Peirce UBC Lecture 6: Singulr Integrls, Open Qudrture rules, nd Guss Qudrture (Compiled 6 August 7) In this lecture we discuss the evlution of singulr integrls using so-clled open qudrture formule. We lso discuss vrious techniques to obtin more ccurte pproximtions to singulr integrls such s subtrcting out the singulrity nd trnsformtions to non singulr integrls. We next introduce Guss Integrtion, which exploits the orthogonlity properties of orthogonl polynomils in order to obtin integrtion rules tht cn integrte polynomil of degree N exctly using only N smple points. We lso discuss integrtion on infinite integrls nd dptive integrtion. Key Concepts: Singulr Integrls, Open Newton-Cotes Formule, Guss Integrtion. 6 Singulr Integrls, Open Qudrture rules, nd Guss Qudrture Consider evluting singulr integrls of the form I 6. Integrting functions with singulrities e x x/ We cnnot just use the trpezoidl rule in this cse s f. Insted we use wht re clled open integrtion formule tht do not use the endpoints in the numericl pproximtion of the integrls. 6.. Open Newton-Cotes formule The Midpoint rule x +h/ x h/ f(x) f(x ) + (x x )f (x ) + (x x ) f (x ) + x +h/ f(x) f + (x x )f + (x x ) f (ξ) x h/ hf + h/ h/ hf + s 6 sf + s f (ξ) dξ h/ f (ξ) hf + h 8 f (ξ) hf + h 4 f (ξ)
x x x N The Composite Midpoint rule For cell x k +h/ x k h/ I f(x) h h h h f(x) hf(x k ) + h 4 f (x k ) Open Newton-Cotes Formule: x x k +h/ x k h/ h/ h/ h/ h/ f(x) f(x k + s)ds f(x k ) + sf (x k ) + s f (x k ) + ds f(x k ) + f(x k ) + h 4 f (x k ) h f (x k ) f(x k ) + h f (x) 4 f(x k ) + h 4 {f (b) f ()} (h) f(x) hf + 4 f (ξ) MidpointRule ξ (x, x ) x x x f(x) x 4 x f(x) h (f + f ) + h 4 f () (ξ) ξ (x, x ) 4h (f f + f ) + 8h5 9 f (4) (ξ) ξ (x, x 4 )
Numericl Integrtion 6.. Chnge of vrible (Eg.) I (Eg. ) I x /n f(x) n f(t n ) t nt n dt let t x /n x t n nt n dt I n (Eg. ) I π π/ f(t n )t n dt which is proper integrl for n f(x) x cos t sin t dt ( x ) / f(cos t) dt proper f(x) [x( x)] / x sin t sin t cos t dt f(sin t) sin t cos t dt sin t cos t π/ f(sin t)dt. 6.. Subtrcting the singulrity Consider evluting the integrl I e x x/ We note tht close to the singulr point x in the integrnd, the numertor cn be expnded bout the singulr point in the Tylor series: e x + x + x! I + +.... We now choose to rerrnge the integrnd s follows e x (e x ) + x/ x/ x / e x x / Using this decomposition we cn thus evlute the singulr prt nlyticlly nd the non-singulr prt numericlly. We cn expect to obtin more ccurte result thn simply using n open integrtion formul nd ignoring the singulrity. Since the ccurcy of the midpoint rule, for exmple, depends on the second derivtive of the integrnd (e x ), we cnnot expect even the midpoint rule to chieve its theoreticl rte of convergence for this integrl. To x /
4 retrieve the O(h ) ccurcy of the Midpoint rule we need to subtrct t lest three terms s follows: I + e x x/ + x/ 4 5 + x + x/ + 5 x / x / e x x x / + x/ x / + e x x x / x / e x x x / x / In figure we plot the errors obtined when the midpoint rule is used directly s well s the errors when nd terms re subtrcted from the integrnd. The second order ccurcy only returns when terms re removed so tht g is bounded on [, ], where g(x) ex x x / x /. Error(h) Midpoint Errors O(h p / ) in evluting exp(x)/x 4 Direct p.5 term p. terms p 6 h Figure. Plots of the errors vs h when the midpoint rule is used directly, nd when nd terms re removed
Numericl Integrtion 5 6. Guss Qudrture 6.. Orthogonl polynomils There exist fmilies of polynomil functions {ϕ n (x)} n over n intervl [, b] with weight w(x) : i.e.: ech of which re orthogonl with respect to integrtion ϕ m (x)ϕ n (x)w(x) δ mn C n. Eg. () Legendre Polynomils: {P n (x)} ; [, b] [, ]; w(x). In generl P n (x) cn be constructed by the recursion: P (x), P (x) x, P (x) (x ),... P n (x) n xp n (x) n (n ) P n (x). n ODE: ( x )y xy + (n + )ny ; y P n (x) Eg. () Lguerre Polynomils: {L n (x)}; [, b) [, ); w(x) e x L (x) ; L (x) x, L (x) 4x + x,... Recursion reltion: L n (x) (n x )L n (x) (n ) L n (x). ODE: xy + ( x)y + ny ; y L n (x). Eg. () Chebyshev Polynomils: {T n (x)}, [, b] [, ], w(x) / x Definition: T n (x) cos nθ where θ cos x. T (x), T (x) x, T (x) cos θ cos θ x,... The recursion reltion follows from the identity: cos nθ cos θ cos(n )θ cos(n ) T n (x) xt n (x) T n (x) ODE: ( x )y xy + n y y T n (x)
6 Hermite Polynomils: {H n (x)} (, b) (, ) w(x) e x H (x), H (x) x, H (x) 4x,... Recursion: H n (x) xh n (x) (n )H n (x) ODE: y xy + ny y H n (x). 6.. Expnsion of n rbitrry polynomil in terms of orthogonl polynomils Let q k (x) α + α x + + α k x k be ny polynomil of degree k. Then since the orthogonl polynomils {ϕ j (x)} re linerly independent, we cn lso express q k (x) s liner combintion of {ϕ j (x)}, j,..., k s follows: q k (x) α + α x + + α k x k β ϕ + β ϕ + + β k ϕ k. ( ) Exmple: Expnd q (x) x + x in terms of Legendre Polynomils P k (x) q (x) x + x in terms of Legendre polynomils β + β x + β (x ) ( β β ) + β x + β x β β 4 β β + β 5 q (x) 5 P (x) + P (x) 4 P (x) 6.. ϕ n (x) is orthogonl w.r.t the weight w(x) to ll lower degree polynomils q k (x), k,..., n The fct tht ny polynomil q k (x) cn be expnded s liner combintion of orthogonl polynomils {ϕ j (x)} k j up to degree k, s ws shown in the expnsion ( ), implies tht n orthogonl polynomil ϕ n (x) is orthogonl with respect to the weight w(x) to ny polynomil of lower degree thn n. In other words, if {q k (x)} n k polynomils of degrees k,..., n, then w(x)ϕ n (x)q k (x) for k,..., n re ny
Numericl Integrtion 7 To see this, consider ny kth degree polynomil q k (x) nd use use the expnsion ( ) to write w(x)ϕ n (x)q k (x) k m w(x)ϕ n (x) β k m k β k ϕ m (x) w(x)ϕ n (x)ϕ m (x) The ltter integrls vnish becuse of the orthogonlity of polynomils of distinct degree with respect to the weight w(x). Ide behind Guss Qudrture: We ssume tht the pproximtion of 6. Guss-Legendre qudrture f(x) is given by: f(x) w i f(x i ) where the w i re weights given to the function vlues f(x i ). If we regrd the x i s free then cn we do better by choosing these x i ppropritely? Shift to the intervl [, ] : There is no loss of generlity in ssuming tht [, b] [, ] since the chnge of vribles x [, b] to t [, ]: will reduce the integrl to x t(b ) i + F (t)dt where F (t) (b ) f(x(t)) ( + b) Let us pproximte f on [, ] by polynomil of degree M nd integrte the resulting polynomil. The error involved is of the form: f(x) M p M (x) + f (M) (ξ) M! f k M f k w k + l k (x) + (x x )... (x x M ) f[x,..., x M, x](x x )... (x x M ) f[x,..., x M, x](x x )... (x x M ) where l k (x) nd w k This formul will be exct if f is polynomil of degree M since then P M (x) f(x). M (x x j )/x k x j ) j j k l k (x).
8 Now let M N nd choose x,..., x N to be the zeros of the Legendre polynomil P N (x) of degree N. In this cse, ll the weights w k for k N + s cn be seen from the clcultion or w k f(x) C k C k l k (x) P N (x)q k,n (x) P N (x) ( N {}}{{}}{ (x x )... (x x N ) (x x N+ )... (x x k )(x x k+ )... (x x M ) k N + (x k x )... (x k x N+ )... (x k x M ) S β S P S (x) no mtter where we choose the x N+,..., x N. f(x) f k w k + f (N) (ξ) (N)! f k w k + f (N) (ξ) (N)! ) (x x )... (x x N ) C N [P N (x)] f k w k + N+ (N!) 4 (N + )[(N)!] f (N) (ξ). Thus for only N points we cn integrte polynomil of degree N exctly. For rbitrrily chosen smple points {x k }, we would hve required N points to chieve the sme ccurcy. Expressions for the bscisse nd the weights The {x k } N re the zeros of the Legendre polynomil of degree N. The weights w k ( x k ) (N + ) [P N+ (x k )] m x k w k ±.577569 /.8 8 8/9. ±.774596669 5.5 5 5/9
Numericl Integrtion 9 6.. Generting the coefficients nd weights using the method of undetermined coefficients N: This qudrture rule must integrte polynomil of degree exctly + x + x + x + w f(x ) + w f(x ) w w x x w ( + x ) w x x N: This qudrture rule must integrte polynomil of degree 5 exctly. + x + x + x + 4 x 4 + 5 x 5 + + 5 4 w ( + x + 4 x 4 ) + w w + w w x w x 4 5 x 5 / 5 x 5 w 5 w 5 9.5 9 + w w 8 9
Exmple: Evlute I sin πx We mke use of the trnsformtion of vribles x t( ) + t+ t x I sin πx.666977 ( + t) sin π dt ( ) sin π π cos.66959 + sin π ( + ) Compre this result with the trpezium rule using two function evlutions, which yields.5. Now using three point Guss-Legendre formul: I N 5 9. sin π ) π + 4 5 9 5 9 cos (.676877 5 + 8 9 sin π + 5 9 sin + 5 6.. Other Guss-Qudrture formule ) Hermite-Guss: w(x) e x (, b) (, ) e x f(x) w k f(x k ) + N! π N (N)! f (N) (ξ) w k N+ N! π [H N+ (x k )] m x k w k ±.777.8867..866 ±.4745.9549
) Chebyshev-Guss Qudrture: w(x) ( x ) [, b] [, ]. Numericl Integrtion f(x) N π w k f(x k ) + x N (N)! f (N) (ξ) w k π T N (x k)t N+ (x k ) π N (weights re ll equl). 6.4 Integrting Functions on Infinite Intervls Consider evluting integrls of the form If f(x) x p s x then exists only if p >. I f(x) x p x p p 6.4. Truncte the Infinite Intervl c I f(x) + f(x) c I + I Use the symptotic behviour of f to determine how lrge c should be for I < ϵ/ I c Eg. cos xe x cos xe x c ln(ϵ/) 8.4 OR use n symptotic pproximtion for I. Evlute I using the stndrd integrtion rules. c e x e c ϵ 8
6.4. Mp to Finite Intervl I Choose the mp such tht x p dt f(x) where f(x) x x p Eg. p : x p x t t dt I x t f(x) Now s t f ( ) ( ) t t t so integrnd is finite OR t e x x ln t f f(x) ( ) dt t t f( ln t) t OR [, ) [, S] [S, ) nd on [, S] set t x/s on [S, ) set t S/x dt 6.4. Specilized Guss integrtion rules for infinite intervls () Guss-Lguerre Integrtion: (, ) w e x e x f(x) g(x) (b) Guss-Hermite integrtion: (, ) w e x e x f(x) w k f(ξ k ) e x ( e x g(x) ) }{{} f(x) w k f(ξ k )
Numericl Integrtion 6.5 Adptive Integrtion 6.5. Adptive Simpson Integrtion I() h [f + 4f + f 5 ] h5 }{{} 9 f (4) (ξ) S (h) f f f f 4 f 5 h I() (h/) {[f + 4f + f + 4f 4 + f 5 ]} (h/)5 } {{} 9 S 4 (h) Assume f (4) (ξ) f (4) (ξ ) f (4) (ξ) pproximtely constnt. Substrct { } f (4) (ξ ) + f (4) (ξ ) S S 4 h5 9 f (4) (ξ) [ ] 5 5 ( ) h 5 6 9 f (4) (ξ) h 5 9 f (4) (ξ) 6 5 (S S 4 ) I() S 4 h5 9 f (4) (ξ) ( 4 ) 5 S S 4 I, I 4 is 5 S S 4 < TOL S 4 YES DONE NO is ( ) ( ) h h 5 S S 4 < TOL 6.5. The Best of Both Worlds Guss-Ptterson Integrtion Guss Qudrture Rules obtin the highest ccurcy for the lest number of function evlutions. x x x x Newton-Cotes Formule llow for utomtic nd dptive integrtion rules becuse the regulr grid llows one to use ll previous function evlutions towrd subsequent refinements - the dptive Trpezium rule is n exmple of this. The Guss-Ptterson integrtion rules llow one to build higher order integrtion schemes which mke use of previous function evlutions in subsequent clcultions. These rules hve the ttrctive high order ccurcy typicl of Guss qudrture rules. This is idel for dptive integrtion. Ptterson, T.N.L. 968, The Optimum Addition of Points T Qudrture Formuls, Mth. Comp.,, p. 847 856.