Package com.imsl.math
Class HyperRectangleQuadrature
java.lang.Object
com.imsl.math.HyperRectangleQuadrature
- All Implemented Interfaces:
Serializable,Cloneable
HyperRectangleQuadrature integrates a function over a hypercube.
This class is used to evaluate integrals of the form:
$$
\int_{a_{n-1}}^{b_{n-1}} \cdots \int_{a_0}^{b_0}
f(x_0,\ldots,x_{n-1}) \, dx_0 \ldots dx_{n-1}
$$
Integration of functions over hypercubes by Monte Carlo, in which the
integral is evaluated as the value of the function averaged over a sequence
of randomly chosen points. Under mild assumptions on the function, this
method will converge like \(1/\sqrt{n}\),
where n is the number of points at which
the function is evaluated.
It is possible to improve on the performance of Monte Carlo by carefully choosing the points at which the function is to be evaluated. Randomly distributed points tend to be non-uniformly distributed. The alternative to a sequence of random points is a low-discrepancy sequence. A low-discrepancy sequence is one that is highly uniform.
This function is based on the low-discrepancy Faure sequence
as computed by FaureSequence.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePublic interface function for the HyperRectangleQuadrature class. -
Constructor Summary
ConstructorsConstructorDescriptionHyperRectangleQuadrature(int dim) Constructs a HyperRectangleQuadrature object.HyperRectangleQuadrature(RandomSequence sequence) Constructs a HyperRectangleQuadrature object. -
Method Summary
Modifier and TypeMethodDescriptiondoubleeval(HyperRectangleQuadrature.Function objectF) Returns the value of the integral over the unit cube.doubleeval(HyperRectangleQuadrature.Function objectF, double[] a, double[] b) Returns the value of the integral over a cube.doubleReturns an estimate of the relative error in the computed result.voidsetAbsoluteError(double errorAbsolute) Sets the absolute error tolerance.voidsetRelativeError(double errorRelative) Sets the relative error tolerance.
-
Constructor Details
-
HyperRectangleQuadrature
public HyperRectangleQuadrature(int dim) Constructs a HyperRectangleQuadrature object. -
HyperRectangleQuadrature
Constructs a HyperRectangleQuadrature object.
-
-
Method Details
-
setAbsoluteError
public void setAbsoluteError(double errorAbsolute) Sets the absolute error tolerance.- Parameters:
errorAbsolute- adoublescalar value specifying the absolute error
-
setRelativeError
public void setRelativeError(double errorRelative) Sets the relative error tolerance.- Parameters:
errorRelative- adoublescalar value specifying the relative error
-
getErrorEstimate
public double getErrorEstimate()Returns an estimate of the relative error in the computed result.- Returns:
- a
doublespecifying an estimate of the relative error in the computed result
-
eval
Returns the value of the integral over the unit cube.- Parameters:
objectF-Functioncontaining the function to be integrated
-
eval
Returns the value of the integral over a cube.- Parameters:
objectF-Functioncontaining the function to be integrateda- is adoublespecifying the lower limit of integration. If null all of the lower limits default to 0.b- is adoublespecifying the upper limit of integration. If null all of the upper limits default to 1.
-