Ask Your Question
1

Automatically factor out a common fraction in a vector

asked 2018-07-08 14:15:42 +0100

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 17:30:38 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-08 17:31:25 +0100

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 14:15:42 +0100

Seen: 204 times

Last updated: Jul 08 '18