I want to create a list of matrices from the following rules:
All matrices of the list have diagonal equal to zero.
The first element of the list is a 2x2 matrix, having elements are given by
S2 = SparseArray[{{1, 2} -> 1, {2, 1} -> 0}]
The matrix is
{{0, 1}, {0, 0}}
;The next element of the list is a 3x3 matrix. The elements in this matrix are taken from the elements of
S2
with the addition ofSubscript[A, 1, 3]
,Subscript[A, 2, 3]
,Subscript[A, 3, 1]
andSubscript[A, 3, 2]
.The matrix is given by
S3 = {{0, 1, Subscript[A, 1, 3]}, {0, 0, Subscript[A, 3, 3]}, {Subscript[A, 3, 1], Subscript[A, 3, 2],0}}
The third element of the list is a 4x4 matrix called
S4
. The elements ofS4
are those fromS3
with additional elementsSubscript[B, 1, 4]
,Subscript[B, 2, 4]
,Subscript[B, 3, 4]
,Subscript[B, 4, 1]
,Subscript[B, 4, 2]
,Subscript[B, 3, 3]
. The matrix is given byS4 = {{0, 1, Subscript[A, 1, 3], Subscript[B, 1, 4]}, {0, 0, Subscript[A, 2, 3], Subscript[B, 2, 4]}, {Subscript[A, 3, 1], Subscript[A, 3, 2], 0, Subscript[B, 3, 4]}, {Subscript[B, 4, 1], Subscript[B, 4, 2], Subscript[B, 4, 3], 0}}`
and so on ....
I would like to use this process to build a list of 25 elements, corresponding the letters A – Z. I am thinking along the lines of
Table[SparseArray[{{i_, i_} -> 0, {i_, j_} -> f[i, j]}, {n, n}], {n, 25}],
but I have not found a function f[i, j]
that does what I want.
Please, somebody help me.
ArrayRules[SparseArray[yourMatrix]]
to discover the rules? $\endgroup$C
,D
,E
,I
,K
and so on $\endgroup$