Main Content

expint

Exponential integral function

Description

example

expint(x)returns the one-argument exponential integral function defined as

expint ( x ) = x e t t d t .

example

expint(n,x)returns the two-argument exponential integral function defined as

expint ( n , x ) = 1 e x t t n d t .

Examples

One-Argument Exponential Integral for Floating-Point and Symbolic Numbers

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

s = [expint(1/3), expint(1), expint(-2)]
s = 0.8289 + 0.0000i 0.2194 + 0.0000i -4.9542 - 3.1416i

Compute the exponential integrals for the same numbers converted to symbolic objects. For positive valuesx,expint(x)returns-ei(-x). For negative valuesx, it returns-pi*i - ei(-x).

s = [expint(sym(1)/3), expint(sym(1)), expint(sym(-2))]
s = [ -ei(-1/3), -ei(-1), - ei(2) - pi*1i]

Usevpato approximate this result with 10-digit accuracy.

vpa (s, 10)
ans = [ 0.8288877453, 0.2193839344, - 4.954234356 - 3.141592654i]

Two-Argument Exponential Integral for Floating-Point and Symbolic Numbers

When computing two-argument exponential integrals, convert the numbers to symbolic objects.

s = [expint(2, sym(1)/3), expint(sym(1), Inf), expint(-1, sym(-2))]
s = [ expint(2, 1/3), 0, -exp(2)/4]

Usevpato approximate this result with 25-digit accuracy.

vpa(s, 25)
ans = [ 0.4402353954575937050522018, 0, -1.847264024732662556807607]

Two-Argument Exponential Integral with Nonpositive First Argument

Compute two-argument exponential integrals. Ifnis a nonpositive integer, thenexpint(n, x)returns an explicit expression in the formexp(-x)*p(1/x), wherepis a polynomial of degree1 - n.

syms x expint(0, x) expint(-1, x) expint(-2, x)
ans = exp(-x)/x ans = exp(-x)*(1/x + 1/x^2) ans = exp(-x)*(1/x + 2/x^2 + 2/x^3)

Derivatives of Exponential Integral

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

syms x diff(expint(x), x) diff(expint(x), x, 2) diff(expint(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

Compute the first derivatives of a two-argument exponential integral.

syms n x diff(expint(n, x), x) diff(expint(n, x), n)
ans = -expint(n - 1, x) ans = - hypergeom([1 - n, 1 - n], [2 - n, 2 - n],... -x)/(n - 1)^2 - (x^(n - 1)*pi*(psi(n) - ... log(x) + pi*cot(pi*n)))/(sin(pi*n)*gamma(n))

Input Arguments

collapse all

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

Input specified as a symbolic number, variable, expression, function, vector, or matrix. When you compute the two-argument exponential integral function, at least one argument must be a scalar.

Tips

  • Callingexpintfor numbers that are not symbolic objects invokes the MATLAB®expintfunction. This function accepts one argument only. To compute the two-argument exponential integral, usesymto convert the numbers to symbolic objects, and then callexpintfor those symbolic objects. You can approximate the results with floating-point numbers usingvpa.

  • The following values of the exponential integral differ from those returned by the MATLABexpintfunction:expint(sym(Inf)) = 0,expint(-sym(Inf)) = -Inf,expint(sym(NaN)) = NaN.

  • For positive realx,expint(x) = -ei(-x). For negative realx,expint(x) = -pi*i - ei(-x).

  • If one input argument is a scalar and the other argument is a vector or a matrix, thenexpint(n,x)标量扩展成一个向量或矩阵same size as the other argument with all elements equal to that scalar.

Algorithms

The relation betweenexpintandeiis

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

Both functionsei (x)andexpint(1,x)have a logarithmic singularity at the origin and a branch cut along the negative real axis. Theeifunction is not continuous when approached from above or below this branch cut.

Theexpintfunction is related to the upper incomplete gamma functionigammaas

expint(n,x) = (x^(n-1))*igamma(1-n,x)

Version History

Introduced in R2013a

See Also

||