algorithm of ei (9.2.96)

Xiaoqing Liu

I would like to calculate Ei (Exponential Integral) function with complex argument in my programming. Neither IMSL subroutine nor Numerical Recipes subroutines can do the job. It seems only Maple can do the job. But I don’t know the algorithm of calculating Ei in Maple.

Dave Hare (20.2.96)

Maple calculates the n’th exponential integral (which it denotes Ei(n,x)) using one of several algorithms, depending on the value of n, the location of x in the complex plane and the precision required (the value of Digits).

The algorithms used (listed in the order in which they are considered) are:

   - asymptotic series (A&S 5.1.51) 
   - Taylor series expansion centred at Re(x) 
   - continued fraction expansion (A&S 5.1.22) 
   - Taylor series expansion centred at 0 (A&S 5.1.11/12)

("A&S" = Abramowitz and Stegun). The Cauchy Principal Value function, usually denoted by Ei, and obtained in Maple as Ei(x), is defined (in Maple) only for real arguments x.

For more detailed information, you can look at the code directly, by readlib’ing and then print’ing any or all of the following routines:


Peter Montgomery (21.2.96)

You can list many Maple procedures (though not their comments) using interface(verboseproc = 2). Under Maple version 3, the work is done in evalf/Ei/complex. This program prints that procedure, which I’ll let you decipher. The code is copyrighted.

interface(verboseproc = 2); 
readlib(Ei);            # See Ei procedure 
printlevel := 25; 
Ei(5, 10 + 8.9*I);      # Calls evalf/Ei/complex 
\subsubsection{\href{}{Robert Israel   }(21.2.96)} 
Well, since most of Maple's code is available, you can 
find out for yourself. The following should do it: 
> interface(verboseproc=2); 
> readlib(`evalf/Ei/complex`);

(and then look at the various procedures that this one calls). Good luck in trying to sort it out (there are no comments).