![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006-2012, Jerry Gagelman 00005 and Andrew W. Steiner 00006 00007 This file is part of O2scl. 00008 00009 O2scl is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 O2scl is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00021 00022 ------------------------------------------------------------------- 00023 */ 00024 #ifndef O2SCL_GSL_INTE_QAGS_H 00025 #define O2SCL_GSL_INTE_QAGS_H 00026 00027 #include <o2scl/inte.h> 00028 #include <o2scl/funct.h> 00029 #include <o2scl/gsl_inte_singular.h> 00030 00031 #ifndef DOXYGENP 00032 namespace o2scl { 00033 #endif 00034 00035 /** \brief Integrate a function with a singularity (GSL) 00036 00037 If a function is unbounded but has a finite integral, using the 00038 adaptive algorithm described for \ref gsl_inte_qag to compute 00039 that integral (up to specified tolerance) will converge very 00040 slowly. The integration routine of this class remedies this by 00041 combining the adaptive algorithm with a series-acceleration 00042 method. 00043 00044 See \ref gslinte_subsect in the User's guide for general 00045 information about the GSL integration classes. 00046 00047 \comment 00048 Note that it's important that this is separate from 00049 gsl_inte_singular::qags(), since this class uses set_rule(2) 00050 while other children of gsl_inte_singular do not. 00051 \endcomment 00052 */ 00053 template<class func_t=funct> class gsl_inte_qags : 00054 public gsl_inte_singular<func_t> { 00055 00056 public: 00057 00058 gsl_inte_qags() { 00059 this->set_rule(2); 00060 } 00061 00062 virtual ~gsl_inte_qags() { 00063 } 00064 00065 /** \brief Integrate function \c func from \c a to \c b and place 00066 the result in \c res and the error in \c err 00067 */ 00068 virtual int integ_err(func_t &func, double a, double b, 00069 double &res, double &err) { 00070 this->last_conv=0; 00071 return qags(func,a,b,this->tol_abs,this->tol_rel,&res,&err); 00072 } 00073 00074 }; 00075 00076 #ifndef DOXYGENP 00077 } 00078 #endif 00079 00080 #endif
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).