Go forward to Error Forms.
Go backward to Date Forms.
Go up to Data Types.
Modulo Forms
============
A "modulo form" is a real number which is taken modulo (i.e., within
an integer multiple of) some value `M'. Arithmetic modulo `M' often
arises in number theory. Modulo forms are written `a mod M', where
`a' and `M' are real numbers or HMS forms, and `0 <= a < M'. In many
applications `a' and `M' will be integers but this is not required.
Modulo forms are not to be confused with the modulo operator `%'. The
expression `27 % 10' means to compute 27 modulo 10 to produce the
result 7. Further computations treat this 7 as just a regular
integer. The expression `27 mod 10' produces the result `7 mod 10';
further computations with this value are again reduced modulo 10 so
that the result always lies in the desired range.
When two modulo forms with identical `M''s are added or multiplied,
the Calculator simply adds or multiplies the values, then reduces
modulo `M'. If one argument is a modulo form and the other a plain
number, the plain number is treated like a compatible modulo form. It
is also possible to raise modulo forms to powers; the result is the
value raised to the power, then reduced modulo `M'. (When all values
involved are integers, this calculation is done much more efficiently
than actually computing the power and then reducing.)
Two modulo forms `a mod M' and `b mod M' can be divided if `a', `b',
and `M' are all integers. The result is the modulo form which, when
multiplied by `b mod M', produces `a mod M'. If there is no solution
to this equation (which can happen only when `M' is non-prime), or if
any of the arguments are non-integers, the division is left in
symbolic form. Other operations, such as square roots, are not yet
supported for modulo forms. (Note that, although `(a mod M)^.5' will
compute a "modulo square root" in the sense of reducing `sqrt(a)'
modulo `M', this is not a useful definition from the
number-theoretical point of view.)
To create a modulo form during numeric entry, press the shift-`M' key
to enter the word `mod'. As a special convenience, pressing shift-`M'
a second time automatically enters the value of `M' that was most
recently used before. During algebraic entry, either type `mod' by
hand or press `M-m' (that's `META-m'). Once again, pressing this a
second time enters the current modulo.
You can also use `v p' and `%' to modify modulo forms.
See Building Vectors. See Basic Arithmetic.
It is possible to mix HMS forms and modulo forms. For example, an HMS
form modulo 24 could be used to manipulate clock times; an HMS form
modulo 360 would be suitable for angles. Making the modulo `M'
also be an HMS form eliminates troubles that would arise if the
angular mode were inadvertently set to Radians, in which case
`2@ 0' 0" mod 24' would be interpreted as two degrees modulo
24 radians!
Modulo forms cannot have variables or formulas for components. If you
enter the formula `(x + 2) mod 5', Calc propagates the modulus to each
of the coefficients: `(1 mod 5) x + (2 mod 5)'.
The algebraic function `makemod(a, m)' builds the modulo form
`a mod m'.