Numerical DifferentiationNumerical Differentiation and Integration/ad teg at o /Numerical Differentiation ByDr Ali JawarnehDr Ali Jawarneh1Dr Ali JawarnehCh23:Numerical Differentiation and Ch.23:Numerical Differentiation and Integration/ Numerical Differentiation23.1- High-Accuracy Differentiation Formulas232Ri h d E t l ti23.2-Richardson Extrapolation23.3- Derivatives of Unequally Spaced Data Spaced Data 2Dr Ali JawarnehNUMERICAL DIFFERENTIATIONHigh-Accuracy Differentiation FormulasIt provides a mean to predict a function value at one point in terms of the Taylor series function value and it’s derivative at another point. Taylor series expansions are used to derive finite-divided-difference approximations of derivatives.)(fTrue derivative)x(fforwardh=xi+1-xi=xi-xi-1backwardcenteredxx1ixxhhDr Ali Jawarneh 31ix+ix1ix−(old) (present) (new))x(f!n1awhere)xx(a)x(f0)n(nn00nm=−=∑∞=Taylor Series0n=...)x('"f!33)xx()x("f!22)xx()x('f!1)xx()x(f)x(fo0o0o00+−+−+−+=Series2)x("fForward Taylorn: is order of the seriesni1ii)n(3i1ii2i1iii1iii1i)xx()x(f...)xx()x('"f)xx(!2)x(f)xx)(x('f)x(f)x(f−++−+−+−+=+++i1ixxh−=+i1ii1i)xx(!n...)xx(!3++++)x("fBackward Taylorni)n(3i21iii1iiii1i)xx()x(f)xx()x('"f)xx(!2)x(f)xx)(x('f)x(f)x(f−−−−+−+−−−+−−=1iixxh−−=Dr Ali Jawarneh 41ii1ii)xx(!n......)xx(!3−−−+−+−)n()x(f)x('"f)x("fForward Taylor(1)ni3i2iii1ih!n)x(f...h!3)x(fh!2)x(fh)x('f)x(f)x(f+++++=+Zero order (n=0):)h(O)x(f)x(fi1i+=+O(h): Truncation(1)())()()(i1i+1storder (n=1):)h(Oh)x('f)x(f)x(f2ii1i++=+2ndorder (n=2):)x("f32iO(h): Truncation error of order h2ndorder (n=2):)h(Oh!2)x(fh)x('f)x(f)x(f32iii1i+++=+Backward TaylorBackward Taylorni)n(3i2iii1ih!n)x(f......h!3)x('"fh!2)x("fh)x('f)x(f)x(f +−+−+−=−(2)Dr Ali JawarnehZero order:)h(O)x(f)x(fi1i+=−)h(Oh)x('f)x(f)x(f2ii1i+−=−1storder:5)h(Oh!2)x("fh)x('f)x(f)x(f32iii1i++−=−2ndorder:Forward Approximation)x("f(3)...h!2)x("fh)x('f)x(f)x(f2iii1i+++=+from (1)h)x("f)x(f)x(f)('fii1i−+(3)...h!2)(h)()()x('fii1ii++=+)h(O)x(f)x(f)x('fi1i+−+Forward1stderivative of order h)h(Oh)x('fi+=Similar to (1)...)h2()x("f)h2)(x('f)x(f)x(f2iii2i+++=Forward , 1derivative of order h(4)Similar to (1)...)h2(!2)h2)(x(f)x(f)x(fii2i++++Multiplication Eq.(3) with 2, then subtract the result from (4), you will get:)x(f)x(f2)x(f+Fd2dd i ti())h(Oh)x(f)x(f2)x(f)x("f2i1i2ii++−=++Forward , 2nd derivative of order hDr Ali Jawarneh 6from (1)...h!3)x('"fh!2)x("fh)x('f)x(f)x(f3i2iii1i++++=+!3!2h)x("f)x(f)x(f22ii1i−Use also Forward , 2nd derivative of order h)h(Oh)]x(f)x(f2)x(f[)x(f)x(f)h(Ohh!2)x(fh)x(f)x(f)x('f22i1i2ii1i2ii1ii++−−=+−=++++)h(Oh!2hh2+−=Collecting terms:)h(Oh2)x(f3)x(f4)x(f)x('f2i1i2ii+−+−=++Forward , 1stderivative of order h2Dr Ali Jawarneh 7Backward Approximation)('"f)("fFrom (2)...h!3)x('"fh!2)x("fh)x('f)x(f)x(f3i2iii1i+−+−=−)x(f)x(f1ii−t(5))h(Oh)x(f)x(f)x('f1iii+=−Backward , 1stderivative of order hSimilar to (2)...)h2()x("f)h2)(x('f)x(f)x(f2iii2i−+−=(6)...)h2(!2)h2)(x(f)x(f)x(fii2i+−Multiplication Eq.(5) with 2, then subtract the result from (6), you will get:(6))x(f)x(f2)x(f+bk d2dd i ti f)h(Oh)x(f)x(f2)x(f)x("f22i1iii=+−=−−backward , 2nd derivative of order hDr Ali Jawarneh 8from (2)+−+−=−3i2iii1ih!3)x('"fh!2)x("fh)x('f)x(f)x(fUse also Backward , 2nd derivative of order h1h])x(f)x(f2)x(f[)x(f)x(f)x('f22i1ii1ii−−−+−+−=h!2]h[h)x(f2i+=Collecting terms:)h(Oh)x(f)x(f4)x(f32)x('f22i1iii++−=−−Dr Ali Jawarneh 9Centered ApproximationSubtract (1) from (2))h(Oh2)x(f)x(f)x('f21i1ii+−=−+Dr Ali Jawarneh 10Summary of Finite-Divided-Difference Formulas(1) Forward FiniteDividedDifference Formulas(1) Forward Finite-Divided-Difference Formulas1stderivative:)h(Oh)x(f)x(f)x('fi1ii+−=+h)h(Oh2)x(f3)x(f4)x(f)x('f2i1i2ii+−+−=++More accurate2ndderivative:h2)x(f)x(f2)x(f+)h(Oh)x(f)x(f2)x(f)x("f2i1i2ii++−=++)(f2)(f5)(f4)(f)h(Oh)x(f2)x(f5)x(f4)x(f)x("f22i1i2i3ii++−+−=+++Dr Ali Jawarneh 11More accurate(2) Backward FiniteDividedDifference Formulas(2) Backward Finite-Divided-Difference Formulas1stderivative:)h(Oh)x(f)x(f)x('f1iii+−=−h)h(Oh2)x(f)x(f4)x(f3)x('f22i1iii++−=−−More accurate2ndderivative:h2)x(f)x(f2)x(f+)h(Oh)x(f)x(f2)x(f)x("f22i1iii++−=−−)(f)(f4)(f5)(f2)h(Oh)x(f)x(f4)x(f5)x(f2)x("f223i2i1iii+−+−=−−−Dr Ali Jawarneh 12More accurate(3) Centered FiniteDividedDifference Formulas(3) Centered Finite-Divided-Difference Formulas1stderivative:)h(Oh2)x(f)x(f)x('f21i1ii+−=−+h2)h(Oh12)x(f)x(f8)x(f8)x(f)x('f42i1i1i2ii++−+−=−−++More accurate2ndderivative:h12)x(f)x(f2)x(f+)h(Oh)x(f)x(f2)x(f)x("f221ii1ii++−=−+)(f)(f16)(f30)(f16)(f)h(Oh12)x(f)x(f16)x(f30)x(f16)x(f)x("f422i1ii1i2ii+−+−+−=−−++Dr Ali Jawarneh 13More accurateTwo ways to improve derivative estimates when employing finite divided differences(1)Decrease the step size(1)Decrease the step size(2) Use a higher-order formula that employs more pointsDr Ali Jawarneh 14Example: Find the first derivative of y= cos(x) at x=π/4 using a step size of h=π/12Use forward and backwardusing a step size of h= π/12.Use forward and backward approximations of O(h) & O(h2) , and central difference approximation of O(h2) and O(h4). Also, estimate the true tltifh itipercent relative error εtfor each approximation.SolutionForward )h(O)x(f)x(f)('fi1i−+)x(fForward )h(Oh)()()x('fi1ii+=+)h(Oh2)x(f3)x(f4)x(f)x('f2i1i2ii+−+−=++xhh2Backward)h(Oh)x(f)x(f)x('f1iii+−=−x2ix− 1ix− ix1ix+ 2ix+)h(Oh2)x(f)x(f4)x(f3)x('f22i1iii++−=−−Centered)h(O)x(f)x(f)x('f21i1ii+−=−+12π6π4π3π125πDr Ali Jawarneh15)h(Oh2)x(fi+)h(Oh12)x(f)x(f8)x(f8)x(f)x('f42i1i1i2ii++−+−=−−++xf(x) (radian)Xπ/120965925826(radian70710678.0)4sin(|)4('ftrue−=π−=πXi‐2π/120.965925826Xi‐1π/60.866025404Xiπ/40.707106781(radianForward )h(Oh)x(f)x(f)x('fi1ii+−=+)4/()3/(Xiπ/40.707106781Xi+1π/30.5Xi+25π/120.25881904579108963.012/)4/cos()3/cos()4('f −=ππ−π=π)h(O)x(f3)x(f4)x(f)x('f2i1i2ii+−+−=++i+2/)(h2)(i72601275.012/2)4/cos(3)3/cos(4)12/5cos()4/('f −=ππ−π+π−=πBackward)h(Oh)x(f)x(f)x('f1iii+−=−60702442.012/)6/cos()4/cos()4/('f −=ππ−π=π)x(f)x(f4)x(f32+−)h(Oh2)x(f)x(f4)x(f3)x('f22i1iii++=−−71974088.012/2)12/cos()6/cos(4)4/cos(3)x('fi−=ππ+π−π=Dr Ali Jawarneh
View Full Document