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 #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 class is experimental. 00043 00044 This gives an approximation to the polylogarithm functions. 00045 00046 Only works at present for \f$n=0,1,...,6\f$. Uses GSL library 00047 for n=2. 00048 00049 Uses linear interpolation for \f$-1<x<0\f$ 00050 and a series expansion for \f$x<-1\f$ 00051 00052 \future 00053 - Give error estimate? 00054 - Improve accuracy? 00055 - Use more sophisticated interpolation? 00056 - Add the series \f$Li(n,x)=x+2^{-n} x^2+3^{-n} x^3+...\f$ 00057 for \f$ x \rightarrow 0\f$? 00058 - Implement for positive arguments < 1.0 00059 - Make another polylog class which implements series acceleration? 00060 00061 For reference, there are exact relations 00062 \f[ 00063 \mathrm{Li}_2 \left(\frac{1}{2}\right) = 00064 \frac{1}{12}\left[\pi^2-6\left(\ln 2\right)^2\right] 00065 \f] 00066 \f[ 00067 \mathrm{Li}_3 \left(\frac{1}{2}\right) = 00068 \frac{1}{24}\left[ 4\left(\ln 2\right)^3 - 2 \pi^2 \ln 2 + 00069 21 \zeta (3) \right] 00070 \f] 00071 \f[ 00072 \mathrm{Li}_{-1} (x) = \frac{x}{\left(1-x\right)^2} 00073 \f] 00074 \f[ 00075 \mathrm{Li}_{-2} (x) = \frac{x\left(x+1\right)}{\left(1-x\right)^3} 00076 \f] 00077 00078 */ 00079 class polylog { 00080 00081 public: 00082 00083 /// 0-th order polylogarithm = \f$ x/(1-x)\f$ 00084 double li0(double x); 00085 00086 /// 1-st order polylogarithm = \f$ -\ln(1-x) \f$ 00087 double li1(double x); 00088 00089 /// 2-nd order polylogarithm 00090 double li2(double x); 00091 00092 /// 3-rd order polylogarithm 00093 double li3(double x); 00094 00095 /// 4-th order polylogarithm 00096 double li4(double x); 00097 00098 /// 5-th order polylogarithm 00099 double li5(double x); 00100 00101 /// 6-th order polylogarithm 00102 double li6(double x); 00103 00104 polylog(); 00105 ~polylog(); 00106 00107 protected: 00108 00109 #ifndef DOXYGENP 00110 00111 double *arg; 00112 double *two; 00113 double *three; 00114 double *four; 00115 double *five; 00116 double *six; 00117 double li2neg1; 00118 double li4neg1; 00119 double li6neg1; 00120 00121 #endif 00122 00123 }; 00124 00125 #ifndef DOXYGENP 00126 } 00127 #endif 00128 00129 #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