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