Class RombergIntegrator<T extends Quadrature>
java.lang.Object
com.irurueta.numerical.integration.Integrator
com.irurueta.numerical.integration.RombergIntegrator<T>
- Type Parameters:
T
- instance of a quadrature to be used for Romber'gs method integration.
- Direct Known Subclasses:
RombergDoubleExponentialRuleQuadratureIntegrator
,RombergExponentialMidPointQuadratureIntegrator
,RombergInfinityMidPointQuadratureIntegrator
,RombergLowerSquareRootMidPointQuadratureIntegrator
,RombergMidPointQuadratureIntegrator
,RombergTrapezoidalQuadratureIntegrator
,RombergUpperSquareRootMidPointQuadratureIntegrator
Base integrator for implementations based on Romberg's method.
Romberg's method is a generalization of Simpson's method for higher order integration schemes.
This can be used to computed integration with less function evaluations for the same level of
accuracy when more assumptions of function "smoothness" can be made.
Implementations of Romberg's method are quite powerful for sufficiently smooth (e.g., analytic)
integrands, integrated over intervals that contain no singularities, and where the endpoints are
also non-singular. In such circumstances, Romberg's method, takes many, many fewer function
evaluations than other method's such as Simpson's.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final double
Required accuracy.static final double
Default accuracy.private final double[]
Successive trapezoidal step sizes.private final PolynomialInterpolator
Polynomial interpolator.private static final int
Maximum number of allowed steps.private static final int
Maximum number of allowed steps + 1.private static final int
Minimum required number of steps.protected final T
Quadrature used for integration.private final double[]
Successive trapezoidal approximations.Fields inherited from class com.irurueta.numerical.integration.Integrator
DEFAULT_INTEGRATOR_TYPE, DEFAULT_QUADRATURE_TYPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static RombergIntegrator<Quadrature>
cast
(RombergIntegrator<?> integrator) Casts integrator to a quadrature integrator without wildcard parameter.static RombergIntegrator<Quadrature>
create
(double a, double b, SingleDimensionFunctionEvaluatorListener listener) Creates an integrator using Romberg's method and having default accuracy and quadrature type.static RombergIntegrator<Quadrature>
create
(double a, double b, SingleDimensionFunctionEvaluatorListener listener, double eps) Creates an integrator using Romberg's method and default quadrature type.static RombergIntegrator<Quadrature>
create
(double a, double b, SingleDimensionFunctionEvaluatorListener listener, double eps, QuadratureType quadratureType) Creates an integrator using Romberg's method.static RombergIntegrator<Quadrature>
create
(double a, double b, SingleDimensionFunctionEvaluatorListener listener, QuadratureType quadratureType) Creates an integrator using Romberg's method and having default accuracy.Gets type of integrator.double
Integrates function between lower and upper limits defined by provided quadrature.Methods inherited from class com.irurueta.numerical.integration.Integrator
create, create, create, create, getQuadratureType
-
Field Details
-
EPS
public static final double EPSDefault accuracy.- See Also:
-
JMAX
private static final int JMAXMaximum number of allowed steps.- See Also:
-
JMAXP
private static final int JMAXPMaximum number of allowed steps + 1.- See Also:
-
K
private static final int KMinimum required number of steps.- See Also:
-
q
Quadrature used for integration. -
eps
protected final double epsRequired accuracy. -
s
private final double[] sSuccessive trapezoidal approximations. -
h
private final double[] hSuccessive trapezoidal step sizes. -
interpolator
Polynomial interpolator.
-
-
Constructor Details
-
RombergIntegrator
Constructor.- Parameters:
q
- Quadrature used for integration.eps
- Required accuracy.
-
-
Method Details
-
integrate
Integrates function between lower and upper limits defined by provided quadrature. This implementation is suitable for open intervals.- Specified by:
integrate
in classIntegrator
- Returns:
- result of integration.
- Throws:
IntegrationException
- if integration fails for numerical reasons.
-
getIntegratorType
Gets type of integrator.- Specified by:
getIntegratorType
in classIntegrator
- Returns:
- type of integrator.
-
create
public static RombergIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener, double eps, QuadratureType quadratureType) Creates an integrator using Romberg's method. It must be noticed that upper limit of integration is ignored when using exponential mid-point quadrature type.- Parameters:
a
- Lower limit of integration.b
- Upper limit of integration.listener
- listener to evaluate a single dimension function at required points.eps
- required accuracy.quadratureType
- quadrature type.- Returns:
- created integrator.
-
create
public static RombergIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener, QuadratureType quadratureType) Creates an integrator using Romberg's method and having default accuracy. It must be noticed that upper limit of integration is ignored when using exponential mid-point quadrature type.- Parameters:
a
- Lower limit of integration.b
- Upper limit of integration.listener
- listener to evaluate a single dimension function at required points.quadratureType
- quadrature type.- Returns:
- created integrator.
-
create
public static RombergIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener, double eps) Creates an integrator using Romberg's method and default quadrature type. It must be noticed that upper limit of integration is ignored when using exponential mid-point quadrature type.- Parameters:
a
- Lower limit of integration.b
- Upper limit of integration.listener
- listener to evaluate a single dimension function at required points.eps
- required accuracy.- Returns:
- created integrator.
-
create
public static RombergIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener) Creates an integrator using Romberg's method and having default accuracy and quadrature type. It must be noticed that upper limit of integration is ignored when using exponential mid-point quadrature type.- Parameters:
a
- Lower limit of integration.b
- Upper limit of integration.listener
- listener to evaluate a single dimension function at required points.- Returns:
- created integrator.
-
cast
Casts integrator to a quadrature integrator without wildcard parameter. .- Parameters:
integrator
- integrator to be cast.- Returns:
- cast integrator.
-