Piecewise Functions in the Simple Units Environment
Description
Examples
In the Simple Units environment, the piecewise function is modified so that it verifies that the values it can return have the same dimension.
Every command in the Simple Units environment that needs to determine whether an expression is valid or not, does so using the Units:-TestDimensions command.
Note: Prior to Maple 2015, units were displayed surrounded by double brackets.
with⁡UnitsSimple:
This is a legal expression, because the two possible values have the same dimension (namely, length).
piecewise⁡x<1,2⁢Unit⁡m,3⁢Unit⁡ft
2x<111431250otherwise⁢m
This is an illegal expression, because the three possible values do not all have the same dimension: two of them are pressures, whereas the third is a force. Consequently, Maple signals an error.
piecewise⁡x<20⁢Unit⁡m,2⁢Unit⁡bar,x<40⁢Unit⁡m,35⁢Unit⁡inch_mercury,3⁢Unit⁡gigadyne
Error, (in Units:-Simple:-piecewise) the following expressions imply incompatible dimensions: {piecewise(Units:-Simple:-`<`(x,Units:-Simple:-`*`(20,Units:-Unit(m))),200000*Units:-Unit(Pa),Units:-Simple:-`<`(x,Units:-Simple:-`*`(40,Units:-Unit(m))),18015585/152*Units:-Unit(Pa),30000*Units:-Unit(N))}
See Also
piecewise
Units
Units/Simple
Download Help Document