ROOT   Reference Guide
Loading...
Searching...
No Matches
mathmoreIntegrationMultidim.C File Reference

## Detailed Description

Example on the usage of the multidimensional integration algorithm of MathMore Please refer to the web documentation for further details: https://root.cern.ch/root/htmldoc/guides/users-guide/MathLibraries.html#numerical-integration To execute the macro type the following:

root[0] .x mathmoreIntegrationMultidim.C

This tutorial requires having libMathMore built with ROOT.

To build mathmore you need to have a version of GSL >= 1.8 installed in your system The ROOT configure will automatically find GSL if the script gsl-config (from GSL) is in your PATH,. otherwise you need to configure root with the options –gsl-incdir and –gsl-libdir.

integral result is 1
integral result is 0.999998
integral result is 0.999738
integral result is 0.999881
(int) 0
double f2(const double * x) {
return x[0] + x[1];
}
int mathmoreIntegrationMultidim() {
const double RESULT = 1.0;
const double ERRORLIMIT = 1E-3;
int status = 0;
double a[2] = {0,0};
double b[2] = {1,1};
ig.SetFunction(wf);
double val = ig.Integral(a,b);
std::cout << "integral result is " << val << std::endl;
status += std::fabs(val-RESULT) > ERRORLIMIT;
ig2.SetFunction(wf);
val = ig2.Integral(a,b);
std::cout << "integral result is " << val << std::endl;
status += std::fabs(val-RESULT) > ERRORLIMIT;
val = ig3.Integral(a,b);
std::cout << "integral result is " << val << std::endl;
status += std::fabs(val-RESULT) > ERRORLIMIT;
val = ig4.Integral(a,b);
std::cout << "integral result is " << val << std::endl;
status += std::fabs(val-RESULT) > ERRORLIMIT;
return status;
}
#define b(i)
Definition RSha256.hxx:100
#define a(i)
Definition RSha256.hxx:99
Documentation for class Functor class.
Definition Functor.h:47
User class for performing multidimensional integration.
@ kADAPTIVE
adaptive multi-dimensional integration
Double_t x[n]
Definition legend1.C:17

Definition in file mathmoreIntegrationMultidim.C.