If 'f' is a fraction, can someone please tell me how to separate the
numerator and denominator of f I tried f.numerator and f.denominator
but it doesnt seem to work...
--
You received this message because you are subscribed to the Google Groups
sympy group.
To view this discussion on the
This is documented in the online docs [1] and in the docstring. If you're
using ipython, you can use their introspection to check the docstring, for
example, as '?Rational'. From the docstring:
**Low-level**
Access numerator and denominator as .p and .q:
r = Rational(3,4)
r
3/4
r.p
3
r.q
4
A better way is to use .as_numer_denom(), which also works on symbolic
fractions:
In [380]: Rational(3, 4).as_numer_denom()
(3, 4)
In [381]: (x/y).as_numer_denom()
(x, y)
There's also the fraction() function, which does almost the same thing:
In [382]: fraction(Rational(3, 4))
(3, 4)
In
also...
numer(a/y)
a
denom(a/y)
y
fraction, numer and denom don't re-write the expression as a fraction:
numer(a/y+x)
a/y + x
--
You received this message because you are subscribed to the Google Groups
sympy group.
To post to this group, send email to sympy@googlegroups.com.
To
Yep that works... Thnx a lot Sean, Aaron and Chris
On Wed, Feb 29, 2012 at 12:35 PM, Chris Smith smi...@gmail.com wrote:
also...
numer(a/y)
a
denom(a/y)
y
fraction, numer and denom don't re-write the expression as a fraction:
numer(a/y+x)
a/y + x
--
You received this message