saad khalid wrote:
> In mathematica, there is the function "together" which combines
> fractions by giving them a common denominator and then cancels out the
> factors. It is shown here:
> https://reference.wolfram.com/language/ref/Together.html
> 
> In Sage, I would like to do something similar. I just want to do
> |
> A,B =var("A,B")
> A/3+B/2
> |
> 
> I want the output to be (2A + 3B)/6, but instead it's just outputing
> what I input. Does Sage have any function that works like "together"
> does in mathematica? Thanks!

Well, not sure what you want to do with the result, but there's for example

sage: (A/3 + B/2).numerator_denominator()
(2*A + 3*B, 6)

If you just want to *see* the common "denominator" and factors, simply
taking the reciprocal 1/(A/3 + B/2) (aka ~(...) in Sage) might be
convenient as well... :-)

But I bet others will have better suggestions.


-leif


-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to