fraction() only takes the numerator and denominator of the top-level
expression, without doing any simplification. It should be used in
places where you don't care about subexpressions and want something
very fast. as_numer_denom() simplifies subexpressions when extracting
numerator and denominator. An example demonstrates the difference:

>>> fraction(1/(1/x + 1))
(1, 1 + 1/x)
>>> (1/(1/x + 1)).as_numer_denom()
(x, x + 1)

Aaron Meurer

On Fri, Mar 19, 2021 at 2:36 PM Paul Royik <distantjob...@gmail.com> wrote:
>
> And why one needs both these methods?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/8cbc06f0-a4fe-4908-9e85-3fda91e1e979n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6KyP%3De4COVbUSpAnszHGwQEwnqVhdsiTrj5LNR%3Dq3x1Qw%40mail.gmail.com.

Reply via email to