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.Sun, 08 Jul 2018 17:31:25 +0200Automatically factor out a common fraction in a vectorhttps://ask.sagemath.org/question/42859/automatically-factor-out-a-common-fraction-in-a-vector/ Suppose I have a vector like `v = vector([3/2,4/5)])`. Is there a way to make sage output this automatically as `v = 1/10 (15,8)`.Sun, 08 Jul 2018 14:15:42 +0200https://ask.sagemath.org/question/42859/automatically-factor-out-a-common-fraction-in-a-vector/Comment by vdelecroix for <p>Suppose I have a vector like <code>v = vector([3/2,4/5)])</code>. Is there a way to make sage output this automatically as <code>v = 1/10 (15,8)</code>.</p>
https://ask.sagemath.org/question/42859/automatically-factor-out-a-common-fraction-in-a-vector/?comment=42862#post-id-42862In `v = vector([3/2,4/5)])` there is an extra closing parenthesis.Sun, 08 Jul 2018 17:30:38 +0200https://ask.sagemath.org/question/42859/automatically-factor-out-a-common-fraction-in-a-vector/?comment=42862#post-id-42862Answer by vdelecroix for <p>Suppose I have a vector like <code>v = vector([3/2,4/5)])</code>. Is there a way to make sage output this automatically as <code>v = 1/10 (15,8)</code>.</p>
https://ask.sagemath.org/question/42859/automatically-factor-out-a-common-fraction-in-a-vector/?answer=42863#post-id-42863Not automatically, but
sage: print("1/%d %s" % (v.denominator(), v.denominator() * v))
1/10 (15, 8)Sun, 08 Jul 2018 17:31:25 +0200https://ask.sagemath.org/question/42859/automatically-factor-out-a-common-fraction-in-a-vector/?answer=42863#post-id-42863