Piecewise Functions in the Simple Units Environment - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Science and Engineering : Units : Environments : Simple : Units/Simple/piecewise

Piecewise Functions in the Simple Units Environment

 

Description

Examples

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.

withUnitsSimple:

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

piecewisex<1&comma;2Unitm&comma;3Unitft

2x<111431250otherwisem

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

piecewisex<20Unitm&comma;2Unitbar&comma;x<40Unitm&comma;35Unitinch_mercury&comma;3Unitgigadyne

Error, (in Units:-Simple:-piecewise) the following expressions imply incompatible dimensions: {piecewise(x < 20*Units:-Unit(m),2*Units:-Unit(bar),x < 40*Units:-Unit(m),35*Units:-Unit(inHg),3*Units:-Unit(Gdyn))}

See Also

piecewise

Units

Units/Simple