A small bug on simplify with double powers.

44 views
Skip to first unread message

Miguel González Duque

unread,
Dec 20, 2017, 9:05:57 PM12/20/17
to sympy
Doing some calculations, I came to the following sympy expression: `x**10*y**5*(x**8)**(-1.25)`, I tried to simplify it (because, if one performs the multiplication manually, it is evident that x**10*y**5*(x**8)**(-1.25) = y**5. I realized that this happens even with x alone: if one considers the expression `(x**8)**(0.25)` (or even `(x**8)**(Rational(1,4))`), it doesn't simplify any further. Is there a way of simplifying these expressions?

Thanks.


Chris Smith

unread,
Dec 23, 2017, 2:15:37 PM12/23/17
to sympy
SymPy should not to do anything automatically that is not generally true. In this case, making x nonnegative is sufficient to get it to do what you want.

>>> var('x', nonnegative=True)
x
>>> (x**8)**(Rational(1,4))
x**2

If you want that done without creating a new 'x' use powdenest with force=True:

>>> (x**8)**(Rational(1,4))
(x**8)**(1/4)
>>> powdenest(_, force=True)
x**2
Reply all
Reply to author
Forward
0 new messages