Finite difference coefficient

In mathematics, to approximate a derivative to an arbitrary order of accuracy, it is possible to use the finite difference. A finite difference can be central, forward or backward.

Central finite difference

This table contains the coefficients of the central differences, for several orders of accuracy and with uniform grid spacing:[1]

Derivative Accuracy −5−4−3−2−1012345
1 2 −1/201/2
4 1/12−2/302/3−1/12
6 −1/603/20−3/403/4−3/201/60
8 1/280−4/1051/5−4/504/5−1/54/105−1/280
2 2 1−21
4 −1/124/3−5/24/3−1/12
6 1/90−3/203/2−49/183/2−3/201/90
8 −1/5608/315−1/58/5−205/728/5−1/58/315−1/560
3 2 −1/210−11/2
4 1/8−113/80−13/81−1/8
6 −7/2403/10−169/12061/300−61/30169/120−3/107/240
4 2 1−46−41
4 −1/62−13/228/3−13/22−1/6
6 7/240−2/5169/60−122/1591/8−122/15169/60−2/57/240
5 2 −1/22−5/205/2−21/2
4 1/6−3/213/3−29/6029/6−13/33/2−1/6
6 −13/28819/36−87/3213/2−323/480323/48−13/287/32−19/3613/288
6 2 1−615−2015−61
4 −1/43−1329−75/229−133−1/4
6 13/240−19/2487/16−39/2323/8−1023/20323/8−39/287/16−19/2413/240

For example, the third derivative with a second-order accuracy is

where represents a uniform grid spacing between each finite difference interval, and .

For the -th derivative with accuracy , there are central coefficients . These are given by the solution of the linear equation system

where the only non-zero value on the right hand side is in the -th row.

An open source implementation for calculating finite difference coefficients of arbitrary derivates and accuracy order in one dimension is available.[2]

Forward finite difference

This table contains the coefficients of the forward differences, for several orders of accuracy and with uniform grid spacing:[1]

Derivative Accuracy 0 1 2 3 4 5 6 7 8
1 111       
23/221/2      
311/633/21/3     
425/12434/31/4    
5137/605510/35/41/5   
649/20615/220/315/46/51/6  
2 1121      
22541     
335/1226/319/214/311/12    
415/477/6107/61361/125/6   
5203/4587/5117/4254/933/227/5137/180  
6469/90223/10879/20949/1841201/101019/1807/10 
3 11331     
25/291273/2    
317/471/459/249/241/47/4   
449/829461/862307/81315/8  
5967/120638/153929/40389/32545/24268/51849/12029/15 
6801/80349/618353/1202391/101457/64891/30561/8527/30469/240
4 114641    
23142624112   
335/631137/2242/3107/21917/6  
428/3111/21421219/6176185/282/37/2 
51069/801316/1515289/602144/510993/244772/152803/20536/15967/240

For example, the first derivative with a third-order accuracy and the second derivative with a second-order accuracy are

while the corresponding backward approximations are given by

Backward finite difference

In general, to get the coefficients of the backward approximations, give all odd derivatives listed in the table the opposite sign, whereas for even derivatives the signs stay the same. The following table illustrates this[3]:

Derivative Accuracy 8 7 6 5 4 3 2 1 0
1 1       11
2      1/223/2
3     1/33/2311/6
2 1      121
2     1452
3 1     1331
2    3/271295/2
4 1    14641
2   2112426143

Arbitrary stencil points

For a given arbitrary stencil points of length with the order of derivatives , the finite difference coefficients can be obtained by solving the linear equations [4]

where the are the Kronecker delta.

Example, for , order of differentiation :

The order of accuracy of the approximation takes the usual form .

See also

References

  1. Fornberg, Bengt (1988), "Generation of Finite Difference Formulas on Arbitrarily Spaced Grids", Mathematics of Computation, 51 (184): 699–706, doi:10.1090/S0025-5718-1988-0935077-0, ISSN 0025-5718.
  2. "A Python package for finite difference numerical derivatives in arbitrary number of dimensions".
  3. Taylor, Cameron (12 December 2019). "Finite Difference Coefficients Calculator". MIT.
  4. http://web.media.mit.edu/~crtaylor/calculator.html
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.