# Integration of a multidimensional parametric functions

Hi,

For my study I need to integrate a 4-dimensional parametric function. I read the documentation concerning the numerical integration here http://root.cern.ch/drupal/content/function-integration. It is designed to work with Functor and Functor1D. I tried to supply IntegatorMultiDim with the ParamFunctor and is not accepting it. Is there any way to integrate a multidimensional parametric function?

Thanks,
Serhiy

Hi.

you can use RootMpi to paralelize your algorithm. RootMpi is a library for parallel computing in ROOT. The project has a one-dimensional integrator in the tutorials. You can see the source code and give us some feedback.

The project page:
gfifdev.udea.edu.co/plugins/med … /Main_Page

Hi,

a ROOT::Math::ParamFunctor object defines an operator() ( double *x, double *p).

If you are integrating the function in x, you can use the template class
ROOT::Math::WrappedParamFunctionROOT::Math::ParamFunctor and do:

``````ROOT::Math::ParamFunctor *   func = ...
ROOT::Math::WrappedParamFunction<ROOT::Math::ParamFunctor *> wf( func, ndim_in_x, number_of_parameters);
wf.SetParameters(params);``````

and then pass wf to the integrator class.

Best Regards

Lorenzo

Hi Lorenzo,

[quote=“moneta”]``` ROOT::Math::ParamFunctor * func = ... ```
[/quote]
How should I finish this line. Suppose that I have previously define

```double f2param(const double *x, const *par){ return par[0]*x[0]+par[1]*x[1]; }```

Serhiy.

Hi,

In your case you cannot it is better you wrap directly the free function in the WrappedParamFunction class.
Below is an example, note that you don’t need to supply the template parameter, since the free function type is the class default one:

``````double f (const double *x , const double *p) { ...}
WrappedParamFunction<> wf( &f, ndim_in_x, number_of_parameters);
wf.SetParameters(p)``````

Lorenzo

Thank you very much Lorenzo.
It works now.

Regards,
Serhiy Senyukov.