ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 15 Mar 2017 18:06:18 -0500smith form, gaussian integershttp://ask.sagemath.org/question/36958/smith-form-gaussian-integers/ Hello there,
I would like to be able to compute smith normal forms for matrices with coefficients in some specific ring, to be choosen each time.
I am not able to properly creat a matrix in $\mathbb{Z}[\sqrt{-1}]$. For instance
`M=matrix([[2+I,0],[0,1]])` then
`M.change_ring(ZZ[I])`
Would lead to an error. On the ogher hand, `M=matrix([[2+I,0],[0,1]])` followed by `M.smith_form()` would lso lead to an error since this time my matrix has coefficients in `SR`, the symbolic ring, and the `normal_form()`is not implemented.
However,
`A = QQ['x']` #delcaring the ring
`M=matrix(A,[[x-1,0,1],[0,x-2,2],[0,0,x-3]])` # building the matrix
`M.smith_form()`# computing the normal form
Actually works.
Wed, 15 Mar 2017 15:27:39 -0500http://ask.sagemath.org/question/36958/smith-form-gaussian-integers/Answer by tmonteil for <p>Hello there,
I would like to be able to compute smith normal forms for matrices with coefficients in some specific ring, to be choosen each time.</p>
<p>I am not able to properly creat a matrix in $\mathbb{Z}[\sqrt{-1}]$. For instance </p>
<p><code>M=matrix([[2+I,0],[0,1]])</code> then
<code>M.change_ring(ZZ[I])</code></p>
<p>Would lead to an error. On the ogher hand, <code>M=matrix([[2+I,0],[0,1]])</code> followed by <code>M.smith_form()</code> would lso lead to an error since this time my matrix has coefficients in <code>SR</code>, the symbolic ring, and the <code>normal_form()</code>is not implemented.</p>
<p>However, </p>
<p><code>A = QQ['x']</code> #delcaring the ring</p>
<p><code>M=matrix(A,[[x-1,0,1],[0,x-2,2],[0,0,x-3]])</code> # building the matrix</p>
<p><code>M.smith_form()</code># computing the normal form</p>
<p>Actually works.</p>
http://ask.sagemath.org/question/36958/smith-form-gaussian-integers/?answer=36961#post-id-36961Indeed, when you write:
sage: M=matrix([[2+I,0],[0,1]])
The number `I` belongs to the symbolic ring, hence the matrix `M` is defined over the symbolic ring:
sage: M.parent()
Full MatrixSpace of 2 by 2 dense matrices over Symbolic Ring
You can chant this by redefining `I` to belong to the gaussian integers:
sage: R = ZZ[I] ; R
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
sage: I = R.basis()[1]
sage: M=matrix([[2+I,0],[0,1]])
sage: M.parent()
Full MatrixSpace of 2 by 2 dense matrices over Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
Then, you can ask for the Smith form:
sage: M.smith_form()
(
[ 1 0] [ 0 1] [ 1 -1]
[ 0 I + 2], [ -1 I + 2], [ 1 0]
)
Wed, 15 Mar 2017 18:06:18 -0500http://ask.sagemath.org/question/36958/smith-form-gaussian-integers/?answer=36961#post-id-36961