Test suite failures with cvs version?



Hello Ray,

I have finish my calculation to get the complex phase factors for the function
expintegral_ei. I have used the following relationsship to get the results (see
the log function on functions.wolfram.com for a reference):

(a) 1/2*(log(z)-log(1/z)) = log(z)           for z not in [-inf,0]
(b) 1/2*(log(z)-log(1/z)) = log(z) - %i*%pi  for z     in [-inf,0]

and

(c) log(z)-log(-z) =  %pi*%i  for imagpart(z)>0 or imagpart(z) = 0 and z < 0
(d) log(z)-log(-z) = -%pi*%i  for imagpart(z)<0 or imagpart(z) = 0 and z > 0

Case 1: z is a negative real value
With (b) and (c) we get: log(z) - %i*%pi - log(-z) = 0

Case 2: z not in [-inf,0]

Case 2a: imagpart(z) > 0
With (a) and (c) we get log(z) - log(-z) = %pi*%i

Case 2b: imagpart(z) < 0
With (a) and (d) we get log(z) - log(-z) = -%pi*%i

Case 2c: z is a positive real value
With (a) and (d) we get log(z) - log(-z) -%pi*%i

The phase factors here calculated are exactly the phase factors used in the last
proposed algorithm.

I have not used Maxima to get these results. I am not sure what Maxima is doing
with complex log functions.

Dieter Kaiser

-----Urspr?ngliche Nachricht-----
Von: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] Im
Auftrag von Dieter Kaiser
Gesendet: Montag, 27. Oktober 2008 22:44
An: raymond.toy at ericsson.com
Cc: maxima at math.utexas.edu
Betreff: Re: [Maxima] Test suite failures with cvs version?

Sorry, now I see the problem. 

I have again tested different real and complex values for the function
expintegral_e(1,z). It seems all to be correct. The values can be verified with
result of functions.wolfram.com and the conjugate values are correct.

(%i9) expintegral_e(1,1.0);
(%o9) 0.21938393439552
(%i10) expintegral_e(1,-1.0);
(%o10) -3.141592653589793*%i-1.895117816355937
(%i11) expintegral_e(1,1.0+%i);
(%o11) 2.8162445198177954E-4-0.17932453503936*%i
(%i12) expintegral_e(1,1.0-%i);
(%o12) 0.17932453503936*%i+2.8162445198177954E-4
(%i13) expintegral_e(1,-1.0+%i);
(%o13) -0.75382280207927*%i-1.764625985563854
(%i14) expintegral_e(1,-1.0-%i);
(%o14) 0.75382280207927*%i-1.764625985563854

But, I am now look more carefully at the mathematic behind the phase factors and
the originally definitions of the function.

I try to complete the work this evening.

Dieter Kaiser

-----Urspr?ngliche Nachricht-----
Von: raymond.toy at ericsson.com [mailto:raymond.toy at ericsson.com] 
Gesendet: Montag, 27. Oktober 2008 22:03
An: Dieter Kaiser
Cc: maxima at math.utexas.edu
Betreff: Re: [Maxima] Test suite failures with cvs version?

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


_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima