s Chapter Contents
s Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_exp_integral (s13aac)

## 1  Purpose

nag_exp_integral (s13aac) returns the value of the exponential integral ${E}_{1}\left(x\right)$.

## 2  Specification

 #include #include
 double nag_exp_integral (double x, NagError *fail)

## 3  Description

nag_exp_integral (s13aac) evaluates
 $E 1 x = ∫ x ∞ e -u u du x > 0 .$
The approximation is based on several Chebyshev expansions.

## 4  References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications

## 5  Arguments

1:     xdoubleInput
On entry: the argument $x$ of the function.
Constraint: ${\mathbf{x}}>0.0$.
2:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_REAL_ARG_LE
On entry, x must not be less than or equal to 0.0: ${\mathbf{x}}=〈\mathit{\text{value}}〉$.
The function is not defined for this value and the result returned is zero.

## 7  Accuracy

If $\delta$ and $\epsilon$ are the relative errors in argument and result respectively, then in principle, $\left|\epsilon \right|\simeq \left|\left({e}^{-x}/{E}_{1}\left(x\right)\right)\delta \right|$, so the relative error in the argument is amplified in the result by at least a factor ${e}^{-x}/{E}_{1}\left(x\right)$. The equality should hold if $\delta$ is greater than the machine precision ($\delta$ due to data errors etc.), but if $\delta$ 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.
It should be noted that, for small $x$, the amplification factor tends to zero and eventually the error in the result will be limited by machine precision.
For large $x$, $\epsilon \sim x\delta =\Delta$, the absolute error in the argument.
To guard against producing underflows, if $x$ is larger than a machine-dependent value ${x}_{\mathrm{hi}}$, the result is set directly to zero.

None.

## 9  Example

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

### 9.1  Program Text

Program Text (s13aace.c)

### 9.2  Program Data

Program Data (s13aace.d)

### 9.3  Program Results

Program Results (s13aace.r)