9 views

### Francois Maltey

Sep 16, 2009, 4:04:01 PM9/16/09
Hi,

I play with sage, exp, sin, cos, sinh, and co...

var("a,b,c")
exp(a)^2 # returns exp(2a) is right
exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get -1=1
exp(a)^b # returns exp(a*b) is wrong

But silly examples about power and asin (sin (x)) seems right.

I find that sage (but it's perhaps maxima) is not enough fine with
mathematics.

Theses sage rules are right only for positive real numbers, and in
mathematics we quickly get complex numbers.

### kcrisman

Sep 16, 2009, 4:18:17 PM9/16/09
to sage-support

On Sep 16, 4:04 pm, Francois Maltey <fmal...@nerim.fr> wrote:
> Hi,
>
> I play with sage, exp, sin, cos, sinh, and co...
>
> var("a,b,c")
> exp(a)^2 # returns exp(2a) is right
> exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get -1=1
> exp(a)^b # returns exp(a*b) is wrong

Well, there is a unique exp, but not a unique square root (or in
general other power, since they may be defined using log). Are you
suggesting that exp(a)^(1/2) always return exp(a)^(1/2), or that it
return something about branches? I suppose that is possible. For
instance,
sage: (-1)^(1/3)
(-1)^(1/3)

Here I believe the simplification is done by Pynac (Ginac), and I'm

But in general Sage does things over complex numbers fairly
consistently. We constantly get complaints about
sage: (-1.)^(1/3)
0.500000000000000 + 0.866025403784439*I

Hope this helps,
- kcrisman

### Francois Maltey

Sep 17, 2009, 5:14:26 AM9/17/09
kcrisman wrote :

> On Sep 16, 4:04 pm, Francois Maltey <fmal...@nerim.fr> wrote:
>
>> I play with sage, exp, sin, cos, sinh, and co...
>>
>> var("a,b,c")
>> exp(a)^2 # returns exp(2a) is right
>> exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get -1=1
>> exp(a)^b # returns exp(a*b) is wrong
>>
>
> Well, there is a unique exp, but not a unique square root (or in
> general other power, since they may be defined using log).
But is XXX^(1/2) are unique and not multivariate : sage remains
(a^2)^(1/2) and (a^b)^c.
Neither automatic convert (a^2)^(1/2) to a nor (a^b)^c to a^(b*c)

I used both Axiom with only multivariate functions asin sin a = a and
(a^2)^(1/2)=a
and Maple/mupad with no multivariate functions (but bugs).

Mathematics for undergraduate are finest by this way.

> Are you suggesting that exp(a)^(1/2) always return exp(a)^(1/2)

It's what I prefer

> , or that it return something about branches?

In my mind log z = ln |z| + i arctan2 (Re(z),Im(z)) where arctan2 (x,y)
in ]-pi,pi].
This logarithm is MONO-variate, but we can't write ln (u v) = ln u + ln
v in complex domain.

> sage: (-1)^(1/3)
> (-1)^(1/3)
>
It's right, arctan(-1,0)=pi, e^(i*pi/3) = 0.5 + 0.866... I

> But in general Sage does things over complex numbers fairly
> consistently. We constantly get complaints about
> sage: (-1.)^(1/3)
> 0.500000000000000 + 0.866025403784439*I
>

All right, so (exp (a))^b is a singular exception... And I prefer a
system without such exception.

F.

### kcrisman

Sep 17, 2009, 9:22:35 AM9/17/09
to sage-support
Dear Francois,

It appears that either 1) the Pynac simplification has a bug or 2)
there is a very good reason for this behavior. I would encourage you
development list. I am quite certain that the people who have
implemented symbolics in Sage are very, very aware of such issues, as
you will see if you browse threads about such things on this list and
on sage-devel.

- kcrisman

### Burcin Erocal

Sep 17, 2009, 9:55:11 AM9/17/09
On Thu, 17 Sep 2009 06:22:35 -0700 (PDT)
kcrisman <kcri...@gmail.com> wrote:

> On Sep 17, 5:14 am, Francois Maltey <fmal...@nerim.fr> wrote:
> > kcrisman wrote :> On Sep 16, 4:04 pm, Francois Maltey
> > <fmal...@nerim.fr> wrote:
> >
> > >> I play with sage, exp, sin, cos, sinh, and co...
> >
> > >> var("a,b,c")
> > >> exp(a)^2 # returns exp(2a) is right
> > >> exp(a)^(1/2) # returns exp (a/2) is wrong, with a=2*i*pi we get
> > >> -1=1 exp(a)^b # returns exp(a*b) is wrong

<snip>

> It appears that either 1) the Pynac simplification has a bug or 2)
> there is a very good reason for this behavior. I would encourage you

This is a bug in pynac. I wrote the power method for exp during the
rush for the symbolics switch.

Here is a ticket for this issue:

http://trac.sagemath.org/sage_trac/ticket/6948

It will be fixed in the next Sage release.

Thanks a lot for reporting this.

Cheers,
Burcin