function finite_difference_coefficients

deeptime.util.diff.finite_difference_coefficients(x_bar, xs, k=1)

Calculates finite difference coefficients. The coefficients are computed so that

f(k)(xˉ)f(x)fd_coeff(x,window_around(xˉ),k).f^{(k)}(\bar{x}) \approx f(x) * \mathrm{fd\_coeff}(x, \mathrm{window\_around}(\bar{x}), k).

It is required that len(x) > k.

See here for details.

Parameters:
  • x_bar (float) – The evaluation point of the derivative.

  • xs (ndarray of float) – nn grid points so that x1xˉxnx_1 \leq\ldots\leq\bar{x}\leq\ldots\leq x_n.

  • k (int, default=1) – k-th derivative.

Returns:

weights – An array w with weights so that the dot product wf(xs)f(k)(xˉ)w \cdot f(\mathrm{xs}) \approx f^{(k)}(\bar{x}) is approximately the function’s k-th derivative at xˉ\bar{x}.

Return type:

ndarray