Class MidPointMatrixQuadrature

java.lang.Object
com.irurueta.numerical.integration.MatrixQuadrature
com.irurueta.numerical.integration.MidPointMatrixQuadrature
Direct Known Subclasses:
ExponentialMidPointMatrixQuadrature, InfinityMidPointMatrixQuadrature, LowerSquareRootMidPointMatrixQuadrature, UpperSquareRootMidPointMatrixQuadrature

public class MidPointMatrixQuadrature extends MatrixQuadrature
Implementation of matrix quadrature using mid-point algorithm. Mid-point algorithm is suitable for improper integrations, which consists of the following situations: - integrand goes to a finite limiting value at finite upper and lower limits, but cannot be evaluated right on one of those limits (e.g. sin(x)/x at x = 0) - the upper limit is positive infinity, or the lower limit is negative infinity. - integrand has an integrable singularity at either limit (e.g. x^-0.5 at x = 0) - integrand has an integrable singularity at a known place between its upper and lower limits. - integrand has an integrable singularity at an unknown place between its upper and lower limits.

Impossible integrals, such as those being infinite (e.g. integral from 1 to infinity of x^-1) or those that have no limiting sense (e.g. integral from -infinity to infinity of cos(x)) cannot be handled by this implementation.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final double
    Lower limit of integration.
    private final double
    Upper limit of integration.
    private final int
    Number of columns of quadrature result.
    Listener to evaluate single dimension matrix functions at required points.
    private final int
    Number of rows of quadrature result.
    private final com.irurueta.algebra.Matrix
    Current value of integral.
    private final com.irurueta.algebra.Matrix
    Temporary value storing summation of evaluations.
    private final com.irurueta.algebra.Matrix
    Temporary value storing evaluation at mid-point.
    private final com.irurueta.algebra.Matrix
    Temporary value storing evaluation at point x.

    Fields inherited from class com.irurueta.numerical.integration.MatrixQuadrature

    n
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    func(double x, com.irurueta.algebra.Matrix result)
    Evaluates matrix function at x.
    double
    Gets lower limit of integration.
    double
    Gets upper limit of integration.
    protected int
    Gets number of columns of quadrature result.
    protected int
    Gets number of rows of quadrature result.
    com.irurueta.algebra.Matrix
    Gets current value of integral.
    Gets type of quadrature.
    void
    next(com.irurueta.algebra.Matrix result)
    Returns the value of the integral at the nth stage of refinement.

    Methods inherited from class com.irurueta.numerical.integration.MatrixQuadrature

    getN

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • a

      private final double a
      Lower limit of integration.
    • b

      private final double b
      Upper limit of integration.
    • rows

      private final int rows
      Number of rows of quadrature result.
    • columns

      private final int columns
      Number of columns of quadrature result.
    • s

      private final com.irurueta.algebra.Matrix s
      Current value of integral.
    • listener

      Listener to evaluate single dimension matrix functions at required points.
    • tmpMid

      private final com.irurueta.algebra.Matrix tmpMid
      Temporary value storing evaluation at mid-point.
    • sum

      private final com.irurueta.algebra.Matrix sum
      Temporary value storing summation of evaluations.
    • tmpX

      private final com.irurueta.algebra.Matrix tmpX
      Temporary value storing evaluation at point x.
  • Constructor Details

    • MidPointMatrixQuadrature

      public MidPointMatrixQuadrature(double a, double b, MatrixSingleDimensionFunctionEvaluatorListener listener) throws com.irurueta.algebra.WrongSizeException
      Constructor.
      Parameters:
      a - Lower limit of integration.
      b - Upper limit of integration.
      listener - listener to evaluate a single dimension matrix function at required points.
      Throws:
      com.irurueta.algebra.WrongSizeException - if size notified by provided listener is invalid.
  • Method Details

    • getA

      public double getA()
      Gets lower limit of integration.
      Returns:
      lower limit of integration.
    • getB

      public double getB()
      Gets upper limit of integration.
      Returns:
      upper limit of integration.
    • getS

      public com.irurueta.algebra.Matrix getS()
      Gets current value of integral.
      Returns:
      current value of integral.
    • next

      public void next(com.irurueta.algebra.Matrix result) throws EvaluationException
      Returns the value of the integral at the nth stage of refinement.
      Specified by:
      next in class MatrixQuadrature
      Parameters:
      result - instance where the value of the integral at the nth stage of refinement will be stored.
      Throws:
      EvaluationException - Raised if something failed during the evaluation.
    • getType

      public QuadratureType getType()
      Gets type of quadrature.
      Specified by:
      getType in class MatrixQuadrature
      Returns:
      type of quadrature.
    • getRows

      protected int getRows()
      Gets number of rows of quadrature result.
      Specified by:
      getRows in class MatrixQuadrature
      Returns:
      number of rows of quadrature result.
    • getColumns

      protected int getColumns()
      Gets number of columns of quadrature result.
      Specified by:
      getColumns in class MatrixQuadrature
      Returns:
      number of columns of quadrature result.
    • func

      protected void func(double x, com.irurueta.algebra.Matrix result) throws EvaluationException
      Evaluates matrix function at x.
      Parameters:
      x - point where function is evaluated.
      result - instance where result of evaluation is stored.
      Throws:
      EvaluationException - if evaluation fails.