MENTAL
 Main Menu
 Language
 Expressions
 Magnitudes


Magnitudes
 MAGNITUDES

"Numbers are the product of counting. Quantities are the product of measuring" (Gregory Bateson).



Physical Magnitudes

In physics, a certain magnitude is expressed by two data:
  1. The quantity, which is a number (e.g., 12.5).

  2. The unit, which can be:

    1. Simple (e.g. meter, second, kilogram, etc.).

    2. Compound: an arithmetic expression formed from other simple units (e.g. m/sec²).
An example of the composite magnitude acceleration is 12.5 m/sec².

In this expression, the quantity and the unit (simple or compound) appear "loose", i.e., there is no form of expression of the magnitude that encompasses them. Although this is perfectly admissible in everyday life, it is not so from a formal or computational point of view.

This problem is compounded when one intends to perform (consistent or inconsistent) computations with magnitudes, e.g.:
Specification in MENTAL

Specification of magnitudes

A quantity is specified by the expression quantity*unit. For example, These expressions make sense because:
Calculation with magnitudes

Expressed the magnitudes in the described way, it is possible to perform calculations with magnitudes, operating at the same time with quantities and with units. For this purpose, the following properties must be taken into account, where u and v represent units (simple or compound), and r1 and r2, quantities (real numbers):

Type of magnitudesOperationProperty
Homogéneas Sum ⟨( (f1*u + f2*u) = (f1+f2)*u )⟩
Subtract ⟨( (f1*u − f2*u) = (f1−f2)*u )⟩
Product ⟨( f1*u * f2*u = (f1*f2)*(u^2) )⟩
Division ⟨( f1*u ÷ f2*u = (f1÷f2) )⟩
Heterogeneous Sum (f1*u + f2*v) // self-evaluates
Resta (f1*u − f2*v) // self-evaluates
Product ⟨( f1*u * f2*v = (f1*f2)*(u*v) )⟩
Division ⟨( f1*u ÷ f2*v = (f1÷f2)*(u÷v) )⟩

In the case of quotient between homogeneous quantities, we have a dimensionless (unitless) quantity.

Examples of operations with magnitudes:
  1. (x = 5*meter)
    (y = 7*meter)
    x+y // ev. 12*meter
    x−y // ev. −2*meter


  2. (x = 8*meter)
    x*x // ev. 64*(meter*meter) ev. 64*(meter^2)


  3. (e = 12*meter)
    (t = 3*second)
    e÷t // ev. (12÷3)*(meter÷second) ev. 4*(meter÷second)


  4. (x = 10*meter)
    (y = 2*meter)
    x÷y // ev. (10÷2)*(meter÷meter) ev. 5*1 ev. 5


  5. (e = 8*meter)
    (t = 2*second)
    e+t // ev. (8*meter + 2*second)

Assignment of names to composite units

Names can be assigned to compound units. For example, if we do

( erg =: ((cm^2)*gram)÷(sec^2) )

then the expression 123*ergio represents the expression.

123*(((cm^2)*gramo)÷(seg^2)))


Unit change

If you want to change the unit of a certain magnitude, it is sufficient to define the equivalence between the units. For example:

(x = 8*meter)
(meter = 100*cm)
x // is automatically evaluated as 800*cm


If you want to re-express the magnitude in meters, you have to define the inverse unit:

(cm = 0.01*meter)
x // evaluates again as 8*meter



Specification of quantities in functions

It is possible to specify magnitudes also in functions, both in the arguments and in the result. Examples:
  1. If we have the function sine(r*radian), r must be a real number expressing an angle in radians. If we want to invoke the function with r in sexagesimal degrees, we would have to do:

    (degree = (π÷180)*radian)
    sine(r*degree)


  2. If we have the function atan(r)*radian, and we want the result in degrees, we would have to do:

    (radian = (180÷π)*degree)
    atan(r)*radian // the result is an angle in degrees.

Prefixes as universal converters

If we have the prefixes. and we do, for example, ⟨( Kilo*r = (10^3)*r )⟩, we are specifying an automatic conversion for all types of units, as long as the prefix takes the form Kilo*:

73*(Kilo*m) // ev. 73000*m
12*(Kilo*gr) // ev. 12000*gr


If we use the potential substitution ⟨( Kilo*r =: (10^3)*r )⟩, then.

73*(Kilo*m) // rep. 73000*m
12*(Kilo*gr) // rep. 12000*gr



Qualitative magnitudes

Qualitative magnitudes are magnitudes that constitute a quality or a totality, such as green, high, rich, slow, slow, true, and so on. These magnitudes can have a factor between 0 and 1, which indicates the degree of that quality. For example: 0.3*high, 0.6*large, etc.

There can also be opposite qualitative magnitudes, related by complementary factors. For example:
Remarks

Addendum

Units in programming languages

In general, programming languages do not include the possibility of specifying units associated with numerical values. One of the few languages that do support units is C/ATLAS [see Bibliography], but with limitations: there is only a predefined set of units and the combinations between them are restricted.

In any case, several proposals have been made to adapt various programming languages (Ada, Pascal, C++, Lisp, Standard ML, etc.) to contemplate units of measurement as data attributes [see Bibliography].

When a programming language does not contemplate units, their handling in functions and algorithms has to be done by the programmer, which is a potential source of errors. To avoid these errors, default units should not be assumed, i.e., they should be specified explicitly.

Karr and Loveman [1978] have proposed that units be incorporated into programming languages, but as reserved words, which is a limitation, a limitation that does not exist in MENTAL:
International system of units

It is based on seven fundamental (or primitive) units: meter (length), second (time), kilogram (mass), ampere (intensity of electric current), degree Kelvin (temperature), mole (amount of substance) and candela (luminous intensity). The rest of the units are derivatives, such as, 1 Julio = 1 Kgr*m2/seg2 [Anderson, 1989].


Bibliography