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

GetAlgorithmNames()

Retrieves the names of the available integration algorithms.

getAlgorithmName()

Accessor to the name of the integration routine to be used.

getClassName()

Accessor to the object's name.

getMaximumAbsoluteError()

Accessor to the absolute accuracy required in the integration.

getMaximumCallsNumber()

Accessor to the maximal number of integrand calls.

getMaximumRelativeError()

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 f w 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:

\int_{I_n} f(x_1, ..., x_n) \di{x_1}...\di{x_n}

which takes values in \Rset^p, with f: \Rset^n \mapsto \Rset^p, I_n=[a_1, b_1]\times\cdots\times[a_n, b_n]\subset\Rset^n, having a_i<b_i for all i=1,...,n.

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 p, which is the number of components of the return value of the Function 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:
algoNameDescription

The names of the available integration algorithms.

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 f w on an interval.

Parameters:
fFunction, f: \Rset^n \mapsto \Rset^p

The integrand function.

intervalInterval, interval \subset \Rset^n

The integration domain.

Returns:
valuePoint

Approximation of the integral. Its dimension is p.

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, N>0

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.