Rolling up some integers
Wouter Meeussen
wouter.meeussen at pandora.be
Sun Mar 24 10:39:32 CET 2002
on comp.soft-sys.math.mathematica (Wed, 20 Mar 2002) Diamond Mark. R. asked
for a nice way to generate matrices 'along the diagonals", of the form
1 3 6 10
2 5 9 13
4 8 12 15
7 11 14 16
Ken Levasseur replied with an elegant permutation technique that can be
thrown into the following one-liner:
flatindex[n_]:=Ordering[Sort[Flatten[Outer[List,Range[n],Range[n]],1]//Rever
se,Plus@@#1<=Plus@@#2&]/. {i_Integer,j_}->n(i-1)+j]
this permutation, for argument n=4 gives the matrix row-by-row:
{1, 3, 6, 10, 2, 5, 9, 13, 4, 8, 12, 15, 7, 11, 14, 16}
Surprisingly,
the determinants of these matrices are given by four second degree
equations:
if n=1 mod 4, then 5-12n+8n^2 ;
if n=2 mod 4, then 0+ 2n-4n^2 ;
if n=3 mod 4, then -1+ 4n-8n^2 ;
if n=0 mod 4, then 0+ 2n+4n^2 ;
or, in Mathematica lingo:
Table[{5-12n+8n^2, 0+2n-4n^2 ,-1+4n-8n^2,0+2n+4n^2},{n,25}]==
Table[Det at Partition[ flatindex[n] ,n],{n,100}]
Where does the modularity come from???
Wouter Meeussen
wouter.meeussen at pandora.be
More information about the SeqFan
mailing list