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

public abstract class RombergIntegrator<T extends Quadrature> extends Integrator
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 Details

    • EPS

      public static final double EPS
      Default accuracy.
      See Also:
    • JMAX

      private static final int JMAX
      Maximum number of allowed steps.
      See Also:
    • JMAXP

      private static final int JMAXP
      Maximum number of allowed steps + 1.
      See Also:
    • K

      private static final int K
      Minimum required number of steps.
      See Also:
    • q

      protected final T extends Quadrature q
      Quadrature used for integration.
    • eps

      protected final double eps
      Required accuracy.
    • s

      private final double[] s
      Successive trapezoidal approximations.
    • h

      private final double[] h
      Successive trapezoidal step sizes.
    • interpolator

      private final PolynomialInterpolator interpolator
      Polynomial interpolator.
  • Constructor Details

    • RombergIntegrator

      protected RombergIntegrator(T q, double eps)
      Constructor.
      Parameters:
      q - Quadrature used for integration.
      eps - Required accuracy.
  • Method Details

    • integrate

      public double integrate() throws IntegrationException
      Integrates function between lower and upper limits defined by provided quadrature. This implementation is suitable for open intervals.
      Specified by:
      integrate in class Integrator
      Returns:
      result of integration.
      Throws:
      IntegrationException - if integration fails for numerical reasons.
    • getIntegratorType

      public IntegratorType getIntegratorType()
      Gets type of integrator.
      Specified by:
      getIntegratorType in class Integrator
      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

      private static RombergIntegrator<Quadrature> cast(RombergIntegrator<?> integrator)
      Casts integrator to a quadrature integrator without wildcard parameter. .
      Parameters:
      integrator - integrator to be cast.
      Returns:
      cast integrator.