inte_qagiu_gsl.h
Go to the documentation of this file.
1  /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, Jerry Gagelman and Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_GSL_INTE_QAGIU_H
24 #define O2SCL_GSL_INTE_QAGIU_H
25 
26 /** \file inte_qagiu_gsl.h
27  \brief File defining \ref o2scl::inte_qagiu_gsl
28 */
29 #include <o2scl/inte.h>
30 #include <o2scl/inte_qags_gsl.h>
31 
32 #ifndef DOXYGEN_NO_O2NS
33 namespace o2scl {
34 #endif
35 
36  /** \brief Integrate a function over the interval \f$ [a, \infty) \f$
37  (GSL)
38 
39  The integral on the unbounded interval is rewritten over the
40  semi-open interval \f$ (0, 1] \f$ via a variable transformation,
41  \f[
42  \int_a^{\infty} f(x)~dx =
43  \int_0^1 f(a + (1-t)/t)t^{-2}~dt,
44  \f]
45  and the right hand side is evaluated with \ref o2scl::inte_qags_gsl.
46 
47  See \ref gslinte_subsect in the User's guide for general
48  information about the GSL integration classes.
49  */
50  template<class func_t=funct> class inte_qagiu_gsl :
51  public inte_transform_gsl<func_t> {
52 
53 #ifndef DOXGYEN_INTERNAL
54 
55  protected:
56 
57  /// The lower limit
58  double lower_limit;
59 
60 #endif
61 
62  public:
63 
64  /** \brief Integrate a function over the interval \f$ [a, \infty) \f$
65  giving result \c res and error \c err
66 
67  The value \c b is ignored.
68  */
69  virtual int integ_err(func_t &func, double a, double b,
70  double &res, double &err) {
71  lower_limit=a;
72  return this->qags(func,0.0,1.0,this->tol_abs,this->tol_rel,&res,&err);
73  }
74 
75 #ifndef DOXYGEN_INTERNAL
76 
77  protected:
78 
79  /// Transform to \f$ t \in (0,1] \f$
80  virtual double transform(double t, func_t &func) {
81  double x=lower_limit+(1-t)/t, y=0.0;
82  y=func(x);
83  return y/t/t;
84  }
85 
86 #endif
87 
88  };
89 
90 #ifndef DOXYGEN_NO_O2NS
91 }
92 #endif
93 
94 #endif
o2scl
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
Definition: anneal.h:42
o2scl::inte_qagiu_gsl
Integrate a function over the interval (GSL)
Definition: inte_qagiu_gsl.h:50
o2scl::inte_qagiu_gsl::lower_limit
double lower_limit
The lower limit.
Definition: inte_qagiu_gsl.h:58
o2scl::inte_qagiu_gsl::transform
virtual double transform(double t, func_t &func)
Transform to .
Definition: inte_qagiu_gsl.h:80
o2scl::inte_singular_gsl< funct >::qags
int qags(funct &func, const double a, const double b, const double l_epsabs, const double l_epsrel, double *result, double *abserr)
Integration function.
Definition: inte_singular_gsl.h:348
o2scl::inte_transform_gsl
Integrate a function with a singularity (GSL) [abstract base].
Definition: inte_singular_gsl.h:749
o2scl::inte< funct >::tol_abs
double tol_abs
The maximum absolute uncertainty in the value of the integral (default )
Definition: inte.h:80
o2scl::inte< funct >::tol_rel
double tol_rel
The maximum relative uncertainty in the value of the integral (default )
Definition: inte.h:75
o2scl::inte_qagiu_gsl::integ_err
virtual int integ_err(func_t &func, double a, double b, double &res, double &err)
Integrate a function over the interval giving result res and error err.
Definition: inte_qagiu_gsl.h:69

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).