inte_qagi_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_QAGI_H
25 #define O2SCL_GSL_INTE_QAGI_H
26 
27 /** \file inte_qagi_gsl.h
28  \brief File defining \ref o2scl::inte_qagi_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,\infty) \f$ (GSL)
39 
40  See \ref gslinte_subsect in the User's guide for general
41  information about the GSL integration classes.
42  */
43  template<class func_t=funct11 > class inte_qagi_gsl :
44  public inte_transform_gsl<func_t> {
45 
46  public:
47 
48  /** \brief Integrate function \c func from \f$ \infty \f$
49  to \f$ \infty \f$ giving result \c res and error \c err
50 
51  The values \c a and \c b are ignored
52  */
53  virtual int integ_err(func_t &func, double a, double b,
54  double &res, double &err) {
55  return this->qags(func,0.0,1.0,this->tol_abs,this->tol_rel,&res,&err);
56  }
57 
58 #ifndef DOXYGEN_INTERNAL
59 
60  protected:
61 
62  /// Tranformation to \f$ t \in (0,1] \f$
63  virtual double transform(double t, func_t &func) {
64  double x=(1-t)/t, y1, y2;
65  y1=func(x);
66  y2=func(-x);
67  return (y1+y2)/t/t;
68  }
69 
70 #endif
71 
72  };
73 
74 #ifndef DOXYGEN_NO_O2NS
75 }
76 #endif
77 
78 #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.
Integrate a function over the interval (GSL)
Definition: inte_qagi_gsl.h:43
virtual int integ_err(func_t &func, double a, double b, double &res, double &err)
Integrate function func from to giving result res and error err.
Definition: inte_qagi_gsl.h:53
double tol_abs
The maximum absolute uncertainty in the value of the integral (default )
Definition: inte.h:73
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
virtual double transform(double t, func_t &func)
Tranformation to .
Definition: inte_qagi_gsl.h:63

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