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

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.