Hello, On Fri, Apr 30, 2010 at 09:06:03AM +0200, Richard B. Kreckel wrote:
Trying to argue that sqrt(-1) is ill-defined is going to rise an eyebrow or two, I guess. ;-)
I agree. Let's put it another way: unfortunately GiNaC gives no way to figure out if sqrt(-1) really stands for sqrt(-1 + I 0) or sqrt(-1 - I 0), so we don't really know the if it's +I or -I. Does this explanation make any sense?
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?
Should we stop evaluating x/x to 1, too? It gives incorrect result if x is zero. Best regards, Alexei