# 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?

How to enter compound units?

add a comment

1

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

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

Asked: ** 2015-09-10 02:47:53 +0200 **

Seen: **268 times**

Last updated: **Sep 10 '15**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.