Ask Your Question

How to enter compound units?

asked 2015-09-09 19:47:53 -0500

Chernoxyl gravatar image

So I've been using Sagemath for a few days and its an amazing piece of software, the units section is very interesting. However how would I use units like km/h or mph?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-09-10 00:26:17 -0500

tmonteil gravatar image

You can do something like:

sage: a = 3 * units.length.kilometer() / units.time.hour() + 12 * units.length.meter()/units.time.second()
sage: a.convert()

But be careful that the current units system is able to add incompatible units and also forget the unit when some terms cancel, see for example this ask question.

edit flag offensive delete link more


Thank you that was very helpful! Now I use this for physics!

Chernoxyl gravatar imageChernoxyl ( 2015-09-10 12:15:36 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2015-09-09 19:47:53 -0500

Seen: 37 times

Last updated: Sep 10 '15