root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.53k stars 1.24k forks source link

[math] Finite difference methods for Gradient #14304

Open ferdymercury opened 6 months ago

ferdymercury commented 6 months ago

Explain what you would like to see improved and how.

MATLAB and numpy offer numerical derivatives of an array, while ROOT does not. But it offers the opposite, TH1::Integral.

Some users do have interest in ROOT providing this method, either as TH1::Derivative or TMath::Gradient.

I proposed an implementation here: https://root-forum.cern.ch/t/numerical-derivative-of-an-array/57754/3?u=ferhue

ROOT version

ROOT v6.30/02
Built for linuxx8664gcc on Nov 27 2023, 19:50:38
From tags/v6-30-02@
With c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Binary directory: /opt/root/bin

Installation method

Binary Release

Operating system

Linux

Additional context

https://root-forum.cern.ch/t/numerical-derivative-of-an-array/57754/3 https://numpy.org/doc/stable/reference/generated/numpy.gradient.html https://www.mathworks.com/help/matlab/ref/gradient.html

FranciscoThiesen commented 3 months ago

Hi @lmoneta , are you working on this one?

If you haven't started it, I'd be interested in implementing it as a first contribution to the repo.