# fractional power to negative number

bool( (-2)^(1/3) == - 2^(1/3) ) returns False

Is there any way in sage that will say they are same?

fractional power to negative number

bool( (-2)^(1/3) == - 2^(1/3) ) returns False

Is there any way in sage that will say they are same?

add a comment

1

It depends what you mean by "same": There are 3 complex cube roots of -1, and when you input something like (-1)^(1/3), sage chooses one of them:

```
sage: CC((-1)^(1/3))
0.500000000000000 + 0.866025403784439*I
sage: CC(-1^(1/3))
-1.00000000000000
sage: var('t')
t
sage: p = (t^(3) + 1)
sage: p.roots()
[(1/2*I*(-1)^(1/3)*sqrt(3) - 1/2*(-1)^(1/3), 1), (-1/2*I*(-1)^(1/3)*sqrt(3) - 1/2*(-1)^(1/3), 1), ((-1)^(1/3), 1)]
sage: p.roots(ring=CC)
[(-1.00000000000000, 1), (0.500000000000000 - 0.866025403784439*I, 1), (0.500000000000000 + 0.866025403784439*I, 1)]
sage: p.roots(ring=RR)
[(-1.00000000000000, 1)]
```

So this is probably the reason your comparison returns `False`

:

```
sage: CC((-2)^(1/3))
0.629960524947437 + 1.09112363597172*I
sage: CC(-2^(1/3))
-1.25992104989487
```

Of course if you choose the *Real* cube root of -1, then your comparison should return `True`

. How you decide to work with this probably depends on the problem you have in mind -- can you update with some more details?

For example, could you take absolute values before taking fractional powers, and then check whether or not the signs agree?

```
sage: m = 2
sage: n = -2
sage: (abs(m))^(1/3) == (abs(n))^(1/3) and -1*sgn(m) == sgn(n)
```

Thanks, I just want to compare two numbers where they can be of the above type. And for sure I want to consider the real roots. Like CC( ), is there any function like RR( ). Seems not. Suppose I have number 1 and number2, can I use something like bool( RR(number 1) == RR(number 2) )

0

You can also try to play around with simplify_trig and simplify_radical:

```
sage: eq = (-2)^(1/3) == - 2^(1/3)
sage: bool(eq.simplify_radical())
True
sage: eq = cos(x)*(tan(x))^(1/3) == (sin(x)*(cos(x))^2)^(1/3)
sage: print eq.simplify_trig().simplify_radical()
sage: bool(eq.simplify_trig().simplify_radical())
True
```

Asked: **
2010-12-16 06:14:52 -0600
**

Seen: **715 times**

Last updated: **Dec 16 '10**

Round trip through Mathematica's FullSimplify

Power of a polynomial mod (n, X^r - 1)

Numeric evaluation of exp(x^2) in a sum TypeError

Solve an expression with fractional exponents

"Sage for power users" by W. Stein (PDF without error?)

why lim((x^2-x+1)^(1/2)+x,x=-oo,dir='below') is red error

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.