Skip to main content
2 of 2
edited tags

Is Quantity necessary?

Soft question: are Quantity - and newly added MixedUnit and MixedMagnitude - needed in a symbolic manipulation language?

Quantity is the product of magnitude and unit, so couldn't even mixed ones be represented as polynomials, eg:

t1 = 1*Unit["Hours"] + 30*Unit["Minutes"];

t2 = 30*Unit["Minutes"] + 1*Unit["Seconds"];

Note there is no Unit head in WL - using upper case U to make it look legit. What technical hurdles stand in the way of evaluating, say:

t1-t2 --> 59*Unit["Minutes"] + 59*Unit["Seconds"]

versus the current, awkward representation:

Quantity[MixedMagnitude[{1, 30}], MixedUnit[{"Hours", "Minutes"}]] - 
 Quantity[MixedMagnitude[{30, 1}], MixedUnit[{"Minutes", "Seconds"}]]
alancalvitti
  • 15.2k
  • 3
  • 27
  • 93