inte_qags_gsl.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2017, 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_QAGS_H
24 #define O2SCL_GSL_INTE_QAGS_H
25 
26 /** \file inte_qags_gsl.h
27  \brief File defining \ref o2scl::inte_qags_gsl
28 */
29 #include <o2scl/inte.h>
30 #include <o2scl/funct.h>
31 #include <o2scl/inte_singular_gsl.h>
32 
33 #ifndef DOXYGEN_NO_O2NS
34 namespace o2scl {
35 #endif
36 
37  /** \brief Integrate a function with a singularity (GSL)
38 
39  If a function is unbounded but has a finite integral, using the
40  adaptive algorithm described for \ref inte_qag_gsl to compute
41  that integral (up to specified tolerance) will converge very
42  slowly. The integration routine of this class remedies this by
43  combining the adaptive algorithm with a series-acceleration
44  method.
45 
46  See \ref gslinte_subsect in the User's guide for general
47  information about the GSL integration classes.
48 
49  \comment
50  Note that it's important that this is separate from
51  inte_singular_gsl::qags(), since this class uses set_rule(2)
52  while other children of inte_singular_gsl do not.
53  \endcomment
54  */
55  template<class func_t=funct11> class inte_qags_gsl :
56  public inte_singular_gsl<func_t> {
57 
58  public:
59 
60  inte_qags_gsl() {
61  this->set_rule(2);
62  }
63 
64  virtual ~inte_qags_gsl() {
65  }
66 
67  /** \brief Integrate function \c func from \c a to \c b and place
68  the result in \c res and the error in \c err
69  */
70  virtual int integ_err(func_t &func, double a, double b,
71  double &res, double &err) {
72  return this->qags(func,a,b,this->tol_abs,this->tol_rel,&res,&err);
73  }
74 
75  };
76 
77 #ifndef DOXYGEN_NO_O2NS
78 }
79 #endif
80 
81 #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.
Base class for integrating a function with a singularity (GSL)
double tol_abs
The maximum absolute uncertainty in the value of the integral (default )
Definition: inte.h:73
virtual int integ_err(func_t &func, double a, double b, double &res, double &err)
Integrate function func from a to b and place the result in res and the error in err.
Definition: inte_qags_gsl.h:70
Integrate a function with a singularity (GSL)
Definition: inte_qags_gsl.h:55
void set_rule(int rule)
Set the Gauss-Kronrod integration rule to be used.
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).