11#include <gsl/gsl_complex.h>
12#include <gsl/gsl_sf.h>
25 gsl_sf_complex_dilog_xy_e(x, 0.0, &re, &im);
26 return gslpp::complex(re.val, im.val,
false);
32 gsl_sf_complex_dilog_xy_e(z.real(), z.imag(), &re, &im);
33 return gslpp::complex(re.val, im.val,
false);
40 Li3 = -gsl_sf_fermi_dirac_2(log(-x));
43 else if (x > 0.0 && x < 0.5) {
44 double log_1mx = log(1.0 - x);
45 double lfactorial = 1.0, kfactorial = 1.0;
46 for (
int l=0; l<19; l++) {
47 if (l!=0) lfactorial *= (double)l;
49 for (
int k=0; k<19; k++) {
50 if (k!=0) kfactorial *= (double)k;
51 Li3 +=
B[l]*
B[k]/((double)l+1.0)/((double)l+(
double)k+1.0)
52 /lfactorial/kfactorial
53 * pow(-log_1mx, (
double)l+(double)k+1.0);
56 }
else if (x == 0.5) {
57 double log2 = log(2.0);
58 double zeta3 = gsl_sf_zeta_int(3);
59 Li3 = (4.0*pow(log2, 3.0) - 2.0*M_PI*M_PI*log2 + 21.0*zeta3)/24.0;
60 }
else if (x > 0.5 && x < 1.0) {
61 double log_x = log(x);
62 double S12 = 0.0, lfactorial = 1.0;
63 for (
int l=0; l<19; l++) {
64 if (l!=0) lfactorial *= (double)l;
65 S12 += 0.5 *
B[l]/((double)l+2.0)/lfactorial
66 * pow(-log_x, (
double)l+2.0);
68 Li3 = - S12 - log_x*gsl_sf_dilog(1.0-x) - 0.5*log_x*log_x*log(1.0-x)
69 + gsl_sf_zeta_int(2)*log_x + gsl_sf_zeta_int(3);
71 Li3 = gsl_sf_zeta_int(3);
73 throw std::runtime_error(
"Polylogarithms::Li3(): x is out of range!");
double B[19]
the Bernoulli numbers
double Li3(const double x) const
The trilogarithm .
Polylogarithms()
The default constructor.
gslpp::complex Li2(const double x) const
The dilogarithm with a real argument, .