- #1
IBeBananaMan
- 2
- 0
Hello.
I'm trying to consider a matrix A and looking at Ak and (Ak)TAk, where T is the usual transpose.
This is no big deal. But I'd rather not look at them one at a time--I want to consider some powers k from 1 through as high as I want them. When I try
it gives me this giant matrix of each matrix I want, sure, but the matrices are all broken up into column vectors. How can I fix this so I can get a good table of separated matrices (changing MatrixForm to TableForm gives me the view I want, but the matrix brackets are gone so it's just a generic tableau).
Now that's the first issue. My next issue is I would like to take every nonzero element in each matrix and turn it into the value 1.
For just one matrix, I have this
Which gives me what I want (the matrix Ak will have nonnegative integers for what I'm dealing with, so I can just look for the 0s of my Ak and force every other element = 1). But I'd like to incorporate that into my table of all matrices so I can compute this for all powers simultaneously (it doesn't matter if, say, Ak's values are 0s and 1s and then the next Ak+1 is computed from the modified Ak instead of from the original Ak).
Finally, I'd like to turn all these into adjacency graphs and thus see how the adjacency graph changes with each power. From the above, I simply do
to create the matrix from the values of the for loop and then finally
to see the adjacency graph, and obviously this only works for one matrix power at a time.
Any help would be appreciated. And if there is a better way of dealing with this (I just assume I HAVE to convert my nonzero values to 1 for Mathematica to spit out any adjacency matrix), that would be appreciated.
For reference, I'm looking at Wielandt matrices of order n (which I fix, and I will look at one order at a time), and I'm trying to look at the pattern of the adjacency graphs for finding minimal scrambling and regularity indices (which are the exponents k).
Thanks!
I'm trying to consider a matrix A and looking at Ak and (Ak)TAk, where T is the usual transpose.
This is no big deal. But I'd rather not look at them one at a time--I want to consider some powers k from 1 through as high as I want them. When I try
Code:
Table[MatrixPower[A, k],{k,5}]//MatrixForm
it gives me this giant matrix of each matrix I want, sure, but the matrices are all broken up into column vectors. How can I fix this so I can get a good table of separated matrices (changing MatrixForm to TableForm gives me the view I want, but the matrix brackets are gone so it's just a generic tableau).
Now that's the first issue. My next issue is I would like to take every nonzero element in each matrix and turn it into the value 1.
For just one matrix, I have this
Code:
For[i = 1, i < n + 1, i++,
For[j = 1, j < n + 1, j++,
If[MatrixPower[A, k][[i, j]] == 0, AAl[i, j] := 0,
AAl[i, j] := 1]]];
Which gives me what I want (the matrix Ak will have nonnegative integers for what I'm dealing with, so I can just look for the 0s of my Ak and force every other element = 1). But I'd like to incorporate that into my table of all matrices so I can compute this for all powers simultaneously (it doesn't matter if, say, Ak's values are 0s and 1s and then the next Ak+1 is computed from the modified Ak instead of from the original Ak).
Finally, I'd like to turn all these into adjacency graphs and thus see how the adjacency graph changes with each power. From the above, I simply do
Code:
AA := Table[AAl[i, j], {i, n}, {j, n}];
to create the matrix from the values of the for loop and then finally
Code:
AdjacencyGraph[AA, VertexLabels -> "Name", ImagePadding -> 10]
to see the adjacency graph, and obviously this only works for one matrix power at a time.
Any help would be appreciated. And if there is a better way of dealing with this (I just assume I HAVE to convert my nonzero values to 1 for Mathematica to spit out any adjacency matrix), that would be appreciated.
For reference, I'm looking at Wielandt matrices of order n (which I fix, and I will look at one order at a time), and I'm trying to look at the pattern of the adjacency graphs for finding minimal scrambling and regularity indices (which are the exponents k).
Thanks!