KnownUnitQ
KnownUnitQ[expr]
returns True if expr is a canonical unit, and False otherwise.
KnownUnitQ[expr,dims]
gives True if expr is a canonical unit with physical dimensions dims, and False otherwise.
Details
- KnownUnitQ has attribute HoldRest.
- KnownUnitQ[expr,dims] returns True if expr is a canonical unit and is compatible with dims.
- Dimensional specification dims may be a list of unit dimensions, a QuantityVariable, a Quantity or a string representing a quantity variable or unit dimension.
Examples
open allclose allBasic Examples (2)
Scope (9)
Units represented by a single string:
KnownUnitQ returns True for valid IndependentUnit specifications:
It returns False for invalid IndependentUnit specifications:
MixedUnit specifications of compatible units:
Incompatible units do not produce a valid MixedUnit specification:
DatedUnit specifications:
Prefixes are dimensionless known units:
Dimension specifications may be a list of unit dimensions, QuantityVariable, Quantity or string:
KnownUnitQ returns False if the first argument is not a canonical unit expression:
KnownUnitQ returns False if the second argument is not a recognized dimension specification:
Properties & Relations (2)
KnownUnitQ has attribute HoldAll:
A MixedUnit specification is valid if it contains compatible units:
Possible Issues (2)
Quantity can interpret a non-canonical unit, converting it to its canonical form:
KnownUnitQ does not accept non-canonical units:
But it does accept their canonical form:
Dimension specifications may not be a unit:
Text
Wolfram Research (2012), KnownUnitQ, Wolfram Language function, https://reference.wolfram.com/language/ref/KnownUnitQ.html (updated 2024).
CMS
Wolfram Language. 2012. "KnownUnitQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/KnownUnitQ.html.
APA
Wolfram Language. (2012). KnownUnitQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/KnownUnitQ.html