ClausenFunctions.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 HEPfit Collaboration
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #include <cstdlib>
9 #include <stdexcept>
10 #include <cmath>
11 #include <gsl/gsl_sf.h>
12 #include "ClausenFunctions.h"
13 
14 
16 {
17 }
18 
20 
21 double ClausenFunctions::Cl2(const double phi) const
22 {
23  return ( gsl_sf_clausen(phi) );
24 }
25 
26 double ClausenFunctions::Cl3(const double phi) const
27 {
28  if (phi < 0.0 || phi > M_PI)
29  throw std::runtime_error("ClausenFunctions::Cl3(): phi is out of range!");
30 
31  if (phi==0.0) return ( gsl_sf_zeta_int(3) );
32 
33  double TMP = 0.0, l_double = 0.0, lfactorial = 1.0, sign = 1.0;
34  for (int l=2; l<19; l++) {
35  l_double = (double)l;
36  lfactorial *= l_double;
37  if (l%4) { sign = - 1.0; } else { sign = 1.0; }
38  TMP += B[l]*pow(phi,l_double)/l_double/(l_double + 1.0)/(l_double + 2.0)
39  /lfactorial * sign;
40  }
41  return ( gsl_sf_zeta_int(3) - phi*phi*(3.0/4.0 - log(phi)/2.0 - TMP) );
42 }
43 
44 
complex pow(const complex &z1, const complex &z2)
double Cl2(const double phi) const
The Clausen function of index 2, .
ClausenFunctions()
The default constructor.
double B[19]
the Bernoulli numbers
complex log(const complex &z)
double Cl3(const double phi) const
The Clausen function of index 3, .