Numerical Derivative from Array?

The manual says there are two classes for calculating numerical derivatives of functions. However, these rely on function definitions rather than arrays.

Is a finite difference numerical derivative already implemented?

The classes use numerical differentiation by finite differences. The input is a ROOT function object, using the
ROOT::Math::IBasicFunctionOneDim interface and can be implemented with some freedom by the users

See more at

root.cern.ch/drupal/content/function-derivation

and here how to create the function to derivate

root.cern.ch/drupal/content/how … -framework

Best Regards

Lorenzo

[quote=“moneta”]The classes use numerical differentiation by finite differences. The input is a ROOT function object, using the
ROOT::Math::IBasicFunctionOneDim interface and can be implemented with some freedom by the users

See more at

root.cern.ch/drupal/content/function-derivation

and here how to create the function to derivate

root.cern.ch/drupal/content/how … -framework

Best Regards

Lorenzo[/quote]

I see how to use these to perform numerical derivatives of functions. But what if I have an array of discrete values, and I want to calculate numerical derivatives of it? I am not sure what class to store the array in and how to calculate derivatives of it.

Hi,
I was about to ask the same when I found this post.
Is there any numerical method available to compute the gradient of an array?
Cheers!

Something like this in Matlab:
es.mathworks.com/help/matlab/ref/gradient.html

Well, I guess that one can always define a function like this:
cplusplus.com/forum/general/103788/

see [TMath] Add Gradient and Laplacian methods for arrays by pitkajuh · Pull Request #15100 · root-project/root · GitHub