Dieter Kaiser wrote:
> Hello Ray,
>
> It seems to me that I am a bit tired. Again I was too fast. I did the check for
> conjugate values with different algorithm and not with conjugate values.
>
> Now I arrived at this routine:
>
> (defun expintegral-ei (z)
> (+
> (- (expintegral-e 1 (- z)))
> ; (- (* 0.5 (- (log z) (log (/ 1 z)))) (log (- z)))
I think we need to decide what the value of the above expression is.
For z = -r (r real, r > 0), I have
1/2*(log(z)-log(1/z)) - log(-z)
= 1/2*(log(r)+%i*%pi-log(1/r)-%i*%pi) - log(r)
= 1/2*(2*log(r)) - log(r)
= 0
For all other z = r*exp(%i*theta), maxima says:
1/2*(log(r*exp(%i*theta))-log(1/(r*exp(%i*theta)))-log(-r*exp(%i*theta))$
rectform(%);
-%i*%pi
This doesn't match what your code does because you sometimes use %i*%pi
or -%i*%pi.
Maybe the real issue is that expintegral_e is computing the wrong value
for negative z?
What definition are you using for Ei and En?
Ray