s13aa returns the value of the exponential integral E1x.


public static double s13aa(
	double x,
	out int ifail
Visual Basic
Public Shared Function s13aa ( _
	x As Double, _
	<OutAttribute> ByRef ifail As Integer _
) As Double
Visual C++
static double s13aa(
	double x, 
	[OutAttribute] int% ifail
static member s13aa : 
        x : float * 
        ifail : int byref -> float 


Type: System..::..Double
On entry: the argument x of the function.
Constraint: -xhix<0.0 or x>0.0.
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Return Value

s13aa returns the value of the exponential integral E1x.


s13aa calculates an approximate value for
using Chebyshev expansions, where x is real. For x<0, the real part of the principal value of the integral is taken. The value E10 is infinite, and so, when x=0, s13aa exits with an error and returns the largest representable machine number.
For 0<x4,
where t=12x-1.
For x>4,
where t=-1.0+14.5x+3.25=11.25-x3.25+x.
In both cases, -1t+1.
For x<0, the approximation is based on expansions proposed by Cody and Thatcher Jr. (1969). Precautions are taken to maintain good relative accuracy in the vicinity of x0-0.372507, which corresponds to a simple zero of Ei(-x).
s13aa guards against producing underflows and overflows by using the parameter xhi; see the Users' Note for your implementation for the value of xhi. To guard against overflow, if x<-xhi the method terminates and returns the negative of the largest representable machine number. To guard against underflow, if x>xhi the result is set directly to zero.


Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Cody W J and Thatcher Jr. H C (1969) Rational Chebyshev approximations for the exponential integral Eix Math. Comp. 23 289–303

Error Indicators and Warnings

Errors or warnings detected by the method:
On entry, x=0.0 and the function is infinite. The result returned is the largest representable machine number.
The evaluation has been abandoned due to the likelihood of overflow. The argument x<-xhi, and the result is returned as the negative of the largest representable machine number.
An error occured, see message report.


Unless stated otherwise, it is assumed that x>0.
If δ and ε are the relative errors in argument and result respectively, then in principle,
so the relative error in the argument is amplified in the result by at least a factor e-x/E1x. The equality should hold if δ is greater than the machine precision (δ due to data errors etc.) but if δ is simply a result of round-off in the machine representation, it is possible that an extra figure may be lost in internal calculation and round-off.
The behaviour of this amplification factor is shown in the following graph:
Figure S13AAF1
Figure 1
It should be noted that, for absolutely small x, the amplification factor tends to zero and eventually the error in the result will be limited by machine precision.
For absolutely large x,
the absolute error in the argument.
For x<0, empirical tests have shown that the maximum relative error is a loss of approximately 1 decimal place.

Parallelism and Performance


Further Comments



The following program reads values of the argument x from a file, evaluates the function at each value of x and prints the results.

Example program (C#): s13aae.cs

Example program data: s13aae.d

Example program results: s13aae.r

See Also