Accelerating the pace of engineering and science

# ei

One-argument exponential integral function

## Description

example

ei(x) returns the one-argument exponential integral defined as follows:

$\text{ei}\left(x\right)=\underset{-\text{ }\infty }{\overset{x}{\int }}\frac{{e}^{t}}{t}\text{\hspace{0.17em}}dt$

## Examples

### Exponential Integral for Floating-Point and Symbolic Numbers

Compute the exponential integrals for these numbers. Because these numbers are not symbolic objects, you get floating-point results.

`s = [ei(-2), ei(-1/2), ei(1), ei(sqrt(2))]`
```s =
-0.0489   -0.5598    1.8951    3.0485```

Compute the exponential integrals for the same numbers converted to symbolic objects. For most symbolic (exact) numbers, ei returns unresolved symbolic calls.

`s = [ei(sym(-2)), ei(sym(-1/2)), ei(sym(1)), ei(sqrt(sym(2)))]`
```s =
[ ei(-2), ei(-1/2), ei(1), ei(2^(1/2))]```

Use vpa to approximate this result with the 10 digits accuracy:

`vpa(s, 10)`
```ans =
[ -0.04890051071, -0.5597735948, 1.895117816, 3.048462479]```

### Branch Cut at the Negative Real Axis

Compute the exponential integrals for these numbers. The negative real axis is a branch cut. The exponential integral has a jump of height 2 π i when crossing this cut:

`[ei(-1), ei(-1 + 10^(-10)*i), ei(-1 - 10^(-10)*i)]`
```ans =
-0.2194 + 0.0000i  -0.2194 + 3.1416i  -0.2194 - 3.1416i```

### Derivatives of the Exponential Integral

Compute the first, second, and third derivatives of the one-argument exponential integral:

```syms x
diff(ei(x), x)
diff(ei(x), x, 2)
diff(ei(x), x, 3)```
```ans =
exp(x)/x

ans =
exp(x)/x - exp(x)/x^2

ans =
exp(x)/x - (2*exp(x))/x^2 + (2*exp(x))/x^3```

### Limits of the Exponential Integral

Compute the limits of this one-argument exponential integral:

```syms x
limit(ei(2*x^2/(1+x)), x, -Inf)
limit(ei(2*x^2/(1+x)), x, 0)
limit(ei(2*x^2/(1+x)), x, Inf)```
```ans =
0

ans =
-Inf

ans =
Inf```

## Input Arguments

expand all

### x — Inputfloating-point number | symbolic number | symbolic variable | symbolic expression | symbolic function | symbolic vector | symbolic matrix

Input specified as a floating-point or symbolic number, variable, expression, function, vector, or matrix.

expand all

### Tips

• The one-argument exponential integral is singular at x = 0. The toolbox uses this special value: ei(0) = -Inf.

## References

[1] Gautschi, W., and W. F. Gahill "Exponential Integral and Related Functions." Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.