Pulling the index of an entry of a matrix
Let $M$ be some matrix, then I am looking for how to find out which entries of $M$ make the statement M[i,j] == 25
true. Specifically, this is the code I'm using to generate the matrix, called deg
:
deg = matrix(ZZ, 15)
A = lambda i: WeylCharacterRing("A{0}".format(i), style = "coroots")
for i in range(1,15):
fw = A(i).fundamental_weights()
for j in range(1,len(fw)):
deg[i,j] = A(i)(fw[j]).degree()
print deg
It works great, but now instead of printing deg and finding the entries manually, I would like to be able to store which entries [i,j]
of deg
are equal to 25 in some list, and then print that list, which would ideally look something like:
list(tfentry)
{ (2,3), (4,4) }
etc.
Any tips on where to look or help files to examine?
Thanks very much.