ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 21 May 2013 12:18:11 +0200Pulling the index of an entry of a matrixhttps://ask.sagemath.org/question/10144/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.
JoshIzzardTue, 21 May 2013 12:18:11 +0200https://ask.sagemath.org/question/10144/Matrix of vectorshttps://ask.sagemath.org/question/10008/matrix-of-vectors/Hi.
Suppose that I have a collection of vectors $v_1, \ldots, v_n \in \mathbb{R}^3$ and I wish to compute all cross products $v_i \times v_j \in \mathbb{R}^3$ where $1 \leq i < j \leq n$. Is it possible to store the output in a matrix, i.e. can I form a matrix M in Sage where $M(i,j) = v_i \times v_j$?DG44Wed, 10 Apr 2013 08:04:16 +0200https://ask.sagemath.org/question/10008/Selecting matrices with only certain entrieshttps://ask.sagemath.org/question/9727/selecting-matrices-with-only-certain-entries/Hi all -
a slightly more general but less ambitious version of my previous (as yet unanswered) question:
http://ask.sagemath.org/question/2114/unitary-matrices-over-finite-fields
I set up a matrix space M (for simplicity say over a finite field F) and I have a (finite) subset S of F. I need to do a search through the elements of M which satisfy certain algebraic constraints; however I only wish to study matrices whose entries ALL lie in S.
How please do I restrict to such matrices?
Many thanks in advanceGaryMakMon, 21 Jan 2013 16:00:53 +0100https://ask.sagemath.org/question/9727/