Comment #4 on issue 2302 by asmeurer: 2**Rational(4,5)*6**Rational(1,5) should auto-simplify to 2*3**Rational(1,5)
http://code.google.com/p/sympy/issues/detail?id=2302
Hmm. So I guess it's not obvious what the simplest form is. For example, that can also be represented as 2*1458**(1/12).
Let's look at what happens in the simplification. Consider what we do when we simplify sqrt(2)*sqrt(6). We combine the exponents as (2*6)**(1/2), which reduces to 12**(1/2). 12 = 4*3, and 4 is a perfect square, so we pull this out and get 2*sqrt(3).
Doing the same here, if we take a common denominator in the exponents, we get 2**(4/12)*2**(3/12)*6**(6/12). If we write this as (2**4*2**3*6**6)**(1/12), this is the same as (2**(4 + 3)*2**6*3**6)**(1/12) == (2**13*3**6)**(1/12) == 2*(2**1*3**6)*(1/12). Here, i'd say yes, we should recognize that the exponent 6 and 12 are not relatively prime (note that I use this condition and not divisibility), so we factor it as 2*2**(1/12)*3**(1/2).
I use relatively prime because we would also want to reduce something like (2*3**10)**(1/15) to 2**(1/15)*3**(2/3).
Does any of this make sense? Does it sound like a good idea (I really don't know if it is)? I am pretty sure we should try to split out exponents, because it will avoid large numbers in the bases (which among other things, can mean computing large exponentials), but I am not so sure about the "not relatively prime" vs. "divisible" thing. Probably "not relatively prime" would also avoid large bases more. Comments?
Also, remember that we need to be careful when implementing it so that we don't explicitly compute the powers (like 6**6). I managed to do the example above without explicitly computing an powers, so it can be done. And of course, it should use factorint() with the limit argument just like we currently do with square roots.
But clearly we need an algorithm in Mul that canonizes all of 2*1458**(1/12), 2**(1/3)*2**(1/4)*6**(1/2), 2**(7/12)*6**(1/2), and 2*2**(1/12)*3**(1/2) to the same form. Does anyone know of anywhere else, either in mathematics or in CAS, where this has been similarly canonized?
-- You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en.
