 syntactically_valid_unit_name - Maple Help

Home : Support : Online Help : Mathematics : Numbers : Type Checking : syntactically_valid_unit_name

type/syntactically_valid_unit_name

check for a Maple unit name Calling Sequence type(expr, unit_name) Parameters

 expr - expression Description

 • A Maple expression is syntactically valid as a unit name is a symbol, a symbol indexed by a symbol, or a function that is either of these whose arguments are symbols.
 • The type(expr, unit_name) function returns true if expr has the form of a syntactically valid unit name. Otherwise, false is returned.
 • This type exists mostly for use by the Units package internally; if you are considering using this in your program to test something related to user functionality, then it is almost certainly not what you want. Consider instead using the type with_unit to find expressions with units attached, or specfunc(Units:-Unit) to find Unit function calls. Examples

 > $\mathrm{type}\left(\mathrm{meter},\mathrm{syntactically_valid_unit_name}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left({\mathrm{mile}}_{\mathrm{US_survey}},\mathrm{syntactically_valid_unit_name}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{type}\left(\mathrm{meter}\left(\mathrm{radius}\right),\mathrm{syntactically_valid_unit_name}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left({\mathrm{foot}}_{\mathrm{standard}}\left(\mathrm{radius}\right),\mathrm{syntactically_valid_unit_name}\right)$
 ${\mathrm{true}}$ (4)

The type tests only whether expr would be valid as a unit name, not whether it is actually a unit that Maple knows about. For example, not_an_actual_unit would be a valid unit name, so this type returns true. However, it is not an actual unit that is defined in the Maple library.

 > $\mathrm{type}\left(\mathrm{not_an_actual_unit},\mathrm{syntactically_valid_unit_name}\right)$
 ${\mathrm{true}}$ (5)

The expression $\frac{m}{s}$ would not be a valid unit name. (It is syntactically valid as a compound unit, which is tested by the type syntactically_valid_compound_unit.)

 > $\mathrm{type}\left(\frac{m}{s},\mathrm{syntactically_valid_unit_name}\right)$
 ${\mathrm{false}}$ (6)