00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 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 #ifndef O2SCL_POLYLOG_H 00024 #define O2SCL_POLYLOG_H 00025 00026 #include <iostream> 00027 #include <fstream> 00028 #include <string> 00029 #include <cmath> 00030 #include <o2scl/constants.h> 00031 #include <o2scl/err_hnd.h> 00032 #include <o2scl/lib_settings.h> 00033 #include <gsl/gsl_sf_dilog.h> 00034 00035 #ifndef DOXYGENP 00036 namespace o2scl { 00037 #endif 00038 00039 /** 00040 \brief Polylogarithms (approximate) \f$ Li_n(x)\f$ 00041 00042 This gives an approximation to the polylogarithm functions. 00043 00044 Only works at present for \f$n=0,1,...,6\f$. Uses GSL library 00045 for n=2. 00046 00047 Uses linear interpolation for \f$-1<x<0\f$ 00048 and a series expansion for \f$x<-1\f$ 00049 00050 \todo 00051 - Give error estimate? 00052 - Improve accuracy? 00053 - Use more sophisticated interpolation? 00054 - Add the series \f$Li(n,x)=x+2^{-n} x^2+3^{-n} x^3+...\f$ 00055 for \f$ x \rightarrow 0\f$? 00056 - Implement for positive arguments < 1.0 00057 - Make another polylog class which implements series acceleration? 00058 00059 For reference, there are exact relations 00060 \f[ 00061 \mathrm{Li}_2 \left(\frac{1}{2}\right) = 00062 \frac{1}{12}\left[\pi^2-6\left(\ln 2\right)^2\right] 00063 \f] 00064 \f[ 00065 \mathrm{Li}_3 \left(\frac{1}{2}\right) = 00066 \frac{1}{24}\left[ 4\left(\ln 2\right)^3 - 2 \pi^2 \ln 2 + 00067 21 \zeta (3) \right] 00068 \f] 00069 \f[ 00070 \mathrm{Li}_{-1} (x) = \frac{x}{\left(1-x\right)^2} 00071 \f] 00072 \f[ 00073 \mathrm{Li}_{-2} (x) = \frac{x\left(x+1\right)}{\left(1-x\right)^3} 00074 \f] 00075 00076 */ 00077 class polylog { 00078 00079 public: 00080 /// 0-th order polylogarithm = \f$ x/(1-x)\f$ 00081 double li0(double x); 00082 /// 1-st order polylogarithm = \f$ -\ln(1-x) \f$ 00083 double li1(double x); 00084 /// 2-nd order polylogarithm 00085 double li2(double x); 00086 /// 3-rd order polylogarithm 00087 double li3(double x); 00088 /// 4-th order polylogarithm 00089 double li4(double x); 00090 /// 5-th order polylogarithm 00091 double li5(double x); 00092 /// 6-th order polylogarithm 00093 double li6(double x); 00094 00095 polylog(); 00096 ~polylog(); 00097 00098 protected: 00099 #ifndef DOXYGENP 00100 double *arg, *two, *three, *four, *five, *six; 00101 double li2neg1, li4neg1, li6neg1; 00102 #endif 00103 }; 00104 00105 #ifndef DOXYGENP 00106 } 00107 #endif 00108 00109 #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