My Coding >
Numerical simulations >
Numerical Differentiation >
Forward, Backward and Central scheme for numerical differentiation
Forward, Backward and Central scheme for numerical differentiationIn previous article I’ve describe, how to numerically calculate simplest derivative. But now we can extend this techniques and try to use left and right nearby points. Forward, Backward and Central schemeForwardSo, when, for calculation of the derivative, we use information about out point xi and information about next point xi+1 with final formula f’(xi) = (f(xi+1)-f(xi))/dx we call this scheme of numerical calculation – forward scheme. BackwardWhen we use information about function value in the point of interest and in the previous point – this is backward derivative. To calculate it we use following numerical equation: f’(xi) = (f(xi)-f(xi-1))/dx CentralIf we use information about function in previous and next points, then we are using central scheme for numerical differentiation. The equation for central scheme will be f’(xi) = (f(xi+1)-f(xi-1))/2dx Python codeAll these schemes can be easily coded with python.
Also it is necessary to have some king of function to select between these functions for calculations. For the time of development, we can use something very simple.
To see short explanation about these schemes of numerica differentiation go to check video: Forward, Backward and Central scheme for numerical differentiation
|
Last 10 artitles
9 popular artitles
|
|
© 2020 MyCoding.uk -My blog about coding and further learning. This blog was writen with pure Perl and front-end output was performed with TemplateToolkit. |