
expint gives unexpected result
Posted:
Aug 14, 2014 6:17 PM


I compare expint() with numerical calculation.
The real part matches reasonably well but the imaginary part has a 2pi jump *after* zero.
At least for real values I would not expect this.
Furthermore, [1] states that Ei is ambiguous but E1 is not.
Where does this discrepancy come from and how to fix it?
Thanks Peter
PS: Here is a small piece of code that compares the function with real arguments:
Ts = 1e4; t = [ 10:Ts:Ts Ts:Ts:1 ];t=t(:);
figure, plot(t, real([Ts*cumtrapz(exp(t)./t) , (expint(t(1))expint(t))])); legend('cumtrapz','E_1');
figure, plot(t, imag([Ts*cumtrapz(exp(t)./t) , (expint(t(1))expint(t))])); legend('cumtrapz','E_1');
[1] http://en.wikipedia.org/wiki/Exponential_integral

