inte_qagil_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_QAGIL_H
25 #define O2SCL_GSL_INTE_QAGIL_H
26 
27 /** \file inte_qagil_gsl.h
28  \brief File defining \ref o2scl::inte_qagil_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$
38  (-\infty, b] \f$ (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_{-\infty}^b f(x)~dx =
44  \int_0^1 f(b - (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_qagil_gsl :
52  public inte_transform_gsl<func_t> {
53 
54 #ifndef DOXYGEN_INTERNAL
55 
56  protected:
57 
58  /// The upper limit
59  double upper_limit;
60 
61 #endif
62 
63  public:
64 
65  /** \brief Integrate function \c func from \f$ -\infty \f$ to \c b
66  and place the result in \c res and the error in \c err
67 
68  The value given in \c a is ignored.
69  */
70  virtual int integ_err(func_t &func, double a, double b,
71  double &res, double &err) {
72  upper_limit=b;
73  return this->qags(func,0.0,1.0,this->tol_abs,this->tol_rel,&res,&err);
74  }
75 
76  protected:
77 
78  /// Transform to \f$ t \in (0,1] \f$
79  virtual double transform(double t, func_t &func) {
80  double x=upper_limit-(1-t)/t, y;
81  y=func(x);
82  return y/t/t;
83  }
84 
85  };
86 
87 #ifndef DOXYGEN_NO_O2NS
88 }
89 #endif
90 
91 #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
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 int integ_err(func_t &func, double a, double b, double &res, double &err)
Integrate function func from to b and place the result in res and the error in err.
Integrate a function over the interval (GSL)
double tol_abs
The maximum absolute uncertainty in the value of the integral (default )
Definition: inte.h:73
virtual double transform(double t, func_t &func)
Transform to .
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
double upper_limit
The upper limit.

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