CompatibleUnitQ
CompatibleUnitQ[quantity1,quantity2]
returns True if quantity1 and quantity2 have compatible units, and False otherwise.
Details
- quantityi can be a Quantity object or a unit expression, such as "Meters" or "Feet"/"Seconds".
- CompatibleUnitQ returns False unless the Quantity or unit elements have the same UnitDimensions.
- CompatibleUnitQ[quantity] tests whether quantity is a valid Quantity or unit expression.
- CompatibleUnitQ[quantity1,…,quantityn] tests whether all quantityi expressions have compatible units.
- CompatibleUnitQ[{quantity1,…,quantityn}] is equivalent to CompatibleUnitQ[quantity1,…,quantityn].
- Units of temperature are considered compatible with units of temperature difference.
Examples
open allclose allBasic Examples (3)
Test whether two Quantity objects are compatible:
Scope (6)
Test compatibility of Quantity objects:
Test compatibility of unit expressions:
Test compatibility of the elements of lists:
Test whether QuantityArray objects have compatible units:
Use MixedUnit specifications:
Use DatedUnit specifications:
Properties & Relations (6)
CompatibleUnitQ returns True when its elements have the same UnitDimensions:
An IndependentUnit object is only compatible with itself:
Known units are not compatible with IndependentUnit objects of the same name:
Numeric expressions are treated as dimensionless quantities:
CompatibleUnitQ will automatically attempt to interpret an unknown unit string:
CompatibleUnitQ with one argument is similar to KnownUnitQ:
CompatibleUnitQ accepts numeric expressions:
CompatibleUnitQ attempts to interpret unknown unit strings:
If elements other than quantities and units are present, CompatibleUnitQ returns False:
Text
Wolfram Research (2012), CompatibleUnitQ, Wolfram Language function, https://reference.wolfram.com/language/ref/CompatibleUnitQ.html (updated 2022).
CMS
Wolfram Language. 2012. "CompatibleUnitQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/CompatibleUnitQ.html.
APA
Wolfram Language. (2012). CompatibleUnitQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompatibleUnitQ.html