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.Sun, 12 Oct 2014 08:09:43 +0200How can I get an invertible matrix X with integral entries and AX=XB, where A and B are matrices with integral entries.https://ask.sagemath.org/question/24467/how-can-i-get-an-invertible-matrix-x-with-integral-entries-and-axxb-where-a-and-b-are-matrices-with-integral-entries/Let M be the set of all n by n matrices with integral entries.
For A and B in M, how can I get an invertible matrix X in M with AX=XB in Sage.
I can partially solve that problem in GAP following method.
- V={ X in Mn(QQ) | AX=XB }
(V is a vector space over QQ)
- Basis(V)={B_1,B_2, ..., B_k}
(I wonder which number k it is according to the changes of A and B.)
- Make X=a_1 * B_1 + ... +a_k * B_k , a_i in some interval in ZZ.
- Check two things which are X in Mn(ZZ) and the existence of the inverse of X in Mn(ZZ).
I can find such X for some easy matrices A,B.
How can I solve this problem in Sage?
Thanks.SeminSun, 12 Oct 2014 08:09:43 +0200https://ask.sagemath.org/question/24467/Can I define an n-dimensional matrix?https://ask.sagemath.org/question/10244/can-i-define-an-n-dimensional-matrix/I'm sure this is a basic question that has been asked before but I'm too stupid to find it.
What I'd like to do is something like this
k=var('n')
assume(n, 'integer')
assume(n>0)
VS = MatrixSpace(SR, n, 1)
to get the space of all *n*×1 matrices, i.e. column vectors. Is it at all possible to define a generalized *n*-dimensional vector or *n×n* matrix? Or am I just taking the completely wrong approach here?
**Edit:** Forgot to mention that the error I get is
ValueError: cannot convert n to int
mudd1Sat, 15 Jun 2013 15:52:18 +0200https://ask.sagemath.org/question/10244/