Mod, ?mod and matrices



-----maxima-bounces at math.utexas.edu wrote: -----

>To: "maxima list" <maxima at math.utexas.edu>
>From: "Alasdair McAndrew" <amca01 at gmail.com>

>I have a little annoyance with the mod
>function.  As you know mod(x,p):
>
>      is defined as an integer <k> in
>
>     `[-(-1)/2, ..., 0, ..., (-1)/2]' when
><p> is odd, or
>
>     `[-(/2 - 1), ..., 0, ...., /2]' when
><p> is even, such that

This is no longer the case (starting with maybe version 5.9.3 or so):

 -- 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.

To apply mod to each element of a matrix, you'll still need to use
matrixmap
and a lambda form. Doing mod(matrix([...]),10) makes a mess...

Barton