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 all

Basic Examples  (2)

Test whether an input expression is a canonical unit:

Test if an expression is a time unit:

Scope  (9)

Units represented by a single string:

Products of known units:

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:

Wolfram Research (2012), KnownUnitQ, Wolfram Language function, https://reference.wolfram.com/language/ref/KnownUnitQ.html (updated 2024).

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

BibTeX

@misc{reference.wolfram_2024_knownunitq, author="Wolfram Research", title="{KnownUnitQ}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/KnownUnitQ.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_knownunitq, organization={Wolfram Research}, title={KnownUnitQ}, year={2024}, url={https://reference.wolfram.com/language/ref/KnownUnitQ.html}, note=[Accessed: 22-December-2024 ]}