Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 2.29 KB

unit_conversion.org

File metadata and controls

87 lines (67 loc) · 2.29 KB

You load 16 tons, and what do you get? I mean, in kilograms.

M-x calc
' 16 tons (' to enter algebraic mode, so you can type out the units)
u c kg (u c for "unit convert", and kg being the target unit).

Result:
1:  14514.95584 kg

Calc treats units as special. If you added something, such as:

3
+

Result:
1:  14514.95584 kg + 3

But you can remove the units from the above using:

u r (remove units)

Result:
1:  14517.95584

OK, that’s all well and good. But I’ve always wondered how much is Grandpa Simpson’s gas mileage when he said “My car gets 40 rods to the hogshead and that’s the way I likes it.”

For that, we need to define the units. Calc knows about a lot of units, but maybe not the rod and hogshead. In fact, in the calc info pages, defining what a “rod” is the example for how to define your own units. Let’s get started!

'16 ft (The equivalent to one rod)
u d rod Rod (defines a new unit rod, with optional description "Rod")

Now a hogshead is a unit of measurement that varies by what liquid it contains. I don’t know what the unit is for gasoline, but let’s use sherry as a substitute, in which a hogshead is 245 liters.

'245 liters
u d hogshead (don't bother with a description this time)
'40 rod
'1 hogshead
/

Wait, what units should we be using?

u v (show the units table, a handy table of all units)
u c mi/gal (the units come from the unit table)

Result:
1:  1.87280731429e-3 mi / gal

But wait, we can do better. Why upgrade this measure to something that isn’t even standard? Miles per gallon is just a bit better than rods per hogshead (in fact, that was what the original joke was about).

u c si (convert everything to scientific units)

Result:
1:  796.212244896 / m^2

Not that I understand this number, but at least in miles per gallon, I can see that that’s not such great fuel economy, but what you do expect from Grandpa?

OK, one more cool thing, then I’m out of here. Calc can split up numbers into multiple units. Here’s 42 inches in feet and inches:

'42 in
u c ft+in (Convert to a mixture of feet and inches)

Result:
1:  3 ft + 6. in

Calc, you’re sooo coool!