pysdic.numeric.compute_forward_finite_difference_coefficients#
- compute_forward_finite_difference_coefficients(order, spacing=1.0, accuracy=1)[source]#
Compute the coefficients of the forward 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:
order (Integral) – The order \(n \geq 1\) of the derivative.
spacing (Real, optional (default:
1.0)) – The sampling step \(h > 0\).accuracy (Integral, optional (default:
1)) – The order \(p \geq 1\) of the error.
- Returns:
The coefficients
[c_0, ..., c_{n+p-1}]of shape \((n + p,)\).- Return type:
Examples
compute_forward_finite_difference_coefficients(1, accuracy=2) # [-1.5, 2.0, -0.5] compute_forward_finite_difference_coefficients(2, spacing=0.1) # [100.0, -200.0, 100.0]