Updates:
Labels: NeedsReview
Comment #6 on issue 1568 by mattpap: factoring is working too hard
http://code.google.com/p/sympy/issues/detail?id=1568
More symbolic capabilities were added to factor() in polys11 branch, e.g.:
In [1]: var('a')
Out[1]: a
In [2]: df=-(1 - x)**2*(4 + x)/((2 + x)*(a + x)**2) - (1 - x)**2*(4 +
x)/((2 + x)**2*(a + x)) - (2 - 2*x)*(4 + x)/((2 + x)*(a + x)) + (1 -
x)**2/((2 + x)*(a + x))
In [3]: df
Out[3]:
2 2 2
(1 - x) ⋅(4 + x) (1 - x) ⋅(4 + x) (2 - 2⋅x)⋅(4 + x) (1 - x)
- ──────────────── - ──────────────── - ───────────────── + ───────────────
2 2 (2 + x)⋅(a + x) (2 + x)⋅(a + x)
(2 + x)⋅(a + x) (2 + x) ⋅(a + x)
In [4]: factor(_)
Out[4]:
⎛ 2 2 3⎞
-(1 - x)⋅⎝8 + 16⋅x + 18⋅a + 10⋅a⋅x + 5⋅x + 2⋅a⋅x + x ⎠
────────────────────────────────────────────────────────
2 2
(2 + x) ⋅(a + x)
Also the original problem is now solved:
In [10]: eq=(1 - x)**2*(4 + x)/(((2 + x)*(a + x)))
In [11]: eq
Out[11]:
2
(1 - x) ⋅(4 + x)
────────────────
(2 + x)⋅(a + x)
In [12]: d = eq.diff(x, 3)
In [13]: %time factor(d)
CPU times: user 0.44 s, sys: 0.00 s, total: 0.44 s
Wall time: 0.50 s
Out[14]:
⎛ 2 2 2 2
2 2 3 3 2 3
-6⋅⎝32 + 64⋅x + 72⋅a + 144⋅a⋅x + 48⋅x + 52⋅a + 24⋅a ⋅x + 104⋅x⋅a +
108⋅a⋅x + 16⋅x + 18⋅a + 8⋅a ⋅x - 7⋅x
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
4 4
(2 + x) ⋅(a + x)
4 2 4⎞
+ a ⋅x ⎠
──────────
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.