Re: First and second derivative

From: Lorenzo Moneta <Lorenzo.Moneta_at_cern.ch>
Date: Thu, 15 Jan 2009 18:45:35 +0100


Hi Parada,

You need to pass the function to be differentiated to the Derivator class. you can see this example

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

Best Regards

  Lorenzo
On Jan 15, 2009, at 6:32 PM, Paraduan Hutauruk wrote:

> Dear all,
>
> Does anyone know the command for first and second derivative of a
> function?
> I tried to wrote code for first derivative using
> ROOT::Math::Derivator(), but i got some error message. Could anyone
> let me know where is the mistake please? or guide me to right way?.
> #include "Math/SpecFunc.h"
> #include "TTree.h"
> #include "TFile.h"
> #include "TNtupleD.h"
>
> #include"Math/Derivator.h"
>
> const int LMAX=4;
> double par[] ={1,1,1,1};
> double x=1;
> double cros_mul(double *par , double x )
> {
> double func=0;
> for (int L=0; L<=LMAX ; L++)
> {
> int L2 =L+1;
> func +=
> par[L]*ROOT::Math::Derivator::ROOT::Math::assoc_legendre(L2,0,x) ;
> }
> return func; }
>
> Many thanks for help
> Regards,
> Parada
>
Received on Thu Jan 15 2009 - 18:45:41 CET

This archive was generated by hypermail 2.2.0 : Sat Jan 17 2009 - 05:50:02 CET