The exponential integral function: Ei

### 5.9.5 The exponential integral function: Ei

The Ei command takes as argument a complex number.
Ei returns the value of the exponential integral at the argument.

For non-zero real numbers x,

Ei(x) = | ∫ |
x
t=−∞
exp(t)
t
| dt.

For x>0, this integral is improper but the principal value exists. This function satisfies Ei(0) = −∞, Ei(−∞) = 0.

Since

exp(x)
x
| = |
1
x
| + 1 + |
x
2!
| + |
x2
3!
| + …,

the Ei function can be extended to ℂ − {0} (with a branch cut on the positive real axis) by

Ei(z) = ln(z) + γ + x + |
x2
2· 2!
| + |
x3
3· 3!
| + …

where γ = 0.57721566490… is Euler’s constant.
Input:

Ei(1.0)

Output:

1.89511781636

Input:

Ei(-1.0)

Output:

-0.219383934396

Input:

Ei(1.)-Ei(-1.)

Output:

2.11450175075

Input:

int((exp(x)-1)/x,x=-1..1.)

Output:

2.11450175075

The input
Input:

evalf(Ei(-1)-sum((-1)^n/n/n!,n=1..100))

approximates Euler’s constant
Output:

0.577215664902

The Ei command can also take two arguments, where the second argument is a positive integer indicating other types of exponential integrals; Ei(x,n) = En(x). Specifically:
Ei(a,1) = -Ei(-a)
Ei(a,2) = exp(-a) + a*Ei(-a) = exp(-a) - a*Ei (a, 1) and for n ≥ 2, Ei(a,n)=(exp(-a) - a*Ei(a,n-1))/(n-1)