Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3261 by [email protected]: factor_terms loses powers
http://code.google.com/p/sympy/issues/detail?id=3261
This script here:
<pre>
import sympy as sp
a0, a1, b0, b1 = sp.symbols("a0 a1 b0 b1")
x = 2*(b0**2 + b1**2)*(-2*a0*b0 - 2*a1*b1) + (-4*a0*b0 - 4*a1*b1)*(-2*a0*b0
- 2*a1*b1)*(a0*b0 + a1*b1)
sp.pretty_print(x)
from sympy.simplify.cse_opts import sub_pre
x2 = sub_pre(x) # fine
x3 = sp.factor_terms(x2) # broken
assert isinstance(x3, sp.cse_opts.Neg)
x3 = -x3.args[0]
sp.pretty_print(x3)
</pre>
produces the following output:
<pre>
⎛ 2 2⎞
⎝2⋅b₀ + 2⋅b₁ ⎠⋅(-2⋅a₀⋅b₀ - 2⋅a₁⋅b₁) + (-4⋅a₀⋅b₀ - 4⋅a₁⋅b₁)⋅(-2⋅a₀⋅b₀ -
2⋅a₁⋅b₁)⋅(a₀⋅b₀ + a₁⋅b₁)
⎛ 2 2 ⎞
-4⋅(a₀⋅b₀ + a₁⋅b₁)⋅⎝b₀ + b₁ - 2⎠
</pre>
i.e. `factor_terms` incorrectly gets rid of two powers of (a0b0+a1b1) from
the last term.
(Moved from https://github.com/sympy/sympy/issues/1284 )
--
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.