00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 /* 00024 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough 00025 * 00026 * This program is free software; you can redistribute it and/or modify 00027 * it under the terms of the GNU General Public License as published by 00028 * the Free Software Foundation; either version 3 of the License, or (at 00029 * your option) any later version. 00030 * 00031 * This program is distributed in the hope that it will be useful, but 00032 * WITHOUT ANY WARRANTY; without even the implied warranty of 00033 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00034 * General Public License for more details. 00035 * 00036 * You should have received a copy of the GNU General Public License 00037 * along with this program; if not, write to the Free Software 00038 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00039 * 02110-1301, USA. 00040 */ 00041 #ifndef O2SCL_GSL_INTE_H 00042 #define O2SCL_GSL_INTE_H 00043 00044 #include <gsl/gsl_machine.h> 00045 00046 #ifndef DOXYGENP 00047 namespace o2scl { 00048 #endif 00049 00050 /** 00051 \brief GSL integration base 00052 00053 This base class does not perform any actual integration, but 00054 just provides functions to be used in the integration 00055 classes based on GSL. 00056 */ 00057 class gsl_inte { 00058 00059 public: 00060 00061 gsl_inte() { 00062 } 00063 00064 protected: 00065 00066 /** 00067 \brief Rescale errors appropriately 00068 00069 \comment 00070 This is close, but not quite right yet 00071 \f{eqnarray*} 00072 \mathrm{scale}&=&\left(200~\mathrm{err}/\mathrm{result\_asc} 00073 \right)^{3/2} \nonumber \\ 00074 e_1&=&\mathrm{min}(\mathrm{result\_asc}~\mathrm{scale}, 00075 \mathrm{result\_asc}) \nonumber \\ 00076 e_2&=&50~\epsilon~\mathrm{result\_abs} \nonumber \\ 00077 \mathrm{err}^{\prime} &\rightarrow& \mathrm{max}(e_1,e_2) 00078 \f} 00079 \endcomment 00080 */ 00081 double rescale_error(double err, const double result_abs, 00082 const double result_asc) { 00083 err = fabs(err); 00084 00085 if (result_asc != 0 && err != 0) { 00086 00087 double scale = pow((200 * err / result_asc), 1.5); 00088 00089 if (scale < 1) { 00090 err = result_asc * scale; 00091 } else { 00092 err = result_asc; 00093 } 00094 } 00095 00096 if (result_abs > GSL_DBL_MIN / (50 * GSL_DBL_EPSILON)) { 00097 00098 double min_err = 50 * GSL_DBL_EPSILON * result_abs; 00099 00100 if (min_err > err) { 00101 err = min_err; 00102 } 00103 } 00104 00105 return err; 00106 } 00107 00108 }; 00109 00110 00111 #ifndef DOXYGENP 00112 } 00113 #endif 00114 00115 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page