ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 10 Sep 2015 12:15:36 -0500How to enter compound units?https://ask.sagemath.org/question/29426/how-to-enter-compound-units/ 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?Wed, 09 Sep 2015 19:47:53 -0500https://ask.sagemath.org/question/29426/how-to-enter-compound-units/Answer by tmonteil for <p>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?</p>
https://ask.sagemath.org/question/29426/how-to-enter-compound-units/?answer=29427#post-id-29427You can do something like:
sage: a = 3 * units.length.kilometer() / units.time.hour() + 12 * units.length.meter()/units.time.second()
sage: a.convert()
77/6*meter/second
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](http://ask.sagemath.org/question/10218/units-tests/).
Thu, 10 Sep 2015 00:26:17 -0500https://ask.sagemath.org/question/29426/how-to-enter-compound-units/?answer=29427#post-id-29427Comment by Chernoxyl for <p>You can do something like:</p>
<pre><code>sage: a = 3 * units.length.kilometer() / units.time.hour() + 12 * units.length.meter()/units.time.second()
sage: a.convert()
77/6*meter/second
</code></pre>
<p>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 <a href="http://ask.sagemath.org/question/10218/units-tests/">this ask question</a>.</p>
https://ask.sagemath.org/question/29426/how-to-enter-compound-units/?comment=29429#post-id-29429Thank you that was very helpful! Now I use this for physics!Thu, 10 Sep 2015 12:15:36 -0500https://ask.sagemath.org/question/29426/how-to-enter-compound-units/?comment=29429#post-id-29429