Compute numerical derivatives on possibly uneven grids
Source:R/differentiate.R
compute_gradient.RdThis helper implements a finite‑difference scheme based on the Fornberg formula for interior points when the spacing between coordinates is non‑uniform. End points use first‑order forward/backward differences.