The numerical differentiation is based on the approximation of the function from which the derivative is taken by the interpolation polynomial . All basic formulas for numerical differentiation can be obtained using the first Newton interpolation polynomial (Newton's formulas for the beginning of the table).
The main tasks are to calculate the derivative at the edges of the table and in its middle. For a uniform grid, the numerical differentiation formulas “at the beginning of the table” can be represented in a general form as follows:
- {\ displaystyle f '_ {i} = {\ frac {1} {bh}} \ sum _ {j} a_ {j} f_ {i + j} + \ Delta (f),}
Where {\ displaystyle \ Delta (f)} - the error of the formula. Here are the coefficients {\ displaystyle a_ {j}} and {\ displaystyle b} depend on the degree n of the interpolation polynomial used, that is, on the necessary accuracy (convergence rate to the exact value with decreasing grid step) of the formula. The coefficients are presented in the table.
| {\ displaystyle n} | {\ displaystyle a_ {0}} | {\ displaystyle a_ {1}} | {\ displaystyle a_ {2}} | {\ displaystyle a_ {3}} | {\ displaystyle a_ {4}} | {\ displaystyle a_ {5}} | {\ displaystyle b} |
| {\ displaystyle 1} | {\ displaystyle -1} | {\ displaystyle 1} | {\ displaystyle 0} | {\ displaystyle 0} | {\ displaystyle 0} | {\ displaystyle 0} | {\ displaystyle 1} |
| {\ displaystyle 2} | {\ displaystyle -3} | {\ displaystyle 4} | {\ displaystyle -1} | {\ displaystyle 0} | {\ displaystyle 0} | {\ displaystyle 0} | {\ displaystyle 2} |
| {\ displaystyle 3} | {\ displaystyle -11} | {\ displaystyle 18} | {\ displaystyle -9} | {\ displaystyle 2} | {\ displaystyle 0} | {\ displaystyle 0} | {\ displaystyle 6} |
| {\ displaystyle 4} | {\ displaystyle -25} | {\ displaystyle 48} | {\ displaystyle -36} | {\ displaystyle 16} | {\ displaystyle -3} | {\ displaystyle 0} | {\ displaystyle 12} |
| {\ displaystyle 5} | {\ displaystyle -137} | {\ displaystyle 300} | {\ displaystyle -300} | {\ displaystyle 200} | {\ displaystyle -75} | {\ displaystyle 12} | {\ displaystyle 60} |
One of the universal methods for constructing formulas for numerical differentiation is that by the values of the function {\ displaystyle f (x)} in some nodes {\ displaystyle x_ {0}, x_ {1}, \ ldots, x_ {N} \;} build an interpolation polynomial {\ displaystyle P_ {N} (x)} (in the form of Lagrange or in the form of Newton) and approximately assume
- {\ displaystyle f ^ {(r)} (x) \ approx P_ {N} ^ {(r)} (x), 0 \ leq r \ leq N}
In some cases, along with approximate equality, it is possible (for example, using the Taylor formula) to obtain the exact equality containing the remainder term {\ displaystyle R} (numerical differentiation error)
- {\ displaystyle f ^ {(r)} (x) = P_ {N} ^ {(r)} (x) + R, 0 \ leq r \ leq N}
Such formulas are called numerical differentiation formulas with residual terms.
The degree to which the quantity {\ displaystyle h = \ max h_ {i} \, (h_ {i} = x_ {i} -x_ {i-1})} in the remainder term is called the error order of the formula for numerical differentiation. Formulas with discarded residual terms are simply called numerical differentiation formulas.
Below are some common formulas for numerical differentiation with residual terms for the first {\ displaystyle ({r = 1})} and second {\ displaystyle ({r = 2})} derivatives in nodes located with a constant step {\ displaystyle {h> 0}} :
- {\ displaystyle {r = 1, N = 1}} (two nodes):
- {\ displaystyle f ^ {'} ({x_ {o}}) = ({f_ {1} -f_ {0}}) / hh {f ^ {' '} (\ xi)} / 2}
- {\ displaystyle f ^ {'} ({x_ {1}}) = ({f_ {1} -f_ {0}}) / h + h {f ^ {' '} (\ xi)} / 2}
- {\ displaystyle {r = 1, N = 2}} (three nodes):
- {\ displaystyle f ^ {'} ({x_ {o}}) = (- 3 {f_ {0}} + 4 {f_ {1}} - {f_ {2}}) / 2 {h} + h ^ {2} {f ^ {'' '} (\ xi)} / 3}
- {\ displaystyle f ^ {'} ({x_ {1}}) = ({f_ {2}} - {f_ {0}}) / 2 {h} -h ^ {2} {f ^ {' '' } (\ xi)} / 6}
- {\ displaystyle f ^ {'} ({x_ {2}}) = ({f_ {0}} - 4 {f_ {1}} + 3 {f_ {2}}) / 2 {h} + h ^ { 2} {f ^ {'' '} (\ xi)} / 3}
- {\ displaystyle {r = 2, N = 2}} (three nodes):
- {\ displaystyle f ^ {''} ({x_ {0}}) = ({f_ {0}} - 2 {f_ {1}} + {f_ {2}}) / {h ^ {2}} - h {f ^ {'' '} (\ xi)}}
- {\ displaystyle f ^ {''} ({x_ {1}}) = ({f_ {0}} - 2 {f_ {1}} + {f_ {2}}) / {h ^ {2}} - h ^ {2} {f ^ {(4)} (\ xi)} / 12}
- {\ displaystyle f ^ {''} ({x_ {2}}) = ({f_ {0}} - 2 {f_ {1}} + {f_ {2}}) / {h ^ {2}} + h {f ^ {'' '} (\ xi)}}
- {\ displaystyle {r = 2, N = 3}} (four nodes):
- {\ displaystyle f ^ {''} ({x_ {0}}) = (2 {f_ {0}} - 5 {f_ {1}} + 4 {f_ {2}} - {f_ {3}}) / {h ^ {2}} + 11 {h ^ {2}} {f ^ {(4)} (\ xi)} / 12}
- {\ displaystyle f ^ {''} ({x_ {1}}) = ({f_ {0}} - 2 {f_ {1}} + {f_ {2}}) / {h ^ {2}} - h ^ {2} {f ^ {(4)} (\ xi)} / 12}
- {\ displaystyle f ^ {''} ({x_ {2}}) = ({f_ {1}} - 2 {f_ {2}} + {f_ {3}}) / {h ^ {2}} - h ^ {2} {f ^ {(4)} (\ xi)} / 12}
- {\ displaystyle f ^ {''} ({x_ {3}}) = (- {f_ {0}} + 4 {f_ {1}} - 5 {f_ {2}} + 2 {f_ {3}} ) / {h ^ {2}} + 11 {h ^ {2}} {f ^ {(4)} (\ xi)} / 12}
Where {\ displaystyle h} Is the grid step, and the point {\ displaystyle \ xi} is some intermediate point.
In constant-step numerical differentiation formulas {\ displaystyle h} function values {\ displaystyle f ({x})} are divided into {\ displaystyle h ^ {r}} where {\ displaystyle r} -order of the calculated derivative. Therefore, for small {\ displaystyle h} fatal errors in function values {\ displaystyle f ({x})} have a strong influence on the result of numerical differentiation. Thus, the problem arises of choosing the optimal step {\ displaystyle h} , since the error of the method proper tends to zero for {\ displaystyle h \ to {0}} , and the fatal error is growing. As a result, the total error that occurs during numerical differentiation can increase unlimitedly when {\ displaystyle h \ to {0}} . Therefore, the operation of numerical differentiation is considered incorrect.