COSC 336 Numericl Anlysis I Numericl Integrtion nd Dierentition III - Guss Qudrture nd Adptive Qudrture Edgr Griel Fll 5 COSC 336 Numericl Anlysis I Edgr Griel
Summry o the lst lecture I For pproximting n integrl vlue one cn determine the pproximting polynomil o degree n The ccording integrl is then x dx p x dx = xi li x dx = A n i= For eqully spced points x, x,..., x n the ormul : is clled the Newton-Cotes ormul The Newton-Cotes ormul produce exct results, or eing polynomil o degree t most n n i= i x i : COSC 336 Numericl Anlysis I Edgr Griel
Summry o the lst lecture II Two wys o clculting the coeicients in the Newton-Cotes ormul hve een presented Using the Lgrnge orm o the interpolting polynomil Using the method o undetermined coeicients A i A i Nme Trpezoid rule 6 4 6 6 Simpsons rule 3 4 8 7 9 3 8 3 9 3 8 9 8 3 9 7 9 3/8 th rule Milne COSC 336 Numericl Anlysis I Edgr Griel
COSC 336 Numericl Anlysis I Edgr Griel Chnge o intervls I A ormul derived or certin intervl cn esily e dpted to ny other intervl y ming chnge o vrile e.g. using the sustitution nd or the pproximtion dt t dx x + = t x + = dt t dx x + = = + t A
Chnge o intervls II Even more generlly with x dx = t dt d c λ λ t = d c t d c d + d c c COSC 336 Numericl Anlysis I Edgr Griel
Qudrture Formuls Generl qudrture ormuls re descried y n x dx i= α t Bsic steps to solve n integrl using qudrture ormul: Determine the nots Construct the interpolting polynomil Determine the coeicients i t i i α i COSC 336 Numericl Anlysis I Edgr Griel
Composite Formuls I Applying integrtion ormul onto multiple intervls For equidistnt points x i = + ih with h = = x i xi x dx = i= Since Thus i COSC 336 Numericl Anlysis I Edgr Griel x x i x dx xi n x dx xi xi α xi + xi xi t x = i i= x x dx = x dx h x i i n i= = α x = i + ht h n = α x i + ht
Error estimtes I Trunction error or the composite Formul e trunc n = x dx h i= = h α x + i ht Assuming tht insted o the exct vlues x i + ht we ~ cn only clculte i, with ~ x ht ε i + i, COSC 336 Numericl Anlysis I Edgr Griel
The error is then Error estimtes II n x dx h i= = ~ e h = α n x dx h i= = i, α x i + ht + h n i= = α e trunc n ~ x + ht h α i i= = i, e roundo COSC 336 Numericl Anlysis I Edgr Griel
Error estimtes III Since Newton-Cotes ormul is exct or ll polynomils o degree t most n, ll methods o order > hve to integrte p t = c exctly. Thus p t dt = c = = α = c Using 9: we cn rewrite the roundo error n n ~ e h α x + ht h α roundo i= = n i= = i = α : i= = i, hε α : COSC 336 Numericl Anlysis I Edgr Griel
Error estimtes IV I ll vlues or re positive nd = e = α α roundo = α = hnε = ε I not ll vlues o α re positive, eqution : is not correct Roundo error is mgniied y the process Clcultion is not stle : COSC 336 Numericl Anlysis I Edgr Griel
Conclusions All Newton-Cotes ormuls with purely positive coeicients re numericlly stle α This is only the cse or the lgorithms o degree nd = 9 Algorithms or = 8 or hve some negtive coeicients nd re thereore not stle α 7 COSC 336 Numericl Anlysis I Edgr Griel
Generlized qudrture ormuls Newton-Cotes For the ormul o degree n we hd n coeicients which hd to e determined The choice o nodes were done priori The equtions to determine the coeicients were set up such tht the ormul produces exct results or ll polynomils o degree t most n Other deinitions or the coeicients might e useul s well e.g. Cheyshev s qudrture ormuls n n x dx α ti = α i= i= COSC 336 Numericl Anlysis I Edgr Griel t i t i
Gussin qudrture ormuls I Gussin qudrture: Determine the nots such tht the resulting ormuls o degree n is exct or ll polynomils o degree n+ Introduce weight unction wx such tht n x w x dx i= α t i i Furthermore, let q e nonzero polynomil o degree n+ tht is w-orthogonl to Π n. Thus, or ny polynomil o degree n we hve q x p x w x dx = 4: COSC 336 Numericl Anlysis I Edgr Griel
Gussin qudrture ormuls II Using the zeros o qx, ormul 4: will e exct or ll polynomils o degree n+ The polynomils qx with the desired ehviour re clled Legendre polynomils All zeros re simple roots Zeros o these unctions re well documented or mny degrees n Ater determining the zeros o the Legendre Polynomils o degree n, determine the coeicients α using e.g. the method o undetermined coeicients COSC 336 Numericl Anlysis I Edgr Griel
Exmple Determine the Gussin qudrture rule when [,]=[-,], wx= nd n= The orthogonl polynomils re: q x = q 3 x = x q x = x q3 x = x 3 The roots o q 3 x re, ± 3 5 Thus, 3 3 x dx α + α 5 + α 5 Using the method o undetermined coeicients one otins α = 5 α = 8 9 9 α = 5 9 3 5 x COSC 336 Numericl Anlysis I Edgr Griel
Coeicients o the Gussin Qudrture ormuls All coeicients nd zeros re trnsormed to the intervl [,] αi ti Degree 3 + 6 63 4 3 5 8 8 8 5 8 5 + 5 6 COSC 336 Numericl Anlysis I Edgr Griel
Adptive Qudrture Given: unction, intervl [,], required ccurcy I given method will not e suiciently ccurte on the given intervl, divide the intervl into two equl prts Repet this procedure until desired ccurcy hs een reched Prolem: how to estimte the error o the qudrture lgorithm used COSC 336 Numericl Anlysis I Edgr Griel
Adptive Qudrture II Exmple: Simpson s rule + x dx = [ + 4 + + E, 6 with the error term eing E, = 9 or slightly rewritten: v u [ / ] S, 5 4 ξ 5 4 x dx = S u, v [ v u / ] ξ 9 9: COSC 336 Numericl Anlysis I Edgr Griel
Adptive Qudrture III When sudividing into two sudomins v x dx = x dx + u w x dx u v w 5 4 = S u, w [ w u / ] ξ 9 5 4 + S w, v [ v w / ] ξ3 9 5 v u 4 = S u, w + S w, v [ ξ + 9 4 ξ 3 ] : COSC 336 Numericl Anlysis I Edgr Griel
Adptive Qudrture IV 4 4 4 With ξ = [ ξ + ξ3] eqution : ecomes v 5 4 x dx = S u, w + S w, v v u ξ 9 9 u Note: ech sudomin hs to ulill the locl error term given y e i ε x x / v u i i 4 Note: ξ usully not ville. Assumption: over 4 smll intervl ξ = c. Thus 4 4 ξ = ξ : : :3 COSC 336 Numericl Anlysis I Edgr Griel
Adptive Qudrture V 4 Using :3 the term ξ cn e eliminted y multiplying : y 6/5 multiplying 9: y /5 sutrcting : rom :. This leds to v u x dx S u, w + S w, v + [ S u, w + S w, v S u, v] 5 : : :3 Error estimte COSC 336 Numericl Anlysis I Edgr Griel
Adptive Qudrture - Algorithm Given:,,, h=-/ l=h/ Clculte,+l,+h,+h+l, Clculte S,, S,+h, S+h, Clculte error term: e=/5[s,+h+s+h,- S,] Compre e with the locl error term s deined in : I ccurcy not stisctory, strt the sme procedure twice y setting =, =+h =+h, = COSC 336 Numericl Anlysis I Edgr Griel