ROOT
Version v6.34
master
v6.36
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
►
ROOT
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
mathmoreIntegrationMultidim.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_math
3
/// \notebook -nodraw
4
/// Example on the usage of the multidimensional integration algorithm of MathMore
5
/// Please refer to the web documentation for further details:
6
/// https://root.cern/manual/math/#numerical-integration
7
/// To execute the macro type the following:
8
///
9
/// ~~~{.cpp}
10
/// root[0] .x mathmoreIntegrationMultidim.C
11
/// ~~~
12
///
13
/// This tutorial requires having libMathMore built with ROOT.
14
///
15
/// To build mathmore you need to have a version of GSL >= 1.8 installed in your system
16
/// The ROOT configure will automatically find GSL if the script gsl-config (from GSL) is in your PATH,.
17
/// otherwise you need to configure root with the options --gsl-incdir and --gsl-libdir.
18
///
19
/// \macro_image
20
/// \macro_output
21
/// \macro_code
22
///
23
/// \authors A. Tolosa-Delgado
24
25
double
f2(
const
double
*
x
) {
26
return
x
[0] +
x
[1];
27
}
28
29
int
mathmoreIntegrationMultidim
() {
30
31
const
double
RESULT
= 1.0;
32
const
double
ERRORLIMIT
= 1
E
-3;
33
int
status = 0;
34
35
ROOT::Math::Functor
wf
(&f2,2);
36
double
a
[2] = {0,0};
37
double
b
[2] = {1,1};
38
39
ROOT::Math::IntegratorMultiDim
ig
(
ROOT::Math::IntegrationMultiDim::kADAPTIVE
);
40
ig
.SetFunction(
wf
);
41
double
val =
ig
.Integral(
a
,
b
);
42
std::cout <<
"integral result is "
<< val << std::endl;
43
status += std::fabs(val-
RESULT
) >
ERRORLIMIT
;
44
45
ROOT::Math::IntegratorMultiDim
ig2
(
ROOT::Math::IntegrationMultiDim::kVEGAS
);
46
ig2
.SetFunction(
wf
);
47
val =
ig2
.Integral(
a
,
b
);
48
std::cout <<
"integral result is "
<< val << std::endl;
49
status += std::fabs(val-
RESULT
) >
ERRORLIMIT
;
50
51
ROOT::Math::IntegratorMultiDim
ig3
(
wf
,
ROOT::Math::IntegrationMultiDim::kPLAIN
);
52
val =
ig3
.Integral(
a
,
b
);
53
std::cout <<
"integral result is "
<< val << std::endl;
54
status += std::fabs(val-
RESULT
) >
ERRORLIMIT
;
55
56
ROOT::Math::IntegratorMultiDim
ig4
(
wf
,
ROOT::Math::IntegrationMultiDim::kMISER
);
57
val =
ig4
.Integral(
a
,
b
);
58
std::cout <<
"integral result is "
<< val << std::endl;
59
status += std::fabs(val-
RESULT
) >
ERRORLIMIT
;
60
61
return
status;
62
}
b
#define b(i)
Definition
RSha256.hxx:100
a
#define a(i)
Definition
RSha256.hxx:99
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
ROOT::Math::Functor
Documentation for class Functor class.
Definition
Functor.h:47
ROOT::Math::IntegratorMultiDim
User class for performing multidimensional integration.
Definition
IntegratorMultiDim.h:47
ROOT::Math::IntegrationMultiDim::kADAPTIVE
@ kADAPTIVE
adaptive multi-dimensional integration
Definition
AllIntegrationTypes.h:49
ROOT::Math::IntegrationMultiDim::kVEGAS
@ kVEGAS
MC integration.
Definition
AllIntegrationTypes.h:50
ROOT::Math::IntegrationMultiDim::kPLAIN
@ kPLAIN
MC integration.
Definition
AllIntegrationTypes.h:52
ROOT::Math::IntegrationMultiDim::kMISER
@ kMISER
MC integration.
Definition
AllIntegrationTypes.h:51
x
Double_t x[n]
Definition
legend1.C:17
TMath::E
constexpr Double_t E()
Base of natural log: .
Definition
TMath.h:93
tutorials
math
mathmoreIntegrationMultidim.C
ROOT v6-34 - Reference Guide Generated on Tue Apr 22 2025 15:47:45 (GVA Time) using Doxygen 1.10.0