Details and Options
UnitDimensionValidate recursively examines the subexpressions in an equation or expression, checking if each component is internally consistent with regards to unit dimensions. Where it is inconsistent, it will flag the issue either in a table or when displaying the formula with highlighting. Issues include unknown units or physical quantities, function arguments with lingering unit dimensionality, incompatible units added together or incompatible units being equated.
ResourceFunction["UnitDimensionValidate"] supports the following properties:
| "DiagnosisTable" | table of subexpressions and their warning or error messages |
| "ExpressionHighlighting" | the original expression with warnings and errors highlighted |
| "UnitDiagnosisTable" | table of subexpressions and unit dimensions for dimensional incompatibilities |
| "UnitDimensions" | unit dimensions of the overall expression if available |
| "Validate" | Boolean result for dimensional balance |
ResourceFunction["UnitDimensionValidate"][expr] is equivalent to ResourceFunction["UnitDimensionValidate"][expr,"ExpressionHighlighting"].
Issues are categorized as errors, where unit dimensions are incompatible or can't be determined in the expression, and warnings, where unit dimension balance can be established by treating angular units and similar unit dimensions as dimensionless.
"ExpressionHighlighting" uses
LightRed background highlighting for errors and
Yellow background highlighting for warnings by default. See the options
"CorrectHighlighting",
"ErrorHighlighting" and
"WarningHighlighting" to control the color and style of highlighting for different parts of the expression.
"PropertyAssociation" returns the properties "ExpressionHighlighting", "UnitDimensions" and "Validate". "Dataset" returns those properties as a
Dataset.
All can be used to obtain all properties besides "Dataset" and "PropertyAssociation".
"UnitDimensions" is
Missing["NotAvailable"] when the expression is not dimensionally balanced.
UnitDimensionValidate supports the following options:
| "CheckArgumentDimensions" | True | whether to check the arguments of functions are dimensionless |
| "CorrectHighlighting" | Automatic | Highlighted options for correctly formatted expressions |
| "DimensionedArgumentFailureException" | {} | unit dimensions treated as dimensionless when balancing |
| "DimensionedArgumentWarnings" | Automatic | unit dimensions treated as dimensionless but highlighted when balancing |
| "ErrorHighlighting" | Automatic | Highlighted options for erroneously formatted expressions |
| "WarningHighlighting" | Automatic | Highlighted options for expression warnings |
The default unit dimensions used by "DimensionedArgumentWarnings" include
{"SolidAngleUnit","AngleUnit","RevolutionUnit","PersonUnit","ImpressionUnit",IndependentUnitDimension}.