Sponsored Links

Senin, 09 Juli 2018

Sponsored Links

Polynomials Leading Coefficient From Finite Difference Q9 - YouTube
src: i.ytimg.com

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.


Video Finite difference coefficient



Central finite difference

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

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

f ? ( x 0 ) ? - 1 2 f ( x - 2 ) + f ( x - 1 ) - f ( x + 1 ) + 1 2 f ( x + 2 ) h x 3 + O ( h x 2 ) {\displaystyle \displaystyle f'''(x_{0})\approx \displaystyle {\frac {-{\frac {1}{2}}f(x_{-2})+f(x_{-1})-f(x_{+1})+{\frac {1}{2}}f(x_{+2})}{h_{x}^{3}}}+O\left(h_{x}^{2}\right)}

where h x {\displaystyle h_{x}} represents a uniform grid spacing between each finite difference interval, and x n = x 0 + n h x {\displaystyle x_{n}=x_{0}+nh_{x}} .

For the m {\displaystyle m} -th derivative with accuracy n {\displaystyle n} , there are 2 p + 1 = 2 ? m + 1 2 ? - 1 + n {\displaystyle 2p+1=2\lfloor {\frac {m+1}{2}}\rfloor -1+n} central coefficients a - p , a - p + 1 , . . . , a p - 1 , a p {\displaystyle a_{-p},a_{-p+1},...,a_{p-1},a_{p}} .These are given by the solution of the linear equation system

( 1 1 . . . 1 1 - p - p + 1 . . . p - 1 p ( - p ) 2 ( - p + 1 ) 2 . . . ( p - 1 ) 2 p 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ( - p ) 2 p ( - p + 1 ) 2 p . . . ( p - 1 ) 2 p p 2 p ) ( a - p a - p + 1 a - p + 2 . . . . . . . . . a p ) = ( 0 0 0 . . . m ! . . . 0 ) {\displaystyle \left({\begin{matrix}1&1&...&1&1\\-p&-p+1&...&p-1&p\\(-p)^{2}&(-p+1)^{2}&...&(p-1)^{2}&p^{2}\\...&...&...&...&...\\...&...&...&...&...\\...&...&...&...&...\\(-p)^{2p}&(-p+1)^{2p}&...&(p-1)^{2p}&p^{2p}\end{matrix}}\right)\left({\begin{matrix}a_{-p}\\a_{-p+1}\\a_{-p+2}\\...\\...\\...\\a_{p}\end{matrix}}\right)=\left({\begin{matrix}0\\0\\0\\...\\m!\\...\\0\end{matrix}}\right)}

where the only non-zero value on the right hand side is in the ( m + 1 ) {\displaystyle (m+1)} -th row.

A Python implementation for using finite difference approximations in any dimension and accuracy order on uniform and non-uniform grids is the findiff project.


Maps Finite difference coefficient



Forward and backward finite difference

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

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

f ? ( x 0 ) ? - 11 6 f ( x 0 ) + 3 f ( x + 1 ) - 3 2 f ( x + 2 ) + 1 3 f ( x + 3 ) h x + O ( h x 3 ) , {\displaystyle \displaystyle f'(x_{0})\approx \displaystyle {\frac {-{\frac {11}{6}}f(x_{0})+3f(x_{+1})-{\frac {3}{2}}f(x_{+2})+{\frac {1}{3}}f(x_{+3})}{h_{x}}}+O\left(h_{x}^{3}\right),}
f ? ( x 0 ) ? 2 f ( x 0 ) - 5 f ( x + 1 ) + 4 f ( x + 2 ) - f ( x + 3 ) h x 2 + O ( h x 2 ) , {\displaystyle \displaystyle f''(x_{0})\approx \displaystyle {\frac {2f(x_{0})-5f(x_{+1})+4f(x_{+2})-f(x_{+3})}{h_{x}^{2}}}+O\left(h_{x}^{2}\right),}

while the corresponding backward approximations are given by

f ? ( x 0 ) ? 11 6 f ( x 0 ) - 3 f ( x - 1 ) + 3 2 f ( x - 2 ) - 1 3 f ( x - 3 ) h x + O ( h x 3 ) , {\displaystyle \displaystyle f'(x_{0})\approx \displaystyle {\frac {{\frac {11}{6}}f(x_{0})-3f(x_{-1})+{\frac {3}{2}}f(x_{-2})-{\frac {1}{3}}f(x_{-3})}{h_{x}}}+O\left(h_{x}^{3}\right),}
f ? ( x 0 ) ? 2 f ( x 0 ) - 5 f ( x - 1 ) + 4 f ( x - 2 ) - f ( x - 3 ) h x 2 + O ( h x 2 ) , {\displaystyle \displaystyle f''(x_{0})\approx \displaystyle {\frac {2f(x_{0})-5f(x_{-1})+4f(x_{-2})-f(x_{-3})}{h_{x}^{2}}}+O\left(h_{x}^{2}\right),}


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:


1.2 - Characteristics of Polynomial Functions (Finite Differences ...
src: i.ytimg.com


Arbitrary stencil points

For a given arbitrary stencil points s {\displaystyle \displaystyle s} of length N {\displaystyle \displaystyle N} with the order of derivatives d < N {\displaystyle \displaystyle d<N} , the Finite-Different coefficients can be obtained by solving the linear equations

( s 1 0 ? s N 0 ? ? ? s 1 N - 1 ? s N N - 1 ) ( a 1 ? a N ) = d ! ( ? 0 , d ? ? i , d ? ? N , d ) {\displaystyle \left({\begin{matrix}s_{1}^{0}&\cdots &s_{N}^{0}\\\vdots &\ddots &\vdots \\s_{1}^{N-1}&\cdots &s_{N}^{N-1}\end{matrix}}\right)\left({\begin{matrix}a_{1}\\\vdots \\a_{N}\end{matrix}}\right)=d!\left({\begin{matrix}\delta _{0,d}\\\vdots \\\delta _{i,d}\\\vdots \\\delta _{N,d}\end{matrix}}\right)}


Example, for s = [ - 3 , - 2 , - 1 , 0 , 1 ] {\displaystyle s=[-3,-2,-1,0,1]} , order of differentiation d = 4 {\displaystyle d=4} ,

( a 1 a 2 a 3 a 4 a 5 ) = ( 1 1 1 1 1 - 3 - 2 - 1 0 1 9 4 1 0 1 - 27 - 8 - 1 0 1 81 16 1 0 1 ) - 1 ( 0 0 0 0 24 ) = ( 1 - 4 6 - 4 1 ) {\displaystyle \left({\begin{matrix}a_{1}\\a_{2}\\a_{3}\\a_{4}\\a_{5}\end{matrix}}\right)=\left({\begin{matrix}1&1&1&1&1\\-3&-2&-1&0&1\\9&4&1&0&1\\-27&-8&-1&0&1\\81&16&1&0&1\\\end{matrix}}\right)^{-1}\left({\begin{matrix}0\\0\\0\\0\\24\end{matrix}}\right)=\left({\begin{matrix}1\\-4\\6\\-4\\1\end{matrix}}\right)}

The order of accuracy of the approximation takes the usual form O ( h ( N - d ) ) {\displaystyle O\left(h^{(N-d)}\right)} .


Finite difference method for non-uniform grid - Mathematics Stack ...
src: i.stack.imgur.com


See also

  • Finite difference method
  • Finite difference
  • Five-point stencil
  • Numerical differentiation

MIT Numerical Methods for PDE Lecture 3: Finite Difference 2D ...
src: i.ytimg.com


References

Source of the article : Wikipedia

Comments
0 Comments