Lcur : Numrical ngraion Th Trapzoidal and Simpson s Rul A problm Th probabiliy of a normally disribud (man µ and sandard dviaion σ ) vn occurring bwn h valus a and b is B A P( a x b) d () π whr a µ b - µ A and B σ σ For a disribuion wih man µ and sandard dviaion σ wha is h probabiliy of an vn occurring in h inrval 3 x. No his will giv valus of A and B.An answr can b radily obaind from a numbr of wb calculaors as P( 3 x, µ, σ ) π d 0.687 () i.., ~68% of h ara in a normal disribuion lis wihin on sandard dviaion of h man. Bu how do hs calculaors work. Th objciv in () is o calcula h ingral d s hr a known ingral for h funcion Look in vain in / x hp://n.wikipdia.org/wiki/lis_of_ingrals_of_irraional_funcions So l us rcord som valus of / in our ingral domain - -0.8-0.6-0.4-0. 0 0. 0.4 0.6 0.8 0.6065 0.76 0.8353 0.93 0.980.0000 0.980 0.93 0.8353 0.76 0.6065
And hn plo h funcion.00.000 0.800 0.600 0.400 0.00 0.000 -.5 - -0.5 0 0.5.5 From h dfiniion of an ingral w know ha d s h ara undr h curv. How can w sima his. A common numrical approach is o spli h problm up ino bis a discrizaion. To sar l us choos ara srips of widh 0.. Th firs wo srips of h rquirs ara will look lik his 0.900 f ( ) / 0.3 0.800 0.700 0.600 f ( ) / 0.8 0.500 0.400 f ( ) / 0.5 0.300 0.00 0.00 0.000 -. - -0.8-0.6-0.4-0. 0
Each srip looks lik a rapzoid his is no sricly ru sinc h op lin is no sraigh bu curvd. Nvr-h-lss i is rasonabl o assum ha h op lin is sraigh hn h ara of srip is 0.5 0.3 f ( s a r ) f ( ) srip widh avrag high 0. 0.337 A s a r And of srip 0.3 0.8 f ( s a r ) f ( ) 0. 0.56 A s a r And of srip i 0 f ( s a r ( i ) ) f ( s a r Ai i ) Hnc h oal ara of h n approximaing srips is n d sar n f ( ) d [ f ( s a r ( i ) ) f ( s a r i )] (3) i whr in h cas undr considraion f ( ) s a r nd nd / s a r n s a r n (4) n 0 0. NOTE on choosing h numbr of srips n (3) and (4) will approxima any gnral dfini ingral n d f ( ) d sar Th approximaion in (3) and (4) is calld h rapzoidal rul
A sprad sh calculaion for our xampl problm wih n 0 srips givs d.707 -valu - -0.8-0.6-0.4-0. 0 0. 0.4 0.6 0.8 f() 0.607 0.76 0.835 0.93 0.980.000 0.980 0.93 0.835 0.76 0.607 Ara 0.33 0.56 0.76 0.9 0.98 0.98 0.9 0.76 0.56 0.33 Sum 0.33 0.89 0.465 0.656 0.854.05.4.48.574.707 On noing ha by () P( a x b) 0.68 (5) π Th ral answr (o 4 placs of accuracy) is 0.687 so w hav only go o wo placs of accuracy. Why would you xpc h undrsima in (5)? How can w mak h answr mor accura? (Thr ar wo answrs) W could us mor srips: Ls mak a abl of rapzoidal calculaions wih n 4,8,6,3,64,.. srips n P 4 0.675 8 0.680 6 0.68 3 0.685 64 0.687 8 0.687 A lo of work bu w do g hr. Th alrnaiv is o us a br approximaion for h ara ha aks ino accoun h curvd ops. Wih rapzoids w usd a sraigh lin o us quadraic. l ( ) m c approximaion a br opion may b q a a a3
0.900 f ( ) / 0.3 0.800 0.700 0.600 f ( ) / 0.8 0.500 0.400 f ( ) / 0.5 0.300 0.00 0.00 0.000 -. - -0.8-0.6-0.4-0. 0 This has hr dgrs of frdom w can mak hr choics for h cofficins a L us considr h firs TWO srips A suiabl quadraic approximaion q () will b h on ha coincids wih h funcion f () a boundaris of h srips, i.., a h poins,, s a r s a r s a r This quadraic is ( q( ) s a r )( s a r ) f ( s a r ) ( s a r )( s a r ) f ( s a r ) (6) ( s a r )( s a r ) f ( s a r ) Thn for h firs wo srips ingraion undr his curv approximas h ral ingral undr h curv f (), i.., sar sar sar sar f ( ) d sar sar q( ) d 3 [ f ( ) 4 f ( ) f ( ) ] s a r s a r s a r Wih h quadraic in (6) w can ingra analyically (i aks a lo of algbra bu w do nd up wih h righ hand rsul shown. So imagin ha w spli h ara of our ingral ino an EVEN numbr of srips n
Thn h ara of h pair of srips bwn h i h h and i srip boundaris is sar ( i ) sar ( i ) i q( ) d s a r s a r s a r sar 3 sar i [ f ( i ) 4 f ( ( i ) ) f ( ( i ) ) ] Equaion (7) is rfrrd o as Simpson s Rul. n h sam way as h rapzoidal rul i can b usd o find h dfini ingral of a gnral funcion f () by choosing an qual numbr of srips and hn calculaing and summing h approxima aras in ach srip pair by (7). This is radily don on a spradsh for valus of n,4,8,6,.. n P 0.693 4 0.683 8 0.687 6 0.687 Rcall P / π, and NOTE ha h Simpson s Rul rquirs lss srips convrgs o 4 poin accuracy wih 8 Srips. Th Trapzoidal rquird 64. Mak sur ha you can calcula Simposn s rul and Trapzoidal rul By hand (wih a calculaor) undr xam condiions. (7)