Module

for

Numerical Differentiation, Part I

   

Background.

    Numerical differentiation formulas formulas can be derived by first constructing the Lagrange interpolating polynomial  [Graphics:Images/NumericalDiffMod_gr_1.gif] through three points, differentiating the Lagrange polynomial, and finally evaluating  [Graphics:Images/NumericalDiffMod_gr_2.gif]  at the desired point.  In this module the truncation error will be investigated, but round off error from computer arithmetic using computer numbers will be studied in another module.

Theorem  (Three point rule for [Graphics:Images/NumericalDiffMod_gr_3.gif]).  The central difference formula for  the first derivative, based on three points is  

    [Graphics:Images/NumericalDiffMod_gr_4.gif],  

and the remainder term is

    [Graphics:Images/NumericalDiffMod_gr_5.gif].

Together they make the equation  [Graphics:Images/NumericalDiffMod_gr_6.gif],  and the truncation error bound is  

    [Graphics:Images/NumericalDiffMod_gr_7.gif]  

where  [Graphics:Images/NumericalDiffMod_gr_8.gif].  This gives rise to the Big "O" notation for the error term for  [Graphics:Images/NumericalDiffMod_gr_9.gif]:

    [Graphics:Images/NumericalDiffMod_gr_10.gif].   

Proof  Numerical Differentiation  Numerical Differentiation

 

Theorem  (Three point rule for [Graphics:Images/NumericalDiffMod_gr_11.gif]).  The central difference formula for the second derivative, based on three points is  

    [Graphics:Images/NumericalDiffMod_gr_12.gif],  

and the remainder term is

    [Graphics:Images/NumericalDiffMod_gr_13.gif].

Together they make the equation  [Graphics:Images/NumericalDiffMod_gr_14.gif],  and the truncation error bound is  

    [Graphics:Images/NumericalDiffMod_gr_15.gif]  

where  [Graphics:Images/NumericalDiffMod_gr_16.gif].    This gives rise to the Big "O" notation for the error term for  [Graphics:Images/NumericalDiffMod_gr_17.gif]:

    [Graphics:Images/NumericalDiffMod_gr_18.gif] [Graphics:Images/NumericalDiffMod_gr_19.gif].  

Proof  Numerical Differentiation  Numerical Differentiation

 

Animations (Numerical Differentiation  Numerical Differentiation).  Internet hyperlinks to animations.

 

Computer Programs  Numerical Differentiation  Numerical Differentiation

 

 

Project I.  

    Investigate the numerical differentiation formula  [Graphics:Images/NumericalDiffMod_gr_20.gif]  and truncation error bound  [Graphics:Images/NumericalDiffMod_gr_21.gif]  where  [Graphics:Images/NumericalDiffMod_gr_22.gif].   The truncation error is investigated.  The round off error from computer arithmetic using computer numbers will be studied in another module.

Enter the three point formula for numerical differentiation.

[Graphics:Images/NumericalDiffMod_gr_23.gif]

[Graphics:Images/NumericalDiffMod_gr_24.gif]

Aside.  From a mathematical standpoint, we expect that the limit of the difference quotient is the derivative. Such is the case, check it out.

[Graphics:Images/NumericalDiffMod_gr_25.gif]

[Graphics:Images/NumericalDiffMod_gr_26.gif]

Example 1.  Consider the function  [Graphics:Images/NumericalDiffMod_gr_27.gif].   Find the formula for the third derivative [Graphics:Images/NumericalDiffMod_gr_28.gif], it will be used in our explorations for the remainder term and the truncation error bound.  Graph  [Graphics:Images/NumericalDiffMod_gr_29.gif].  Find the bound  [Graphics:Images/NumericalDiffMod_gr_30.gif].  Look at it's graph and estimate the value  [Graphics:Images/NumericalDiffMod_gr_31.gif], be sure to take the absolute value if necessary.
Solution 1.

 

Example 2 (a).  Compute numerical approximations for the derivative  [Graphics:Images/NumericalDiffMod_gr_44.gif],  using step sizes  [Graphics:Images/NumericalDiffMod_gr_45.gif],  include the details.
2 (b).  Compute numerical approximations for the derivatives [Graphics:Images/NumericalDiffMod_gr_46.gif],  using step sizes [Graphics:Images/NumericalDiffMod_gr_47.gif].  
2 (c).  Plot the numerical approximation  [Graphics:Images/NumericalDiffMod_gr_48.gif] over the interval  [Graphics:Images/NumericalDiffMod_gr_49.gif].  Compare it with the graph of  [Graphics:Images/NumericalDiffMod_gr_50.gif]  over the interval  [Graphics:Images/NumericalDiffMod_gr_51.gif].
Solution 2 (a).
Solution 2 (b).
Solution 2 (c).

 

Example 3.  Plot the absolute error  [Graphics:Images/NumericalDiffMod_gr_91.gif]  over the interval  [Graphics:Images/NumericalDiffMod_gr_92.gif],  and estimate the maximum absolute error over the interval.
3 (a).  Compute the error bound  [Graphics:Images/NumericalDiffMod_gr_93.gif]  and observe that  [Graphics:Images/NumericalDiffMod_gr_94.gif]  over  [Graphics:Images/NumericalDiffMod_gr_95.gif].  
3 (b).  Since the function f[x] and its derivative is well known, and we have the graph for [Graphics:Images/NumericalDiffMod_gr_96.gif],  we can observe that the maximum error on the given interval occurs at x=0.  Thus we can do better that "theory", we see that [Graphics:Images/NumericalDiffMod_gr_97.gif]  over  [Graphics:Images/NumericalDiffMod_gr_98.gif].
Solution 3.

 

Example 4.  Investigate the behavior of  [Graphics:Images/NumericalDiffMod_gr_118.gif].  If the step size is reduced by a factor of  [Graphics:Images/NumericalDiffMod_gr_119.gif]  then the error bound is reduced by  [Graphics:Images/NumericalDiffMod_gr_120.gif].  This is the  [Graphics:Images/NumericalDiffMod_gr_121.gif]  behavior.
Solution 4.

 

 

Project II.  

    Investigate the numerical differentiation formulae  [Graphics:Images/NumericalDiffMod_gr_135.gif]  and truncation error bound  [Graphics:Images/NumericalDiffMod_gr_136.gif]  where  [Graphics:Images/NumericalDiffMod_gr_137.gif].  The truncation error is investigated.  The round off error from computer arithmetic using computer numbers will be studied in another module.

Enter the formula for numerical differentiation.

[Graphics:Images/NumericalDiffMod_gr_138.gif]

[Graphics:Images/NumericalDiffMod_gr_139.gif]

Aside.  It looks like the formula is a second divided difference, i.e. the difference quotient of two difference quotients.  Such is the case.

[Graphics:Images/NumericalDiffMod_gr_140.gif]

[Graphics:Images/NumericalDiffMod_gr_141.gif]

Aside.  From a mathematical standpoint, we expect that the limit of the second divided difference is the second derivative. Such is the case.

[Graphics:Images/NumericalDiffMod_gr_142.gif]

[Graphics:Images/NumericalDiffMod_gr_143.gif]

Example 5.  Consider the function  [Graphics:Images/NumericalDiffMod_gr_144.gif].   Find the formula for the fourth derivative [Graphics:Images/NumericalDiffMod_gr_145.gif], it will be used in our explorations for the remainder term and the truncation error bound.  Graph  [Graphics:Images/NumericalDiffMod_gr_146.gif].  Find the bound  [Graphics:Images/NumericalDiffMod_gr_147.gif].  Look at it's graph and estimate the value  [Graphics:Images/NumericalDiffMod_gr_148.gif],  be sure to take the absolute value if necessary.
Solution 5.

 

Example 6 (a).  Compute numerical approximations for the derivatives [Graphics:Images/NumericalDiffMod_gr_161.gif],  using step sizes [Graphics:Images/NumericalDiffMod_gr_162.gif] .  
6 (b).  Plot the numerical approximation  [Graphics:Images/NumericalDiffMod_gr_163.gif] over the interval  [Graphics:Images/NumericalDiffMod_gr_164.gif].  Compare it with the graph of  [Graphics:Images/NumericalDiffMod_gr_165.gif]  over the interval  [Graphics:Images/NumericalDiffMod_gr_166.gif].
Solution 6 (a).
Solution 6 (b).

 

Example 7.  Plot the absolute error  [Graphics:Images/NumericalDiffMod_gr_175.gif]  over the interval  [Graphics:Images/NumericalDiffMod_gr_176.gif],  and estimate the maximum absolute error over the interval.  
7 (a).  Compute the error bound  [Graphics:Images/NumericalDiffMod_gr_177.gif]  and observe that  [Graphics:Images/NumericalDiffMod_gr_178.gif]  over  [Graphics:Images/NumericalDiffMod_gr_179.gif].  
7 (b).  Since the function f[x] and its derivative is well known, and we have the graph for [Graphics:Images/NumericalDiffMod_gr_180.gif],  we can observe that the maximum error on the given interval occurs at x=0.  Thus we can do better that "theory", we see that [Graphics:Images/NumericalDiffMod_gr_181.gif]  over  [Graphics:Images/NumericalDiffMod_gr_182.gif].
Solution 7.

 

Example 8.  Investigate the behavior of  [Graphics:Images/NumericalDiffMod_gr_203.gif].  If the step size is reduced by a factor of  [Graphics:Images/NumericalDiffMod_gr_204.gif]  then the error bound is reduced by  [Graphics:Images/NumericalDiffMod_gr_205.gif].  This is the  [Graphics:Images/NumericalDiffMod_gr_206.gif]  behavior.
Solution 8.

 

Various Scenarios and Animations for Numerical Differentiation.

Example 9.  Given  [Graphics:Images/NumericalDiffMod_gr_220.gif], find numerical approximations to the derivative  [Graphics:Images/NumericalDiffMod_gr_221.gif], using two points and the forward difference formula.
Solution 9.

 

Example 10.  Given  [Graphics:Images/NumericalDiffMod_gr_241.gif], find numerical approximations to the derivative  [Graphics:Images/NumericalDiffMod_gr_242.gif], using two points and the backward difference formula.
Solution 10.

 

Example 11.   Given  [Graphics:Images/NumericalDiffMod_gr_262.gif], find numerical approximations to the derivative  [Graphics:Images/NumericalDiffMod_gr_263.gif], using two points and the central difference formula.
Solution 11.

 

Example 12.  Given  [Graphics:Images/NumericalDiffMod_gr_283.gif], find numerical approximations to the derivative  [Graphics:Images/NumericalDiffMod_gr_284.gif], using three points and the forward difference formula.
Solution 12.

 

Example 13.  Given  [Graphics:Images/NumericalDiffMod_gr_304.gif], find numerical approximations to the derivative  [Graphics:Images/NumericalDiffMod_gr_305.gif], using three points and the backward difference formula.
Solution 13.

 

Example 14.  Given  [Graphics:Images/NumericalDiffMod_gr_325.gif], find numerical approximations to the derivative  [Graphics:Images/NumericalDiffMod_gr_326.gif], using three points and the central difference formula.
Solution 14.

 

Example 15.   Given  [Graphics:Images/NumericalDiffMod_gr_346.gif], find numerical approximations to the second derivative  [Graphics:Images/NumericalDiffMod_gr_347.gif], using three points and the forward difference formula.
Solution 15.

 

Example 16.   Given  [Graphics:Images/NumericalDiffMod_gr_367.gif], find numerical approximations to the second derivative  [Graphics:Images/NumericalDiffMod_gr_368.gif], using three points and the backward difference formula.
Solution 16.

 

Example 17.  Given  [Graphics:Images/NumericalDiffMod_gr_388.gif], find numerical approximations to the second derivative  [Graphics:Images/NumericalDiffMod_gr_389.gif], using three points and the central difference formula.
Solution 17.

 

Animations (Numerical Differentiation  Numerical Differentiation).  Internet hyperlinks to animations.

 

Old Lab Project (Numerical Differentiation  Numerical Differentiation).  Internet hyperlinks to an old lab project.  

 

Research Experience for Undergraduates

Numerical Differentiation  Numerical Differentiation  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook Numerical Differentiation

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004