Hello,
I try to enumerate all the matrices
[[ a, b, 15-a-b],
[ c, d, 15-c-d],
[15-a-c, 15-b-d, 15-a-d]] with (a,b,c,d) in 1..9.
in fact (a, d) are members of 2..8,
and (b, c) are in 1..9.
It's the first question of an exercice which try to find
the magic matrix with the same sum in all directions.
With axiom I only find this multi-line command :
L := reduce
(append,
[reduce
(append,
[reduce
(append,
[[matrix [[a,b,15-a-b],[c,d,15-c-d],[15-a-c,15-b-d,15-a-d]]
for a in 1..9] for b in 1..9]) for c in 1..9]) for d in 1..9]) ;
a train of for creates only one zip-list.
[[i,j]for i in 1..5 for j in 1000..2000] create the short list
[[1,1000],[2,1001],[3,1002],[4,1003],[5,1004]].
The syntax of mupad/maple is shorter with the operator $
L := [matrix [[a,b,15-a-b],[c,d,15-c-d],[15-a-c,15-b-d,15-a-d]]
$for a in 1..9 $for b in 1..9 $for c in 1..9 $for d in 1..9] :
Maple needs quote ":" in order to restain the evaluation.
L := ['''matrix [[a,b,15-a-b],[c,d,15-c-d],[15-a-c,15-b-d,15-a-d]]
$for a in 1..9' $for b in 1..9' $for c in 1..9' $for d in 1..9] :
Is there an other way with axiom ?
Francois
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer