how to combine exponents? (x**a)**b => x**(a*b)?
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 How To Combine Exponents? (X**A)**B =≫ X**(A*B)?
00:47 Answer 1 Score 0
00:55 Accepted Answer Score 7
01:34 Answer 3 Score 2
01:38 Thank you
--
Full question
https://stackoverflow.com/questions/3274...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #simplify #sympy #exponent
#avk47
    Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 How To Combine Exponents? (X**A)**B =≫ X**(A*B)?
00:47 Answer 1 Score 0
00:55 Accepted Answer Score 7
01:34 Answer 3 Score 2
01:38 Thank you
--
Full question
https://stackoverflow.com/questions/3274...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #simplify #sympy #exponent
#avk47
ACCEPTED ANSWER
Score 7
(xm)n = xmn is true only if m, n are real.
>>> import math
>>> x = math.e
>>> m = 2j*math.pi
>>> (x**m)**m      # (e^(2πi))^(2πi) = 1^(2πi) = 1
(1.0000000000000016+0j)
>>> x**(m*m)       # e^(2πi×2πi) = e^(-4π²) ≠ 1
(7.157165835186074e-18-0j)
AFAIK, sympy supports complex numbers, so I believe this simplification should not be done unless you can prove b is real.
Edit: It is also false if x is not positive.
>>> x = -2
>>> m = 2
>>> n = 0.5
>>> (x**m)**n
2.0
>>> x**(m*n)
-2.0
Edit(by gnibbler): Here is the original example with Kenny's restrictions applied
>>> from sympy import symbols 
>>> a,b=symbols('ab', real=True, positive=True)
>>> j=(a**b**5)**(b**10)
>>> print j
a**(b**15)
ANSWER 2
Score 2
a,b,c=symbols('abc',real=True,positive=True)
(a**b**5)**b**10
a**(b**15)#ans
ANSWER 3
Score 0
This may be related to this bug.