# ei

One-argument exponential integral function

## Syntax

``ei(x)``

## Description

example

````ei(x)` returns the one-argument exponential integral defined as$\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 exponential integrals for numeric inputs. 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 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 10-digit accuracy.

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

### Branch Cut at Negative Real Axis

The negative real axis is a branch cut. The exponential integral has a jump of height 2 π i when crossing this cut. Compute the exponential integrals at `-1`, above `-1`, and below `-1` to demonstrate this.

`[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 Exponential Integral

Compute the first, second, and third derivatives of a 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 Exponential Integral

Compute the limits of a 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

collapse all

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

## Tips

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

## Algorithms

The relation between `ei` and `expint` is

`ei(x) = -expint(1,-x) + (ln(x)-ln(1/x))/2 - ln(-x)`

Both functions `ei(x)` and `expint(1,x)` have a logarithmic singularity at the origin and a branch cut along the negative real axis. The `ei` function is not continuous when approached from above or below this branch cut.

## 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.

## Version History

Introduced in R2013a