Class MidPointMatrixQuadrature
java.lang.Object
com.irurueta.numerical.integration.MatrixQuadrature
com.irurueta.numerical.integration.MidPointMatrixQuadrature
- Direct Known Subclasses:
ExponentialMidPointMatrixQuadrature,InfinityMidPointMatrixQuadrature,LowerSquareRootMidPointMatrixQuadrature,UpperSquareRootMidPointMatrixQuadrature
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
FieldsModifier and TypeFieldDescriptionprivate final doubleLower limit of integration.private final doubleUpper limit of integration.private final intNumber of columns of quadrature result.protected final MatrixSingleDimensionFunctionEvaluatorListenerListener to evaluate single dimension matrix functions at required points.private final intNumber of rows of quadrature result.private final com.irurueta.algebra.MatrixCurrent value of integral.private final com.irurueta.algebra.MatrixTemporary value storing summation of evaluations.private final com.irurueta.algebra.MatrixTemporary value storing evaluation at mid-point.private final com.irurueta.algebra.MatrixTemporary value storing evaluation at point x.Fields inherited from class com.irurueta.numerical.integration.MatrixQuadrature
n -
Constructor Summary
ConstructorsConstructorDescriptionMidPointMatrixQuadrature(double a, double b, MatrixSingleDimensionFunctionEvaluatorListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfunc(double x, com.irurueta.algebra.Matrix result) Evaluates matrix function at x.doublegetA()Gets lower limit of integration.doublegetB()Gets upper limit of integration.protected intGets number of columns of quadrature result.protected intgetRows()Gets number of rows of quadrature result.com.irurueta.algebra.MatrixgetS()Gets current value of integral.getType()Gets type of quadrature.voidnext(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
-
Field Details
-
a
private final double aLower limit of integration. -
b
private final double bUpper limit of integration. -
rows
private final int rowsNumber of rows of quadrature result. -
columns
private final int columnsNumber of columns of quadrature result. -
s
private final com.irurueta.algebra.Matrix sCurrent value of integral. -
listener
Listener to evaluate single dimension matrix functions at required points. -
tmpMid
private final com.irurueta.algebra.Matrix tmpMidTemporary value storing evaluation at mid-point. -
sum
private final com.irurueta.algebra.Matrix sumTemporary value storing summation of evaluations. -
tmpX
private final com.irurueta.algebra.Matrix tmpXTemporary 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
Returns the value of the integral at the nth stage of refinement.- Specified by:
nextin classMatrixQuadrature- 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
Gets type of quadrature.- Specified by:
getTypein classMatrixQuadrature- Returns:
- type of quadrature.
-
getRows
protected int getRows()Gets number of rows of quadrature result.- Specified by:
getRowsin classMatrixQuadrature- Returns:
- number of rows of quadrature result.
-
getColumns
protected int getColumns()Gets number of columns of quadrature result.- Specified by:
getColumnsin classMatrixQuadrature- Returns:
- number of columns of quadrature result.
-
func
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.
-