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.numerical.SingleDimensionFunctionEvaluatorListener; 19 20 /** 21 * Computes function integration by using double exponential quadrature. 22 * Double exponential quadrature allows improper integrands containing singularities to be 23 * integrated. 24 * 25 * @see DoubleExponentialRuleQuadrature 26 */ 27 public class DoubleExponentialRuleQuadratureIntegrator 28 extends QuadratureIntegrator<DoubleExponentialRuleQuadrature> { 29 30 /** 31 * Constructor. 32 * 33 * @param a Lower limit of integration. 34 * @param b Upper limit of integration. 35 * @param hmax Maximum step size. This quadrature transforms the range of integration to 36 * [-hmax, hmax]. 37 * @param listener listener to evaluate a single dimension function at required points. 38 * @param eps required accuracy. 39 */ 40 public DoubleExponentialRuleQuadratureIntegrator( 41 final double a, final double b, final double hmax, final SingleDimensionFunctionEvaluatorListener listener, 42 final double eps) { 43 super(new DoubleExponentialRuleQuadrature(listener, a, b, hmax), eps); 44 } 45 46 /** 47 * Constructor. 48 * 49 * @param a Lower limit of integration. 50 * @param b Upper limit of integration. 51 * @param listener listener to evaluate a single dimension function at required points. 52 * @param eps required accuracy. 53 */ 54 public DoubleExponentialRuleQuadratureIntegrator( 55 final double a, final double b, final SingleDimensionFunctionEvaluatorListener listener, final double eps) { 56 super(new DoubleExponentialRuleQuadrature(listener, a, b), eps); 57 } 58 59 /** 60 * Constructor with default accuracy. 61 * 62 * @param a Lower limit of integration. 63 * @param b Upper limit of integration. 64 * @param hmax Maximum step size. This quadrature transforms the range of integration to 65 * [-hmax, hmax]. 66 * @param listener listener to evaluate a single dimension function at required points. 67 */ 68 public DoubleExponentialRuleQuadratureIntegrator( 69 final double a, final double b, final double hmax, final SingleDimensionFunctionEvaluatorListener listener) { 70 this(a, b, hmax, listener, EPS); 71 } 72 73 /** 74 * Constructor with default accuracy and default maximum step size. 75 * 76 * @param a Lower limit of integration. 77 * @param b Upper limit of integration. 78 * @param listener listener to evaluate a single dimension function at required points. 79 */ 80 public DoubleExponentialRuleQuadratureIntegrator( 81 final double a, final double b, final SingleDimensionFunctionEvaluatorListener listener) { 82 this(a, b, listener, EPS); 83 } 84 85 /** 86 * Constructor. 87 * 88 * @param a Lower limit of integration. 89 * @param b Upper limit of integration. 90 * @param hmax Maximum step size. This quadrature transforms the range of integration to 91 * [-hmax, hmax]. 92 * @param listener listener to evaluate a single dimension function at required points for 93 * double exponential quadrature to take into account any non-mild 94 * singularities. 95 * @param eps required accuracy. 96 */ 97 public DoubleExponentialRuleQuadratureIntegrator( 98 final double a, final double b, final double hmax, 99 final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener, final double eps) { 100 super(new DoubleExponentialRuleQuadrature(listener, a, b, hmax), eps); 101 } 102 103 /** 104 * Constructor with default maximum step size. 105 * 106 * @param a Lower limit of integration. 107 * @param b Upper limit of integration. 108 * @param listener listener to evaluate a single dimension function at required points for 109 * double exponential quadrature to take into account any non-mild 110 * singularities. 111 * @param eps required accuracy. 112 */ 113 public DoubleExponentialRuleQuadratureIntegrator( 114 final double a, final double b, final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener, 115 final double eps) { 116 super(new DoubleExponentialRuleQuadrature(listener, a, b), eps); 117 } 118 119 /** 120 * Constructor with default accuracy. 121 * 122 * @param a Lower limit of integration. 123 * @param b Upper limit of integration. 124 * @param hmax Maximum step size. This quadrature transforms the range of integration to 125 * [-hmax, hmax]. 126 * @param listener listener to evaluate a single dimension function at required points for 127 * double exponential quadrature to take into account any non-mild 128 * singularities. 129 */ 130 public DoubleExponentialRuleQuadratureIntegrator( 131 final double a, final double b, final double hmax, 132 final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener) { 133 this(a, b, hmax, listener, EPS); 134 } 135 136 /** 137 * Constructor with default accuracy and default maximum step size. 138 * 139 * @param a Lower limit of integration. 140 * @param b Upper limit of integration. 141 * @param listener listener to evaluate a single dimension function at required points for 142 * double exponential quadrature to take into account any non-mild 143 * singularities. 144 */ 145 public DoubleExponentialRuleQuadratureIntegrator( 146 final double a, final double b, final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener) { 147 this(a, b, listener, EPS); 148 } 149 150 /** 151 * Gets type of quadrature. 152 * 153 * @return type of quadrature. 154 */ 155 @Override 156 public QuadratureType getQuadratureType() { 157 return QuadratureType.DOUBLE_EXPONENTIAL_RULE; 158 } 159 }