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 Romberg's method and double exponential quadrature. 22 * Double exponential quadrature allows improper integrands containing singularities to be 23 * integrated. 24 * 25 * @see DoubleExponentialRuleQuadrature 26 */ 27 public class RombergDoubleExponentialRuleQuadratureIntegrator 28 extends RombergIntegrator<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 RombergDoubleExponentialRuleQuadratureIntegrator( 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 RombergDoubleExponentialRuleQuadratureIntegrator( 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 RombergDoubleExponentialRuleQuadratureIntegrator( 69 final double a, final double b, final double hmax, 70 final SingleDimensionFunctionEvaluatorListener listener) { 71 this(a, b, hmax, listener, EPS); 72 } 73 74 /** 75 * Constructor with default accuracy and default maximum step size. 76 * 77 * @param a Lower limit of integration. 78 * @param b Upper limit of integration. 79 * @param listener listener to evaluate a single dimension function at required points. 80 */ 81 public RombergDoubleExponentialRuleQuadratureIntegrator( 82 final double a, final double b, final SingleDimensionFunctionEvaluatorListener listener) { 83 this(a, b, listener, EPS); 84 } 85 86 /** 87 * Constructor. 88 * 89 * @param a Lower limit of integration. 90 * @param b Upper limit of integration. 91 * @param hmax Maximum step size. This quadrature transforms the range of integration to 92 * [-hmax, hmax]. 93 * @param listener listener to evaluate a single dimension function at required points for 94 * double exponential quadrature to take into account any non-mild 95 * singularities. 96 * @param eps required accuracy. 97 */ 98 public RombergDoubleExponentialRuleQuadratureIntegrator( 99 final double a, final double b, final double hmax, 100 final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener, final double eps) { 101 super(new DoubleExponentialRuleQuadrature(listener, a, b, hmax), eps); 102 } 103 104 /** 105 * Constructor with default maximum step size. 106 * 107 * @param a Lower limit of integration. 108 * @param b Upper limit of integration. 109 * @param listener listener to evaluate a single dimension function at required points for 110 * double exponential quadrature to take into account any non-mild 111 * singularities. 112 * @param eps required accuracy. 113 */ 114 public RombergDoubleExponentialRuleQuadratureIntegrator( 115 final double a, final double b, final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener, 116 final double eps) { 117 super(new DoubleExponentialRuleQuadrature(listener, a, b), eps); 118 } 119 120 /** 121 * Constructor with default accuracy. 122 * 123 * @param a Lower limit of integration. 124 * @param b Upper limit of integration. 125 * @param hmax Maximum step size. This quadrature transforms the range of integration to 126 * [-hmax, hmax]. 127 * @param listener listener to evaluate a single dimension function at required points for 128 * double exponential quadrature to take into account any non-mild 129 * singularities. 130 */ 131 public RombergDoubleExponentialRuleQuadratureIntegrator( 132 final double a, final double b, final double hmax, 133 final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener) { 134 this(a, b, hmax, listener, EPS); 135 } 136 137 /** 138 * Constructor with default accuracy and default maximum step size. 139 * 140 * @param a Lower limit of integration. 141 * @param b Upper limit of integration. 142 * @param listener listener to evaluate a single dimension function at required points for 143 * double exponential quadrature to take into account any non-mild 144 * singularities. 145 */ 146 public RombergDoubleExponentialRuleQuadratureIntegrator( 147 final double a, final double b, final DoubleExponentialSingleDimensionFunctionEvaluatorListener listener) { 148 this(a, b, listener, EPS); 149 } 150 151 /** 152 * Gets type of quadrature. 153 * 154 * @return type of quadrature. 155 */ 156 @Override 157 public QuadratureType getQuadratureType() { 158 return QuadratureType.DOUBLE_EXPONENTIAL_RULE; 159 } 160 }