ei

constexpr Complex ei(const Complex &z) noexcept

Evaluates the exponential integral [1] for a complex input.

Parameters

const Complex &z

A complex number.

Returns

type Complex

A complex number.

The exponential integral for real inputs is defined as:

\[\DeclareMathOperator\Ei{Ei} \Ei(x) = -\int_{-x}^{\infty} \frac{e^{-t}}{t}dt\]

The definition can be extended to complex numbers as follows [2]:

\[\Ei(z) = \int_{0}^{z} \frac{e^{t} - 1}{t}dt + \frac{1}{2}(\log(z) - \log(\frac{1}{z})) + \gamma\]

where \(\gamma\) is the Euler–Mascheroni constant.

Example

Complex z = 1.0 + 1_j;
std::cout << ei(z) << "\n";

Output:

1.76463 + 2.38777j

References