I must admit that I don't think this problem is really new. However, I haven't found a post dealing exactly with this aspect of the issue.
I am doing calculation using Quantities, but I have problems dealing with dimensionless quantities. Suppose you define:
h = Quantity[b, "m"]
Now I would like to multiply h
by a dimensionless parameter a
, so to obtain the equivalent of the expression:
Quantity[a b, "m"]
Simply multiplying by a
doesn't work (as you can check by trying to evaluate QuantitymMagnitude[a h]
); this is understandable, since a
is just an undefined symbol and as such has "unknown" units. I though, however, that multiplying by Quantity[a,"DimensionlessUnit"]
would do the trick. Nope (same check).
The only solution I have found is to use
Quantity[a QuantityMagnitude[h], QuantityUnit[h]]
Rather involved... any idea or consideration in regard to this? Is there a profound reason I am not seeing for not supporting dimensionless symbols?
Quantity[a, "DimensionlessUnit"]*h
, since applyingQuantityMagnitude
givesa b m
, the same as one gets withQuantityMagnitude[Quantity[a QuantityMagnitude[h], QuantityUnit[h]]]
. The only difference is that applyingQuantityUnit
gives"DimensionlessUnit" "Meters"
, instead of just"Meters"
, but that can be reduced to1 "m"
by applying UnitConvert. So what am I missing? $\endgroup$