You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Computes the exponential integral function ``\\operatorname{Ei}(x) = \\int_{-\\infty}^x \\frac{e^t}{t} dt``,
443
+
which is equivalent to ``-\\Re[E_1(-x)]`` where ``E_1`` is the `expint` function.
444
+
"""
445
+
expinti(x::Real) = x ≤0?-expint(-x) :-real(expint(complex(-x)))
446
+
447
+
# inline the Taylor expansion of Ei for a given order n, in double precision
448
+
macroEi_taylor64(z, n::Integer)
449
+
c =.-E₁_taylor_coefficients(Float64, n) .* (-1).^(0:n)
450
+
zesc =esc(z)
451
+
taylor = :(@evalpoly$zesc)
452
+
append!(taylor.args, c)
453
+
:( $taylor +log($zesc) )
454
+
end
455
+
456
+
# optimized double-precision version
457
+
functionexpinti(x::Float64)
458
+
x ≤0&&return-expint(-x)
459
+
460
+
if x >2.15
461
+
# minimax rational approximants:
462
+
x <4&&return@evalpoly(x,-2.43791466332154621,3.09402100064798205,9.35202477109609955,0.152659977028953397,0.0157273683896079142,0.0345566671015011426,-0.000421531433157416203) /
0 commit comments