pysdic.numeric.compute_backward_finite_difference_coefficients#

compute_backward_finite_difference_coefficients(order, spacing=1.0, accuracy=1)[source]#

Compute the coefficients of the backward finite difference approximation of a derivative on a uniform sampling.

\[\frac{d^n f}{dt^n}(t) = \sum_{j=0}^{n + p - 1} c_j \, f(t - j h) + O(h^p)\]
Parameters:
Returns:

The coefficients [c_0, ..., c_{n+p-1}] of shape \((n + p,)\), for the values [f(t), f(t - h), ...].

Return type:

numpy.ndarray

Examples

compute_backward_finite_difference_coefficients(1, accuracy=2)  # [1.5, -2.0, 0.5]