Class SimpsonIntegrator<T extends Quadrature>

java.lang.Object
com.irurueta.numerical.integration.Integrator
com.irurueta.numerical.integration.SimpsonIntegrator<T>
Type Parameters:
T - a quadrature.
Direct Known Subclasses:
SimpsonDoubleExponentialRuleQuadratureIntegrator, SimpsonInfinityMidPointQuadratureIntegrator, SimpsonLowerSquareRootMidPointQuadratureIntegrator, SimpsonMidPointQuadratureIntegrator, SimpsonTrapezoidalQuadratureIntegrator, SimpsonUpperSquareRootMidPointQuadratureIntegrator

public abstract class SimpsonIntegrator<T extends Quadrature> extends Integrator
Base integrator for implementations based on Simpson's method. Simpson's method is an optimization of Trapezoidal quadrature integrator. Implementations of this class will in general be more efficient than Trapezoidal quadrature integrators (i.e., require fewer function evaluations) when the function to be integrated has a finite fourth derivative (i.e., a continuous third derivative).
  • Field Details

    • EPS

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

      private static final int JMIN
      Minimum required number of steps.
      See Also:
    • JMAX

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

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

      private final double eps
      Required accuracy.
  • Constructor Details

    • SimpsonIntegrator

      protected SimpsonIntegrator(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 provided lower and upper limits.
      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 SimpsonIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener, double eps, QuadratureType quadratureType)
      Creates an integrator using Simpson's method.
      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.
      Throws:
      IllegalArgumentException - if provided quadrature type is not supported.
    • create

      public static SimpsonIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener, QuadratureType quadratureType)
      Creates an integrator using Simpson's method and having default accuracy.
      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.
      Throws:
      IllegalArgumentException - if provided quadrature type is not supported.
    • create

      public static SimpsonIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener, double eps)
      Creates an integrator using Simpson's method and default 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 SimpsonIntegrator<Quadrature> create(double a, double b, SingleDimensionFunctionEvaluatorListener listener)
      Creates an integrator using Simpson's method and having default accuracy and 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 SimpsonIntegrator<Quadrature> cast(SimpsonIntegrator<?> integrator)
      Casts integrator to a quadrature integrator without wildcard parameter.
      Parameters:
      integrator - integrator to be cast.
      Returns:
      cast integrator.