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)}(\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) – \(n\) grid points so that \(x_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 \(w \cdot f(\mathrm{xs}) \approx f^{(k)}(\bar{x})\) is approximately the function’s k-th derivative at \(\bar{x}\).

Return type:

ndarray