1 /* 2 * Copyright (C) 2023 Alberto Irurueta Carro (alberto@irurueta.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.irurueta.numerical.integration; 17 18 import com.irurueta.algebra.WrongSizeException; 19 20 /** 21 * Computes function integration by using Simpson's rule and Lower Square Root mid-point quadrature 22 * when lower integration bound lies at a function singularity. 23 */ 24 public class SimpsonLowerSquareRootMidPointQuadratureMatrixIntegrator 25 extends SimpsonMatrixIntegrator<LowerSquareRootMidPointMatrixQuadrature> { 26 27 /** 28 * Constructor. 29 * 30 * @param a Lower limit of integration. 31 * @param b Upper limit of integration. 32 * @param listener listener to evaluate a single dimension matrix (multivariate) function at 33 * required points. 34 * @param eps required accuracy. 35 * @throws WrongSizeException if size notified by provided listener is invalid. 36 */ 37 public SimpsonLowerSquareRootMidPointQuadratureMatrixIntegrator( 38 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener, 39 final double eps) throws WrongSizeException { 40 super(new LowerSquareRootMidPointMatrixQuadrature(a, b, listener), eps); 41 } 42 43 /** 44 * Constructor with default accuracy. 45 * 46 * @param a Lower limit of integration. 47 * @param b Upper limit of integration. 48 * @param listener listener to evaluate a single dimension function at required points. 49 * @throws WrongSizeException if size notified by provided listener is invalid. 50 */ 51 public SimpsonLowerSquareRootMidPointQuadratureMatrixIntegrator( 52 final double a, final double b, final MatrixSingleDimensionFunctionEvaluatorListener listener) 53 throws WrongSizeException { 54 this(a, b, listener, EPS); 55 } 56 57 /** 58 * Gets type of quadrature. 59 * 60 * @return type of quadrature. 61 */ 62 @Override 63 public QuadratureType getQuadratureType() { 64 return QuadratureType.LOWER_SQUARE_ROOT_MID_POINT; 65 } 66 }