Ask Your Question
1

Automatically factor out a common fraction in a vector

asked 2018-07-08 07:15:42 -0600

juliaM gravatar image

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).

edit retag flag offensive close merge delete

Comments

In v = vector([3/2,4/5)]) there is an extra closing parenthesis.

vdelecroix gravatar imagevdelecroix ( 2018-07-08 10:30:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-07-08 10:31:25 -0600

vdelecroix gravatar image

Not automatically, but

sage: print("1/%d %s" % (v.denominator(), v.denominator() * v))
1/10 (15, 8)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-07-08 07:15:42 -0600

Seen: 19 times

Last updated: Jul 08