View Javadoc
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 exponential quadrature.
22   * Exponential quadrature allows improper integrations when upper bound is at infinity.
23   *
24   * @see ExponentialMidPointQuadrature
25   */
26  public class RombergExponentialMidPointQuadratureIntegrator extends RombergIntegrator<ExponentialMidPointQuadrature> {
27  
28      /**
29       * Constructor.
30       *
31       * @param a        Lower limit of integration.
32       * @param listener listener to evaluate a single dimension function at required points.
33       * @param eps      required accuracy.
34       */
35      public RombergExponentialMidPointQuadratureIntegrator(
36              final double a, final SingleDimensionFunctionEvaluatorListener listener, final double eps) {
37          super(new ExponentialMidPointQuadrature(a, listener), eps);
38      }
39  
40      /**
41       * Constructor with default accuracy.
42       *
43       * @param a        Lower limit of integration.
44       * @param listener listener to evaluate a single dimension function at required points.
45       */
46      public RombergExponentialMidPointQuadratureIntegrator(
47              final double a, final SingleDimensionFunctionEvaluatorListener listener) {
48          this(a, listener, EPS);
49      }
50  
51      /**
52       * Gets type of quadrature.
53       *
54       * @return type of quadrature.
55       */
56      @Override
57      public QuadratureType getQuadratureType() {
58          return QuadratureType.EXPONENTIAL_MID_POINT;
59      }
60  }