Chapter 4Numerical Differentiation and IntegrationPer-Olof Persson[email protected]Department of MathematicsUniversity of California, BerkeleyMath 128A Numerical Analysis
Numerical DifferentiationForward and Backward DifferencesInspired by the definition of derivative:f0(x0) = limh→0f(x0+h)-f(x0)h,choose a smallhand approximatef0(x0)≈f(x0+h)-f(x0)hThe error term for the linear Lagrange polynomial gives:f0(x0) =f(x0+h)-f(x0)h-h2f00(ξ)Also known as theforward-difference formulaifh >0and thebackward-difference formulaifh <0
General Derivative ApproximationsDifferentiation of Lagrange PolynomialsDifferentiatef(x) =nXk=0f(xk)Lk(x) +(x-x0)· · ·(x-xn)(n+ 1)!f(n+1)(ξ(x))to getf0(xj) =nXk=0f(xk)L0k(xj) +f(n+1)(ξ(xj))(n+ 1)!Yk6=j(xj-xk)This is the(n+ 1)-point formulafor approximatingf0(xj).
Commonly Used FormulasUsing equally spaced points withh=xj+1-xj, we have thethree-point formulasf0(x0) =12h[-3f(x0) + 4f(x0+h)-f(x0+ 2h)] +h23f(3)(ξ0)f0(x0) =12h[-f(x0-h) +f(x0+h)]-h26f(3)(ξ1)f0(x0) =12h[f(x0-2h)-4f(x0-h) + 3f(x0)] +h23f(3)(ξ2)f00(x0) =1h2[f(x0-h)-2f(x0) +f(x0+h)]-h212f(4)(ξ)and thefive-point formulaf0(x0) =112h[f(x0-2h)-8f(x0-h) + 8f(x0+h)-f(x0+ 2h)]+h430f(5)(ξ)
OptimalhConsider the three-point central difference formula:f0(x0) =12h[f(x0+h)-f(x0-h)]-h26f(3)(ξ1)Suppose that round-off errorsεare introduced whencomputingf. Then the approximation error isf0(x0)-˜f(x0+h)-˜f(x0-h)2h≤εh+h26M=e(h)where˜fis the computed function and|f(3)(x)| ≤MSum oftruncation errorh2M/6andround-off errorε/hMinimizee(h)to find the optimalh=3p
Get answer to your question and much more
Richardson’s ExtrapolationSupposeN(h)approximates an unknownMwith errorM-N(h) =K1h+K2h2+K3h3+· · ·then anO(hj)approximation is given forj= 2,3, . . .byNj(h) =Nj-1h2+Nj-1(h/2)-Nj-1(h)2j-1-1The results can be written in a table:O(h)O(h2)O(h3)O(h4)1:N1(h)≡N(h)2:N1(h2)≡N(h2)3:N2(h)4:N1(h4)≡N(h4)5:N2(h2)6:N3(h)7:N1(h8)≡N(h8)8:N2(h4)9:N3(h2)10:N4(h)
Richardson’s ExtrapolationIf some error terms are zero, different and more efficientformulas can be derivedExample: IfM-N(h) =K2h2+K4h4+· · ·then anO(h2j)approximation is given forj= 2,3, . . .byNj(h) =Nj-1h2+Nj-1(h/2)-Nj-1(h)4j-1-1
Numerical QuadratureIntegration of Lagrange Interpolating PolynomialsSelect{x0, . . . , xn}in[a, b]and integrate the Lagrange polynomialPn(x) =∑ni=0f(xi)Li(x)and its truncation error term over[a, b]to obtainZ