Updates:
Cc: Vinzent.Steinberg
Labels: NeedsReview
Comment #12 on issue 415 by asmeurer: sqrt(6)/2*sqrt(2) does not
auto-simplify properly
http://code.google.com/p/sympy/issues/detail?id=415
I figured it out. Around line 256 of mul.py:
else:
obj = b**e
if obj.is_Number:
coeff *= obj
else:
c_part.append(obj)
b here is 12 (6*2), and e is 1/2. obj is not a Number, so it is added to
the mul. But 12**(1/2) reduces to
2*3**(1/2), which is a mul. The 2 should go in the coeff along with the
1/2 in order to cancel it. The solution I
came up with is to check at this point if obj is a mul, and if it is,
reflatten the args (the code to cancel 2 and 1/2
is above this in flatten). I haven't run benchmarks (please do so in the
review), but a simple print statement
reveals that only one test has to reflatten.
The fix is at http://github.com/asmeurer/sympy/tree/415. Please review.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
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.