CubaIntegration¶
- class CubaIntegration(*args)¶
Multidimensional integration algorithms.
- Parameters:
- algorithmNamestr
The name of the integration routine to use. It must be ‘cuhre’, ‘divonne’, ‘suave’, or ‘vegas’.
Methods
Retrieves the names of the available integration algorithms.
Accessor to the name of the integration routine to be used.
Accessor to the object's name.
Accessor to the absolute accuracy required in the integration.
Accessor to the maximal number of integrand calls.
Accessor to the relative accuracy required in the integration.
getName
()Accessor to the object's name.
hasName
()Test if the object is named.
integrate
(*args)Evaluation of the integral of on an interval.
setAlgorithmName
(optAlgo)Accessor to the name of the integration routine to be used.
setMaximumAbsoluteError
(maximumAbsoluteError)Accessor to the absolute accuracy required in the integration.
setMaximumCallsNumber
(maximumCallsNumber)Accessor to the maximal number of integrand calls.
setMaximumRelativeError
(maximumRelativeError)Accessor to the relative accuracy required in the integration.
setName
(name)Accessor to the object's name.
Notes
The Cuba algorithms enable one to approximate the definite integral:
which takes values in , with , , having for all .
The four available integration routines work on vector integrands. While Cuhre is deterministic, the three other ones use Monte Carlo methods. Cuhre employs a cubature rule for subregion estimation in an adaptative subdivision scheme. Divonne works by stratified sampling. Suave combines techniques from importance sampling and subregion sampling. Vegas uses importance sampling for variance reduction. The result is returned as a
Point
of dimension , which is the number of components of the return value of theFunction
that one will integrate.All the integration routines and the parameters are discussed in [hahn2005].
Examples
Create a Cuba algorithm:
>>> import openturns.experimental as otexp >>> algo = otexp.CubaIntegration('vegas')
- __init__(*args)¶
- static GetAlgorithmNames()¶
Retrieves the names of the available integration algorithms.
- Returns:
- algoName
Description
The names of the available integration algorithms.
- algoName
- getAlgorithmName()¶
Accessor to the name of the integration routine to be used.
- Returns:
- algorithmNamestr
The name of the integration routine used by the algorithm.
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getMaximumAbsoluteError()¶
Accessor to the absolute accuracy required in the integration.
- Returns:
- maximumAbsoluteErrorfloat
The absolute accuracy that the integrate method attempts to achieve.
- getMaximumCallsNumber()¶
Accessor to the maximal number of integrand calls.
- Returns:
- Nint
The maximal number of times the algorithm will attempt to call the integrand.
- getMaximumRelativeError()¶
Accessor to the relative accuracy required in the integration.
- Returns:
- maximumRelativeErrorfloat
The relative accuracy that the integrate method attempts to achieve.
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- integrate(*args)¶
Evaluation of the integral of on an interval.
- Parameters:
- Returns:
- value
Point
Approximation of the integral. Its dimension is .
- value
Examples
>>> import openturns as ot >>> import openturns.experimental as otexp >>> f = ot.SymbolicFunction(['x', 'y', 'z'], ['sin(x) * cos(y) * exp(z)']) >>> interval = ot.Interval([0.0] * 3, [1.0] * 3) >>> algoC = otexp.CubaIntegration('vegas') >>> value = algoC.integrate(f, interval)
- setAlgorithmName(optAlgo)¶
Accessor to the name of the integration routine to be used.
- Parameters:
- algorithmNamestr
The name of the integration routine used by the algorithm. It must be ‘cuhre’, ‘divonne’, ‘suave’, or ‘vegas’.
- setMaximumAbsoluteError(maximumAbsoluteError)¶
Accessor to the absolute accuracy required in the integration.
- Parameters:
- maximumAbsoluteErrorfloat
The absolute accuracy that the integrate method attempts to achieve.
- setMaximumCallsNumber(maximumCallsNumber)¶
Accessor to the maximal number of integrand calls.
- Parameters:
- Nint,
The maximal number of times the algorithm will attempt to call the integrand.
- setMaximumRelativeError(maximumRelativeError)¶
Accessor to the relative accuracy required in the integration.
- Parameters:
- maximumRelativeErrorfloat
The relative accuracy that the integrate method attempts to achieve.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.