naginterfaces.library.quad.md_adapt_multi¶
- naginterfaces.library.quad.md_adapt_multi(a, b, mincls, maxcls, nfun, funsub, absreq, relreq, wrkstr, data=None)[source]¶
md_adapt_multi
computes approximations to the integrals of a vector of similar functions, each defined over the same multidimensional hyper-rectangular region. The function uses an adaptive subdivision strategy, and also computes absolute error estimates.For full information please refer to the NAG Library document for d01ea
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/d01/d01eaf.html
- Parameters
- afloat, array-like, shape
The lower limits of integration, , for .
- bfloat, array-like, shape
The upper limits of integration, , for .
- minclsint
Must be set either to the minimum number of calls to be allowed, in which case or to a negative value. In this case, the function continues the calculation started in a previous call with the same integrands and integration limits: no arguments other than , , or must be changed between the calls.
- maxclsint
The maximum number of calls to be allowed. In the continuation case this is the number of new calls to be allowed.
- nfunint
, the number of integrands.
- funsubcallable f = funsub(z, nfun, data=None)
must evaluate the integrands at a given point.
- Parameters
- zfloat, ndarray, shape
The coordinates of the point at which the integrands must be evaluated.
- nfunint
, the number of integrands.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- ffloat, array-like, shape
The value of the th integrand at the given point.
- absreqfloat
The absolute accuracy required by you.
- relreqfloat
The relative accuracy required by you.
- wrkstrfloat, array-like, shape
If , must be unchanged from the previous call of
md_adapt_multi
.- dataarbitrary, optional
User-communication data for callback functions.
- Returns
- minclsint
Gives the number of calls actually used by
md_adapt_multi
. For the continuation case ( on entry) this is the number of new calls on the current call tomd_adapt_multi
.- wrkstrfloat, ndarray, shape
Contains information about the current subdivision which could be used in a continuation call.
- finestfloat, ndarray, shape
specifies the best estimate obtained from the th integral, for .
- absestfloat, ndarray, shape
specifies the estimated absolute accuracy of , for .
- Raises
- NagValueError
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, is too small. . Minimum possible dimension: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- Warns
- NagAlgorithmicWarning
- (errno )
too small to obtain required accuracy. .
- (errno )
too small for the function to continue. .
- (errno )
too small to make any progress. .
- Notes
No equivalent traditional C interface for this routine exists in the NAG Library.
md_adapt_multi
uses a globally adaptive method based on the algorithm described by van Dooren and de Ridder (1976) and Genz and Malik (1980). It is implemented for integrals in the form:where , for .
Upon entry, unless has been set to a value less than or equal to ,
md_adapt_multi
divides the integration region into a number of subregions with randomly selected volumes. Inside each subregion the integrals and their errors are estimated. The initial number of subregions is chosen to be as large as possible without using more than calls to . The results are stored in a partially ordered list (a heap). The function then proceeds in stages. At each stage the subregion with the largest error (measured using the maximum norm) is halved along the coordinate axis where the integrands have largest absolute fourth differences. The basic rule is applied to each half of this subregion and the results are stored in the list. The results from the two halves are used to update the global integral and error estimates ( and ) and the function continues unless where the norm is the maximum norm, or further subdivision would use more than calls to . If at some stage there is insufficient working storage to keep the results for the next subdivision, the function switches to a less efficient mode; only if this mode of operation breaks down is insufficient storage reported.
- References
Genz, A C and Malik, A A, 1980, An adaptive algorithm for numerical integration over an N-dimensional rectangular region, J. Comput. Appl. Math. (6), 295–302
van Dooren, P and de Ridder, L, 1976, An adaptive algorithm for numerical integration over an N-dimensional cube, J. Comput. Appl. Math. (2), 207–217