unitbundle_Arith: Operations on unitbundles

Description Usage Arguments Details See Also

Description

When data with units are combined by arithmetic operations, the units ought to be propagated through according to standard rules. Data that are unitted obey these rules. To make this possible, the units themselves (as unitbundle objects) also obey rules relevant to units propagation, but be warned - the rules are slightly different for unitbundle objects than they are for unitted objects. See Details | Arithmetic on unitbundles.

Usage

1
2
## S4 method for signature 'unitbundle,unitbundle'
Arith(e1, e2)

Arguments

e1

the first unitbundle

e2

the second unitbundle

Details

The rules for operations on unitbundles are described in the following subsections.

Arithmetic on unitbundles

+e1, -e1, !e1

Returns the original units of e1, which are unchanged by these unary operations.

e1+e2, e1-e2

e1 and e2 are required to contain identical units (an error is thrown otherwise); the units of e1 (or, equivalently, e2) are returned unaltered.

e1*e2

Returns a new unitbundle containing the union (product) of all units in e1 and e2.

e1/e2

Returns a new unitbundle with the units of e1 in the numerator and the units of e2 in the denominator.

e1^e2

Requires that e2 contain no units; the new units must be calculated with respect to the data attached to e2 but cannot be calculated here because the data are unavailable to unitbundles themselves. The units of e1 are returned.

e1%%e2

Returns the units of e1 regardless of the units of e2.

e1%/%e2

Returns the same units as e1/e2.

See Also

unitbundle for the unitbundle class; unitted for data with unitbundles attached


appling/unitted documentation built on July 24, 2017, 8:40 a.m.