Comment #7 on issue 2042 by [email protected]: Frac() object for rational
function arithmetics
http://code.google.com/p/sympy/issues/detail?id=2042
Does Term meet your needs?
>>> from sympy.core.exprtools import *
>>> Term(3*(x+1)/(x-1))
Term(3, Factors({x + 1: 1}), Factors({x - 1: 1}))
>>> t1=_
>>> t2=Term(3*(x+1)/(y-1))
>>> t1.mul(t2)
Term(9, Factors({x + 1: 2}), Factors({x - 1: 1, y - 1: 1}))
>>> _.as_expr()
9*(x + 1)**2/((x - 1)*(y - 1))
>>> t1.quo(t2).as_expr()
(y - 1)/(x - 1)
>>> t1.add(t2).as_expr()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Term' object has no attribute 'add'
Adding an add and sub method probably wouldn't be too hard.
--
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.