### 7.3.5 Exponential integral function

The exponential integral Ei is defined for non-zero real numbers x by

Ei(x)=

∫

x
−∞

et
t

d t.

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

Since ex/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 the Euler-Mascheroni constant.

The Ei command takes one or two arguments.

With one argument, the Ei command computes the exponential integral.

- Ei takes z, a complex number.
- Ei(z) returns the value of the exponential integral at z.

#### Examples

Ei(1.0)

1.89511781636 |  |  |  |  |  |  |  |  |  |

Ei(-1.0)

−0.219383934396 |  |  |  |  |  |  |  |  |  |

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

2.11450175075 |  |  |  |  |  |  |  |  |  |

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

2.11450175075 |  |  |  |  |  |  |  |  |  |

The following input approximates the Euler’s constant γ:

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

0.577215664902 |  |  |  |  |  |  |  |  |  |

Another type of exponential integral is

E1(x)=

∫

+∞
x

e−t
t

d t =

∫

+∞
1

e−tx
t

d t

which satisfies E1(x)=−Ei(−x). This can be generalized to

En(x)=

∫

+∞
1

e−ntx
t

d t.

These functions satisfy

E1(x) | =−Ei(x), |  |  |  |  |  |  |  |  |
E2(x) | =e−x+xEi(−x)=e−x−x E1(x), |  |  |  |  |  |  |  |  |

and, for n ≥ 2,

En(x)=

e−x−x En−1(x)
n−1

.

With two arguments, the Ei command computes the above version of the exponential integral.

- Ei takes two arguments:
  - z, a complex number.
  - n, a positive integer.
- Ei(z,n) returns the value of En(z).

#### Examples

Ei(1.0,1)

0.219383934396 |  |  |  |  |  |  |  |  |  |

Ei(3.0,2)

0.0106419250853 |  |  |  |  |  |  |  |  |  |