Hi. Using ROOT:: Math::Functor and ROOT::Math::IntegratorMultiDim I was able to calculate the integral of a function f(x,y). Considering the code from the first link you shared (mathmoreIntegrationMultidim), I thought that in order to do an integral of a function f(x,y,z,w) I could type the following:
double f4(const double * x) {
return x[0] + x[1] + x[2] + x[3]; // f= f(x,y,z,w)= x + y + z + w
ROOT::Math::Functor fu(&f4,4);
double a[2] = {0,0};
double b[2] = {1,1};
double c[2] = {2,2};
double d[2] = {3,3};
ROOT::Math::IntegratorMultiDim ig(ROOT::Math::IntegrationMultiDim::kADAPTIVE);
ig.SetFunction(fu);
double val = ig.Integral(a,b,c,d);
However, the following error appeared:
Error: Can´t call IntegratorMultiDim::Integral(a,b,c,d) in current scope
Possible candidates are…
Error: class, struct, union or type IntegratorMultiDim not defined
So, Any suggestions on what i need to type / code in order to integrate a function f(x,y,z,w)?. Thanks in advance