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

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