Skip to main content

expn

Function expn 

Source
pub fn expn(n: u32, x: f64) -> f64
Expand description

Generalized exponential integral $E_n(x)$

Corresponds to scipy.special.expn

§Definition

For integer $n \geq 0$ and real $x \geq 0$ the generalized exponential integral is defined as:

$$ E_n(x) = x^{n-1} \int_x^\infty \frac{e^{-t}}{t^n} \dd t $$

§Accuracy

The routine employs either a power series, a continued fraction, or an asymptotic formula depending on the relative values of n and x.

                     Relative error:
arithmetic   domain     # trials      peak         rms
   IEEE      0, 30       10000       1.6e-15     3.6e-16

for uniformly distributed integer $1 \le n \le 50$. For $50 < n \le 200$ (the asymptotic expansion) and $0 < x < 30$, the peak and rms relative errors are 4.1e-15 and 9.0e-16.

§See also

  • exp1: Special case of $E_n$ for $n = 1$
  • expi: Related to $E_n$ when $n = 1$