After playing with the new quantity system in Mathematica 9 for a while, I keep stumbling over this issue:
0 * Quantity[1, "Meters"]
is not the same as
1 * Quantity[0, "Meters"]
The first is dimensionless 0, the second is 0 meters, and a dimensionless quantity can't be added to or converted to a length like meters.
Take e.g. this simplified example:
startPoint = Quantity[1, "Meters"];
endPoint = Quantity[5, "Meters"];
Manipulate[
UnitConvert[a*endPoint + (1 - a)*startPoint, "Inches"], {a, 0, 1}]
The manipulate converts a point along a line to inches. It works for any setting of a, except 0. and 1., where I get UnitConvert[0. + Quantity[1., "Meters"], "Inches"] instead of a proper length. Generally speaking, it seems that any expression that contains a dimensionless subexpression that can be 0 might break somewhere in your Manipulate, Table or Animate. This seems extremely fragile to me.
Is this a bug? Or am I using Quantity wrong? Should I avoid dimensionless expressions completely? Or avoid Quantity inside dynamic code?
TargetUnitsfor plots is buggy anyways. – swish Nov 29 '12 at 14:07QuantityUnitsfolder from AddOns/Applications. I don't know how to remove it properly :(. – swish Nov 29 '12 at 14:36Internal`$DisableQuantityUnits = True;in yourinit.m. This prevents the package from loading without forcing you to actually remove it.AutomaticUnits`will then work completely normally. – Oleksandr R. Jan 27 '13 at 00:39