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

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