piecewise - Maple Help

Piecewise Functions in the Simple Units Environment

Description

 • 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.

Examples

Note: Prior to Maple 2015, units were displayed surrounded by double brackets.

 > $\mathrm{with}\left(\mathrm{Units}\left[\mathrm{Simple}\right]\right):$

This is a legal expression, because the two possible values have the same dimension (namely, length).

 > $\mathrm{piecewise}\left(x<1,2\mathrm{Unit}\left(m\right),3\mathrm{Unit}\left(\mathrm{ft}\right)\right)$
 $\left(\left\{\begin{array}{cc}{2}& {x}{<}{1}\\ \frac{{1143}}{{1250}}& {\mathrm{otherwise}}\end{array}\right\\right){}⟦{m}⟧$ (1)

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.

 > $\mathrm{piecewise}\left(x<20\mathrm{Unit}\left(m\right),2\mathrm{Unit}\left(\mathrm{bar}\right),x<40\mathrm{Unit}\left(m\right),35\mathrm{Unit}\left(\mathrm{inch_mercury}\right),3\mathrm{Unit}\left(\mathrm{gigadyne}\right)\right)$