Previous: “Unsafe” Simplifications, Up: Simplifying Formulas [Contents][Index]
The simplifications described in this section (as well as the algebraic
simplifications) are applied when units need to be simplified. They can
be applied using the u s (calc-simplify-units
) command, or
will be done automatically in Units Simplification mode (m U).
See Basic Operations on Units.
The variable UnitSimpRules
contains rewrites to be applied by
units simplifications. These are applied in addition to EvalRules
and AlgSimpRules
.
Scalar mode is automatically put into effect when simplifying units. See Matrix and Scalar Modes.
Sums ‘a + b’ involving units are simplified by extracting the units of ‘a’ as if by the u x command (call the result ‘u_a’), then simplifying the expression ‘b / u_a’ using u b and u s. If the result has units then the sum is inconsistent and is left alone. Otherwise, it is rewritten in terms of the units ‘u_a’.
If units auto-ranging mode is enabled, products or quotients in which the first argument is a number which is out of range for the leading unit are modified accordingly.
When canceling and combining units in products and quotients,
Calc accounts for unit names that differ only in the prefix letter.
For example, ‘2 km m’ is simplified to ‘2000 m^2’.
However, compatible but different units like ft
and in
are not combined in this way.
Quotients ‘a / b’ are simplified in three additional ways. First, if ‘b’ is a number or a product beginning with a number, Calc computes the reciprocal of this number and moves it to the numerator.
Second, for each pair of unit names from the numerator and denominator of a quotient, if the units are compatible (e.g., they are both units of area) then they are replaced by the ratio between those units. For example, in ‘3 s in N / kg cm’ the units ‘in / cm’ will be replaced by ‘2.54’.
Third, if the units in the quotient exactly cancel out, so that a u b command on the quotient would produce a dimensionless number for an answer, then the quotient simplifies to that number.
For powers and square roots, the “unsafe” simplifications ‘(a b)^c’ to ‘a^c b^c’, ‘(a/b)^c’ to ‘a^c / b^c’, and ‘(a^b)^c’ to ‘a^(b c)’ are done if the powers are real numbers. (These are safe in the context of units because all numbers involved can reasonably be assumed to be real.)
Also, if a unit name is raised to a fractional power, and the
base units in that unit name all occur to powers which are a
multiple of the denominator of the power, then the unit name
is expanded out into its base units, which can then be simplified
according to the previous paragraph. For example, ‘acre^1.5’
is simplified by noting that ‘1.5 = 3:2’, that ‘acre’
is defined in terms of ‘m^2’, and that the 2 in the power of
m
is a multiple of 2 in ‘3:2’. Thus, acre^1.5
is
replaced by approximately
‘(4046 m^2)^1.5’,
which is then changed to
‘4046^1.5 (m^2)^1.5’,
then to ‘257440 m^3’.
The functions float
, frac
, clean
, abs
,
as well as floor
and the other integer truncation functions,
applied to unit names or products or quotients involving units, are
simplified. For example, ‘round(1.6 in)’ is changed to
‘round(1.6) round(in)’; the lefthand term evaluates to 2,
and the righthand term simplifies to in
.
The functions sin
, cos
, and tan
with arguments
that have angular units like rad
or arcmin
are
simplified by converting to base units (radians), then evaluating
with the angular mode temporarily set to radians.
Previous: “Unsafe” Simplifications, Up: Simplifying Formulas [Contents][Index]