As an enthusiast and frequent user of unit functionalities, I would like to suggest some improvements.

Example 1: 

Assume a quantity equation w = f(z) where we substitute z = 100*`μm` (and probably other parameters with units) to obtain a numerical result.
After some simplifications the result is

w = 0.3365290139e-4*Unit('m')

w = 0.3365290139e-4*Units:-Unit(m)

(1)

 

A result in this form is the most frequent physical quantity equation with units in use:

A physical quantity denoted by the name w that is equal to a numerical value times a physical unit.

In this form it is also the shortest way to define/name scientific constants, scientific and engineering parameters, and results for variables/unknowns.  


To better interpret the above result a conversion to micron is desirable. This unfortunately does not work with the context panel. Alternatively one could think of mapping a command onto the equation.
(Mapping a command is a good practice to threat the left-hand side and the right-hand side of an equation equally.)

map(convert, w = 0.3365290139e-4*Units:-Unit(m), units, micron)

Error, (in convert/units) unable to convert `1` to `micron`

 

This however does not work, since the left-hand side does not contain the dimension length, but only the name w of the physical quantity.  

A way to convert is:

lhs(w = 0.3365290139e-4*Units:-Unit(m)) = convert(rhs(w = 0.3365290139e-4*Units:-Unit(m)), units, micron)

w = 33.65290139*Units:-Unit(micron)

(2)

For a single result this might be acceptable, but for a list of results this not practical.

In any case not being capable to apply to an equation the same operation to both sides bares the risks of introducing errors.

NULL

Example 2: 

More complicated are results of this kind

NULL

w((1/10000)*Unit('m')) = 0.3365290139e-4*Unit('m')

w((1/10000)*Units:-Unit(m)) = 0.3365290139e-4*Units:-Unit(m)

(3)

A way to convert this to w(100*`μm`) = 33.65290139*`μm`:

w(convert(op(lhs(w((1/10000)*Units:-Unit(m)) = 0.3365290139e-4*Units:-Unit(m))), units, micron)) = convert(rhs(w((1/10000)*Units:-Unit(m)) = 0.3365290139e-4*Units:-Unit(m)), units, micron)

w(100*Units:-Unit(micron)) = 33.65290139*Units:-Unit(micron)

(4)

This is too complicated.

Instead, eval with a manually entered conversion can be used for this

eval(w(100*Units:-Unit(micron)) = 33.65290139*Units:-Unit(micron), Unit('m') = 10^6*Unit('`μm`'))

w(100*Units:-Unit(micron)) = 33.65290139*Units:-Unit(micron)

(5)

However, this is old style: The way we had to work before the introduction of the unit package.

 

In other areas Maples unit conversion functionalities are more advanced.

Plotting with units for example has been improved to the point where unit conversion errors of quantity expressions are almost impossible (in contrast to numerical-value expressions): The user can specify the units to display and the numerical values of the physical quantities are converted accordingly.

 

S1: To catch up with that improvement, conversion of the results as in Example 1 in the form of quantity equations would be desirable as well.

 

Other desirable unit conversions of quantity expressions are

 

• 

S2: Right click (or select and right click) a unit in Maple output and conversion to a new unit with the context panel (try it with one of the above outputs: nothing happens).

• 

S3: Replacement of a unit by a desired unit of the same dimension (Example 2).

• 

S4: Replacement of a unit by conversion to a new equivalent unit (e.g.: "⟦(m kg)/(s^3 A)⟧ to V/(m)") matching the pattern of the unit but not necessarily the pattern of the underlying Unit commands (for this subs can be used already).

 

For all suggestions, it is important that the physical quantity to be converted does not change, i.e. if a unit is changed, the numerical value of the physical quantity is changed accordingly.

 

Download Unit_conversion_in_quantity_expressions.mw


Please Wait...