[GiNaC-list] conjugates of power objects

Burcin Erocal burcin at erocal.org
Mon May 3 17:50:44 CEST 2010


Hi,

Sorry for the slow response. I'm on a research visit and I need to spend
my time on real work these days. :)

On Fri, 30 Apr 2010 09:06:03 +0200
"Richard B. Kreckel" <kreckel at ginac.de> wrote:

> Alexei Sheplyakov wrote:
> > On Tue, Apr 27, 2010 at 03:16:00AM +0200, Burcin Erocal wrote:
> >>> conjugate(sqrt(-3));
> >> sqrt(-3)
> > 
> > You are trying to compute the value of the function on the branch
> > cut (which is ill defined), so you get the nonsense result.
> 
> Trying to argue that sqrt(-1) is ill-defined is going to rise an
> eyebrow or two, I guess.  ;-)
> 
> Some background: GiNaC has been following the convention of counter 
> clockwise continuity (CCC) ever since. Functions are continuous as
> the cut is approached coming around the finite endpoint of the cut in
> a counter clockwise direction. GiNaC has inherited this from CLN,
> which has followed Steele's CLTL2 in this respect. Later, the same
> convention was adopted by C99 and C++. Most CAS follow it, too. (I
> haven't checked yet, but I suppose this convention is also adopted by
> the LIA-3 standard.)
> 
> A popular extension due to this is the one advocated by W. Kahan and 
> standardized in IEEE754, where a distinction is made betweenn +0 and
> -0. This is not a panacea because it opens the problem that one has
> to agree on what an unqualified 0 is supposed to be. CLN/GiNaC (and
> all CASs I am aware of) has no signed zero.
> 
> I heartily recommend the article "Function evaluation on branch cuts"
> by Albert Rich and David Jeffrey. It is a short but very inspiring
> read!

Wow! Thanks for this explanation. This should be put in the
documentation somewhere.

> Alas, I think that automatic evaluation of conjugation is too
> aggressive in GiNaC. It just keeps giving incorrect results on branch
> cuts. Here are some examples, using ginsh:
> 
>  > conjugate(sqrt(x));
> sqrt(conjugate(x))
>  > conjugate(sqrt(x))-sqrt(conjugate(x));
> 0
>  > conjugate(sqrt(-1))-sqrt(conjugate(-1));
> -2*I
>  > conjugate(log(x));
> log(conjugate(x))
>  > conjugate(log(x))-log(conjugate(x));
> 0
>  > conjugate(log(-1))-log(conjugate(-1));
> -(2*I)*Pi
> 
> I suggest to disable automatic evaluateion of conjugation where these 
> kinds of problems can appear.
>
> Opinions?

I agree that the automatic evaluation should be disabled for most
cases. I don't immediately see a good definition for these cases
though, but then I am not knowledgeable in this area at all.

Maple seems to convert sqrt(-3) to sqrt(3)*I automatically:

> sqrt(-3);
                                     1/2
                                    3    I

Perhaps adding this automatic evaluation rule for power objects would
simplify the conditions we need to consider for automatic evaluation of
conjugation.

Comments? 


Thank you.

Burcin


More information about the GiNaC-list mailing list