Contents Previous Next Subchapters

Undo The Modulo Function
Syntax r = colunmod(xy)
r = colunmod(xyb)
See Also mod , unwrap

Description
Returns a matrix r with the same dimensions as x that satisfies the following properties:
     ( r     - x   ) / y 
        i,j     i,j
is equal to an integer and
     | r       -  r   |  < y
        i+1,j      i,j
furthermore
     if x       -  x    > +b   then r      -  r     < 0
         i+1,j      i,j             i+1,j     i,j

     if x       -  x    < -b   then r      -  r     > 0
         i+1,j      i,j              i+1,j     i,j
The arguments y and b are scalars and both greater than zero. The arguments x, y and b are integer, real, or double-precision. The return value r has the type that results from coercion between the types of the arguments x and y.

If the argument b is not present, the value y / 2 is used in its place. If y is an integer, and it is not even, the corresponding type of b is real. Otherwise the corresponding type for b is the same as the type of y.

Example
If you enter
     x = 2 * seq(5)
     y = 2 * PI
     x = mod(x, y)
     x = colunmod(x, y) 
     print x
O-Matrix will respond
     {
     2
     4
     6
     8
     10
     }