8#include <gsl/gsl_math.h>
23 double z_abs = abs(
z);
27 return complex<double>(std::numeric_limits<double>::max(), 0.0);
28 }
else if (z_abs < 10.0)
34 complex<double> z1(1.0, 0.0);
35 complex<double> z2(1.0, 0.0);
36 for (
int i = 1; i <= 100; i++)
38 z2 = -
static_cast<double>(i) * (z2 *
z) / ((i + 1.0) * (i + 1.0));
40 if (abs(z2) < 1.0E-10 * abs(z1))
43 return exp(
z) * (-log(
z) - M_EULER +
z * z1);
46 complex<double> z1(0.0, 0.0);
47 for (
int i = 20; i >= 1; i--)
48 z1 =
static_cast<double>(i) / (1.0 +
static_cast<double>(i) / (
z + z1));
49 complex<double> retVal = 1.0 / (
z + z1);
50 if (
z.real() <= 0.0 &&
z.imag() == 0.0)
51 retVal -= exp(
z) * complex<double>(0.0, 1.0) * M_PI;
std::complex< double > MANTID_CURVEFITTING_DLL exponentialIntegral(const std::complex< double > &z)
Compute exp(z)*E1(z) where z is complex and E1(z) is the Exponential Integral.