Comment #2 on issue 2032 by asmeurer: Ability to work with K[x, 1/x] in
Polys
http://code.google.com/p/sympy/issues/detail?id=2032
I think terms_gcd() is all that is required, but it doesn't work with
fractions the way that factor() does:
In [12]: p = -(27 + 162*y - 27*x*y)/(36*z + x**2*z - 12*x*z)
In [13]: terms_gcd(p)
Out[13]:
-27⋅(1 + 6⋅y - x⋅y)
────────────────────
2
36⋅z - 12⋅x⋅z + z⋅x
In [14]: terms_gcd(p, frac=True)
---------------------------------------------------------------------------
FlagError Traceback (most recent call last)
/Users/aaronmeurer/Documents/python/sympy/sympy/<ipython console> in
<module>()
/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polytools.pyc
in terms_gcd(f, *gens, **args)
3962
3963 """
-> 3964 options.allowed_flags(args, ['polys'])
3965
3966 try:
/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polyoptions.pyc
in allowed_flags(args, flags)
680 try:
681 if Options.__options__[arg].is_Flag and not arg in
flags:
--> 682 raise FlagError("'%s' flag is not allowed in this
context" % arg)
683 except KeyError:
684 raise OptionError("'%s' is not a valid option" % arg)
FlagError: 'frac' flag is not allowed in this context
I think maybe calling apart() on the result might be the trick to doing it:
In [21]: apart(p + z, z)
Out[21]:
27 + 162⋅y - 27⋅x⋅y
z - ───────────────────
⎛ 2⎞
z⋅⎝36 - 12⋅x + x ⎠
--
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.