29

6

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?

1

Of course it should be 0ft! IMO new unit system is very incomplete. I would recommend this package, it works way more better.

– swish – 2012-11-29T13:53:13.327@swish: I'm actually thinking about using the old package instead of the new quantites. Less verbose and apparently less buggy. But I would have liked the deep integration into plots, calculus and so on. – Niki Estner – 2012-11-29T14:02:49.613

Old package has the same integration. And this new

`TargetUnits`

for plots is buggy anyways. – swish – 2012-11-29T14:07:27.610@swish: Seems as if AutomaticUnits doesn't work in version 9 any more... I'll probably keep using the built-in Units package – Niki Estner – 2012-11-29T14:21:06.793

I just removed

`QuantityUnits`

folder fromAddOns/Applications. I don't know how to remove it properly :(. – swish – 2012-11-29T14:36:25.6273@swish try putting

`Internal`$DisableQuantityUnits = True;`

in your`init.m`

. This prevents the package from loading without forcing you to actually remove it.`AutomaticUnits``

will then work completely normally. – Oleksandr R. – 2013-01-27T00:39:48.353