ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 08 Jun 2019 16:31:28 +0200Pretty print factorizations as fractionshttps://ask.sagemath.org/question/46864/pretty-print-factorizations-as-fractions/Hi all,
If I have an object whose factorization makes sense when expressed as a fraction, how do I get Sage to pretty print its factorization as a fraction instead of a product of factors? For example,
sage: R.<x> = PolynomialRing(QQ)
sage: f = (x - 1)^2 / (x + 1)
sage: f
(x^2 - 2*x + 1)/(x + 1)
sage: f.factor()
(x + 1)^-1 * (x - 1)^2
but ideally I would like some way to pretty print `f` as `(x - 1)^2/(x + 1)`.
Thanks,
Henryliu.henry.hlSat, 08 Jun 2019 16:31:28 +0200https://ask.sagemath.org/question/46864/