File Exchange

## Generalised Exponential Integral

version 1.0.0.0 (8.07 KB) by Stephen Bocquet

### Stephen Bocquet (view profile)

Computes the generalised exponential integral E_a(x) for positive real parameter a and argument x

Updated 27 Aug 2015

This function computes the generalized exponential integral E_a(x) for positive real parameter a and argument x. Call it as y=genexpint(a,x) or y=genexpint(a,x,expscale). If the optional third input argument expscale is set to true, the output is exp(x)*E_a(x), which is finite for large x where exp(x) overflows and E_a(x) underflows.
The code uses a MATLAB translation of the FORTRAN function DGAMIC from the SLATEC library. DGAMIC computes the upper incomplete gamma function for negative real parameter, using the algorithm of Gautschi (ACM Trans. Math. Soft. 5(4) pp 466-481, 1979). For x>1, the Legendre continued fraction is used to calculate the function
G(1-a)=exp(x)*E_a(x). For x<=1, the generalized exponential integral is obtained from the relationship
E_a(x)=x^(a-1)*Gamma(1-a,x). (Note that the incomplete gamma function parameter 1-a can be negative, so the MATLAB function gammainc cannot be used here as it is limited to positive real parameters.)

### Comments and Ratings (2)

Fernando S. Silva

Benjamin Moll

### Benjamin Moll (view profile)

This is very nice. But is it possible to extend this to negative x? In particular, I need to compute the integral int_1^z Exp[-y^b/b] dy where b<0 and z>1. Mathematica tells me this equals an expression involving ExpIntegralE[(-1 + b)/b, z^b/b]. So since b<0, x=z^b/b<0 as well. Thanks for your help! Ben

##### MATLAB Release Compatibility
Created with R2015a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux
##### Acknowledgements

Inspired by: benbarrowes/f2matlab