Simple question: modulo



Am Sonntag, 27. Januar 2008 schrieb Alasdair McAndrew:
> "mod" is the modulo function.  If you want to apply mod 26 to a matrix m,
> use matrixmap:
>
> matrixmap(lambda([x],mod(x,26)),m);
>
> If you don't like the lambda construction you can always create a little
> function first:
>
> mod26(x):=mod(x,26);
> matrixmap(mod26,m);
>
> Hope this helps,
> Alasdair

(%i21) m: matrix( [15,2,7],  [8,10,23],  [0,2,8]);

(%i22) matrixmap(lambda([x],mod(x,26)),[12,0,8]*m);
(%o22) matrix([24,24,6],[0,0,0],[0,16,12])

Perfect! Why didn't mod(x,y) work, when I tried it? Must have make some simple 
mistakes I can't remember. The lambda construction would have been beyond my 
very basic maxima-skills anyway. But I understand the principle now. 

Thanks, Alasdair.

Hanno
-- 
Hanno Behrens - Hamburg http://pebbles.schattenlauf.de/
Ceterum censeo microsoft esse delendam