ecl-logo Documentation

QuantityFunction

QuantityFunction[f, inputUnit, outputUnit][input..]output

applies the function f after converting input to inputUnit and returns output in outputUnit.

Details

  • Number of 'input' arguments much match length of 'inputUnit' list.
  • Evalution procedure is to convert 'input' to 'inputUnit', strip the units off that value, apply 'f' to the resulting numerical values, and finally add 'outputUnit' to the output of the function.
  • Input
    Output
    Messages
  • InputSizeMismatchGiven number of inputs does not match number of function inputs.
    UnitMismatchUnits on given inputs `1` are not compatible with function input units `2`.

Examples

Basic Examples  (3)

Apply a QuantityFunction to an input:

Input unit can be different but must be compatible with QuantityFunction's input unit:

Can handle functions with mutliple inputs:

Additional Examples  (6)

Given numeric inputs, QuantityFunction assumes they are already in the correct unit:

Can give QuantityFunction functions with named variables:

Apply a QuantityFunction to a list of quantities:

Apply a QuantityFunction to a list of numbers:

Apply a QuantityFunction to a QuantityArray:

Apply a QuantityFunction to another QuantityArray:

Messages  (2)

InputSizeMismatch  (1)

Given wrong number of input arguments:

UnitMismatch  (1)

Given input whose units do not match QuantityFunction's input unit: