I would like to creat a list of matrices from the following rules:
1- All matrices of the list have diagonal equal to zero.
2- The first matrix have 2x2 dimension, startmatrix={{0,1},{0,0}}
3- The next matrix have 3x3 dimensions and the submatrix have same elements of the matrix write in step 2; the other elements are Random Integers [1,3 -1]; 3 = dimension of the matrix in the step;
4- The next matrix have dimension 4x4; repeat the same elements of the step 3 and other elements is Random Integer [1,4-1]; 4= dimension of the matrix in the step;
For instance: look the figure below
I thought in the code below, but it not repeat the elements of previous matrix
nmax = 15 ;(*number of matrices*)
startMatrix = {{0, 1}, {0, 0}} ;(*The matrix begin*)
d = 2;(*Dimension of the first matrix*)
f[i_, j_] :=
If[i <= d && j <= d, startMatrix[[i, j]],
If[j > i, RandomInteger[{1, j - d}], RandomInteger[{1, i - d}]]](*The rule for to create the matrices*)
m1 = Table[
SparseArray[{{i_, i_} -> 0, {i_, j_} -> f[i, j]}, {n, n}], {n, d,
nmax}](*Obtain the list of matrices*)
Table[MatrixForm[m1[[i]]], {i, nmax - 1}] (*Show the matrix form of the all matrices of the list*)
Please, anybody help me?