Function: mod (<x>, <y>) If <x> and <y> are real numbers and <y> is nonzero, return
<x> - <y> * floor(<x> / <y>). Further for all real <x>, we have
mod (<x>, 0) = <x>. For a discussion of the definition
mod (<x>, 0) = <x>, see Section 3.4, of "Concrete Mathematics," by Graham, Knuth, and Patashnik. The function
mod (<x>, 1) is a sawtooth function with period 1 with
mod (1, 1) = 0 and
mod (0, 1) = 0.
To find the principal argument (a number in the interval
(-%pi, %pi]) of a complex number, use the function
<x> |-> %pi - mod, where <x> is an argument.
(%pi - <x>, 2*%pi)
When <x> and <y> are constant expressions (
10 * %pi, for example),
mod uses the same big float evaluation scheme that
ceiling uses. Again, its possible, although unlikely, that
mod could return an erroneous value in such cases.
For nonnumerical arguments <x> or <y>,
mod knows several simplification rules:
(%i1) mod (x, 0); (%o1) x (%i2) mod (a*x, a*y); (%o2) a mod(x, y) (%i3) mod (0, x); (%o3) 0
There are also some inexact matches for
?? mod to see them.
(%o1) true (%i2)