So, I’ve tried some functions. For instance, first I tried to compute
Int_0^2 dx Int_0^2 dy x*y
using this code:
double func2(const double *x){
return x[0]*x[1];
}
void integral(){
ROOT::Math::Functor f2(& func2, 2);
double a[2] = {0,2};
double b[2] = {1,2};
ROOT::Math::IntegratorMultiDim ig1(ROOT::Math::IntegrationMultiDim::kADAPTIVE);
ig1.SetFunction(f2);
double val = ig1.Integral(a,b);
cout<<val<<endl;
}
It worked. Them, I tried to change the y integration limits to
Blockquote int_fmin(x)^fmax(x)
like in the code, to simulate the lambda function in the python code:
**Python code**
eLow = lambda u: eMin(u, m_X)
eHigh = lambda u: eMax(element, m_X, u)
integral = integrate.dblquad(integrand, uLow, uHigh, eLow, eHigh)[0]
**cling**
double fmin(x){
return x+1;
}
double fmax(x){
return 2*x+2;
}
void integral(){
ROOT::Math::Functor f2(& func2, 2);
double a[2] = {0,fmin(x[0])};
double b[2] = {1,fmax(x[0])};
ROOT::Math::IntegratorMultiDim ig1(ROOT::Math::IntegrationMultiDim::kADAPTIVE);
ig1.SetFunction(f2);
double val = ig1.Integral(a,b);
cout<<val<<endl;
}
this didn’t worked. If you could provide any help, I would appreciate.
Thank you,
Bests
Ricardo