Units with Scalars
To directly combine units with numbers and other units,
AutoMathic requires that a few special conventions be
followed. These rules will ensure that units are
unambiguously communicated, but still allow some freedom of
expression. The rules are listed here with representative
examples:
Units
Simple Unit |
A single word or
abbreviation. Abbreviations must NOT include periods
(e.g. "ft."): |
e.g. |
mile
mi |
Compound Unit |
Multiple words or
abbreviations. Depending on its context, a "compound
unit" may have to be enclosed in parentheses: |
e.g. |
feet
per second
(miles per hour)
(mi/hr) |
"in"
as a Unit |
The standard abbreviation for
"inch" is "in", but because "in" is also a very common word,
it is only interpreted as an abbreviation for "inch" in the
context of a unit (i.e. when individually enclosed in
parentheses or square brackets, preceded by "unit" or
"units" or "measured in" or "in terms of", immediately
preceded by an open parenthesis or open bracket, or
immediately followed by a close parenthesis or close
bracket): |
e.g. |
(in)
[in]
unit in
measured in in
in terms of in
[in/hr]
[seconds/in] |
"has"
as a Unit |
An abbreviation for
"hectares" is "has", but because "has" is also a very common
word, it is only interpreted as an abbreviation for
"hectares" in the context of a unit (i.e. when individually
enclosed in parentheses or square brackets, preceded by
"unit" or "units" or "measured in" or "in terms of",
immediately preceded by an open parenthesis or open bracket,
or immediately followed by a close parenthesis or close
bracket): |
e.g. |
(has)
[has]
unit has
measured in has
in terms of has
[has/hr]
[seconds/has] |
AutoMathic's library has some common compound unit abbreviations
already defined:
- MPH, KPH, FPS, MPS, MPG, and RPM.
Since their definitions already
include enclosing parentheses, a predefined abbreviation of a
compound unit can be treated like a "simple unit" and be used
without parentheses.
Unit
Phrases
Unit Phrases combine properties, scalars, and/or units into a
cohesive whole that defines a measurement. In Unit Phrases,
simple or compound units can be enclosed in square brackets to
simplify and shorten the unit phrase.
Unit Phrase |
A "unit phrase" can be a
property, followed by "measured in" or "in terms of",
optionally followed by the word "unit" or "units", followed
by a "unit". If you enclose the units in square
brackets, the optional word "unit" or "units" can always be
omitted: |
e.g. |
speed
measured in units miles per hour
speed measured in [miles per hour]
speed in terms of miles per hour
speed in terms of [miles per hour] |
|
A "unit phrase" can be a
property, followed by "in", followed by the word "unit" or
"units", followed by a "unit". If you enclose the
units in square brackets, the word "unit" or "units" can be
omitted: |
e.g. |
heights
in unit centimeters
heights in [centimeters]
speed in units mi/hr
speed in [mi/hr] |
|
A "unit phrase" can be a
quantity, followed by the word "unit" or "units", followed
by a "unit". If you enclose the units in square
brackets, the word "unit" or "units" can be omitted.
Spaces are not required around the square brackets: |
e.g. |
210
unit pounds
210 [pounds]
210[pounds] |
|
A compound unit following a
quantity must be enclosed in parentheses or square brackets,
but built-in abbreviations of compound units can be treated
like simple units since their definitions include enclosing
parentheses. |
e.g. |
145
unit (mi/hr)
145 [mi/hr]
145 unit mph
145[mph] |
Rules-of-Thumb
Three simple rules-of-thumb for units and unit phrases are:
- "measured in" or "in terms of" should go between a property
(e.g. distance) and its unit (e.g. kilometers). If the
unit is in square brackets, the word "in" is sufficient.
- distance in terms of kilometers
- distance in [kilometers]
- A unit following a quantity must be preceded by the word
"unit" unless the unit is enclosed in square brackets.
- A compound unit following a quantity requires enclosing
parentheses or square brackets.
- 120 unit (miles per hour)
- 120[miles per hour]
Common
Usage
The "unit" and "unit phrase" building-blocks can be used in a
number of ways:
- A "unit" can be used by itself. Restricting some input
to standalone units is what defines the Standalone method
- A "unit phrase" can be used by itself to request a calculation
- speed in units mi/hr
- speed in [mi/hr]
- A "unit phrase" can be used in a question to ask for a
measurement or conversion
- What's the speed measured in unit mi/hr?
- What's the speed in [mi/hr]?
- How many unit (mi/hr) would the speed
be?
- How many [mi/hr] would the speed be?
- A "unit phrase" can be used in a statement of fact to define a
measurement:
- 55 is the speed in terms of mi/hr
- 55 is the speed in [mi/hr]
- 55 unit (mi/hr) is the speed
- 55[mi/hr] is the speed
Although units are most often used in a 1-dimensional way (for
example using "feet" to measure a length), units can also be used
in multiple dimensions to
measure things such as an area (2 dimensions), or a volume (3
dimensions).