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.Wed, 31 Aug 2016 10:13:54 +0200Checking conjugacy of two matriceshttps://ask.sagemath.org/question/34663/checking-conjugacy-of-two-matrices/1. I want to check whether or not two matrices are conjugate. I need to check conjugacy for two matrices in $SL(2,\mathbb{Z})$. How to do it ?
How to do it for any general ring or field ? (Notice that I just want to verify whether two given matrices are conjugate or not, I don't need the actual matrices; meaning that say $X$ and $Y$ are conjugates and $AXA^{-1}=Y$. I just want to know if or not $X$ and $Y$ are conjugates, I don't need the matrix $A$)
2. Extending the previous question, say $AXA^{-1}=Y$. Then we can solve the system of linear equations $AX=YA$ to find out $A$. But is there any command which can directly find $A$ ?Wed, 31 Aug 2016 09:35:21 +0200https://ask.sagemath.org/question/34663/checking-conjugacy-of-two-matrices/Answer by tmonteil for <ol>
<li><p>I want to check whether or not two matrices are conjugate. I need to check conjugacy for two matrices in $SL(2,\mathbb{Z})$. How to do it ?
How to do it for any general ring or field ? (Notice that I just want to verify whether two given matrices are conjugate or not, I don't need the actual matrices; meaning that say $X$ and $Y$ are conjugates and $AXA^{-1}=Y$. I just want to know if or not $X$ and $Y$ are conjugates, I don't need the matrix $A$)</p></li>
<li><p>Extending the previous question, say $AXA^{-1}=Y$. Then we can solve the system of linear equations $AX=YA$ to find out $A$. But is there any command which can directly find $A$ ?</p></li>
</ol>
https://ask.sagemath.org/question/34663/checking-conjugacy-of-two-matrices/?answer=34664#post-id-34664 1. You can look at the `is_similar` method for matrices, see [this page](http://doc.sagemath.org/html/en/reference/matrices/sage/matrix/matrix2.html#sage.matrix.matrix2.Matrix.is_similar) for the documentation and examples.
2. You can get the transformation matrix `A` by setting the `transformation` parameter to `True`. Note that, since you are working with integer matrices, the transformation matrix will be in the algebraic field `QQbar`, you can get it back to `ZZ` as follows:
sage: A = X.is_similar(Y, transformation=True)[1].change_ring(ZZ)
Wed, 31 Aug 2016 10:13:54 +0200https://ask.sagemath.org/question/34663/checking-conjugacy-of-two-matrices/?answer=34664#post-id-34664