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.Fri, 26 May 2017 18:36:05 +0200Matrix conjugacy classes over Z and ideal classeshttps://ask.sagemath.org/question/8244/matrix-conjugacy-classes-over-z-and-ideal-classes/I had a couple questions; the first involves matrix conjugacy classes over the integers and the second involves integral bases. I'm not sure what the algorithms in Sage are for the following procedures.
1) Is it possible to determine if two integer-valued square matrices (which are conjugate over Q) are also conjugate over Z?
2) In a number field K, given an ideal class I, we can find an integral basis for a representative ideal in I by the command:
sage: I.integral_basis()
Is it possible to work in the reverse direction, that is given a set of elements in K which form an integral basis, is it possible to find the corresponding ideal and ideal class for that integral basis?
Thanks in advance for any advice.Thu, 28 Jul 2011 21:14:45 +0200https://ask.sagemath.org/question/8244/matrix-conjugacy-classes-over-z-and-ideal-classes/Answer by dan_fulea for <p>I had a couple questions; the first involves matrix conjugacy classes over the integers and the second involves integral bases. I'm not sure what the algorithms in Sage are for the following procedures.</p>
<p>1) Is it possible to determine if two integer-valued square matrices (which are conjugate over Q) are also conjugate over Z?</p>
<p>2) In a number field K, given an ideal class I, we can find an integral basis for a representative ideal in I by the command:</p>
<p>sage: I.integral_basis() </p>
<p>Is it possible to work in the reverse direction, that is given a set of elements in K which form an integral basis, is it possible to find the corresponding ideal and ideal class for that integral basis?</p>
<p>Thanks in advance for any advice.</p>
https://ask.sagemath.org/question/8244/matrix-conjugacy-classes-over-z-and-ideal-classes/?answer=37705#post-id-37705(1) Let me add some notation to the question. (To see if i get it right.)
Let $A,B$ be two square matrices of shape $n\times n$, $n>0$ natural number, $A,B\in M_{n}(\mathbb Z)$.
We know there is an invertible matrix $S\in M_{n}(\mathbb Q)$ with:
$$ A = SBS^{-1}\ . $$
The question is - if i am interpreting it right - if we can do the above with $S$ even in $M_{n}(\mathbb Z)$.
Yes, if $S$ has entries with denominators, build the common denominator (lcm of all denominators of the entries) $d$ and use $dS$ instead of $S$.
(2) Let us fix ideas and use a specific number field $K$:
sage: K.<a> = QuadraticField( -46 )
sage: ClK = K.class_group()
sage: ClK
Class group of order 4 with structure C4 of Number Field in a with defining polynomial x^2 + 46
sage: for c in ClK:
....: print c
....:
Trivial principal fractional ideal class
Fractional ideal class (5, a + 3)
Fractional ideal class (2, a)
Fractional ideal class (5, a + 2)
sage: c = ClK[3]
sage: c
Fractional ideal class (5, a + 2)
sage: c.ideal()
Fractional ideal (5, a + 2)
sage: c.ideal().integral_basis()
[5, a + 2]
(From the class $c$, we have to go first to its ideal, `c.ideal()`, first, then we can apply the method integral_basis.)
Conversely, let us suppose we have the above two elements $5$, and $a+2$, and want to associate (in the given setting):
- the ideal $J$ in $\mathcal O_K$ generated by these two elements, and
- the ideal class in the class group, which is $J$ modulo principal ideals.
Now i am finally in position to answer (by sample code) the question:
sage: J = K.ideal( [5, a+2] )
sage: J == c.ideal()
True
sage: ClK(J)
Fractional ideal class (5, a + 2)
sage: ClK(J) == c
True
In words, the constructor to be applied on the list is `K.ideal`.
We have got a (fractional) ideal in (the ring of integers of) $K$, called `J`. (Ideals and fractional ideals are sometimes hard to separate in sage.) In order to pass with it modulo principal ideals, we simply convert it via `ClK( J )` to an object in`ClK`.
So far, things are coherent in a natural way. To break slightly the perfect picture, note that...
sage: J
Fractional ideal (5, a + 2)
sage: J.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 46
sage: c.parent()
Class group of order 4 with structure C4 of Number Field in a with defining polynomial x^2 + 46
sage: J == c
True
(The true boolean eval of `J == c` is maybe unexpected.)
Note: The above also works in more complicated number fields. For instance:
sage: R.<x> = PolynomialRing(QQ)
sage: K.<a> = NumberField( x^3 - x - 2017 )
sage: a.minpoly()
x^3 - x - 2017
sage: ClK = K.class_group()
sage: ClK
Class group of order 6 with structure C6 of Number Field in a with defining polynomial x^3 - x - 2017
sage: c = ClK.list()[-1]
sage: c.order()
6
sage: c
Fractional ideal class (119, a + 9)
sage: J = K.ideal( [ 119, a+9 ] )
sage: J == c.ideal()
True
sage: ClK(J) == c
True
sage: J*J
Fractional ideal (14161, a + 2865)
sage: c*c
Fractional ideal class (103, a - 33)
sage: J == c
True
sage: c.parent()
Class group of order 6 with structure C6 of Number Field in a with defining polynomial x^3 - x - 2017
sage: J.parent()
Monoid of ideals of Number Field in a with defining polynomial x^3 - x - 2017
sage: J^6
Fractional ideal (2839760855281, a - 688711041646)
sage: c^6
Trivial principal fractional ideal class
sage: ClK( J^6 )
Trivial principal fractional ideal class
sage: J^6 == c^6
False
So care should be taken, e.g. $J^6$ is not $c^6$, although...
Fri, 26 May 2017 18:36:05 +0200https://ask.sagemath.org/question/8244/matrix-conjugacy-classes-over-z-and-ideal-classes/?answer=37705#post-id-37705