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.Mon, 31 May 2021 20:59:56 +0200Finding centraliser algebras of a finite set of matriceshttps://ask.sagemath.org/question/57363/finding-centraliser-algebras-of-a-finite-set-of-matrices/Let $S$ be a finite set of $n \times n$-matrices over a field $K$ (lets say finite or the real or complex field).
Is it possible to obtain the $K$-algebra (or at least its vector space dimension) of $n \times n$-matrices X in Sage with $XY=YX$ for all $Y \in S$?
(I can only think of a way for doing this for finite field with very small $n$ by looking at all elements,but maybe there is a better technique in Sage)Sun, 30 May 2021 13:48:31 +0200https://ask.sagemath.org/question/57363/finding-centraliser-algebras-of-a-finite-set-of-matrices/Answer by mwageringel for <p>Let $S$ be a finite set of $n \times n$-matrices over a field $K$ (lets say finite or the real or complex field).</p>
<p>Is it possible to obtain the $K$-algebra (or at least its vector space dimension) of $n \times n$-matrices X in Sage with $XY=YX$ for all $Y \in S$?</p>
<p>(I can only think of a way for doing this for finite field with very small $n$ by looking at all elements,but maybe there is a better technique in Sage)</p>
https://ask.sagemath.org/question/57363/finding-centraliser-algebras-of-a-finite-set-of-matrices/?answer=57383#post-id-57383If your matrices have exact entries (for example in ℚ or a finite field), you can consider the polynomial ring $R = K[x_{i,j} | 0≤i,j\lt n]$ in $n×n$ variables, i.e. the variables $x_{i,j}$ represent entries of an arbitrary matrix $X$.
sage: K = QQ
sage: n = 3
sage: S = [matrix(K, [[0,2,0],[0,0,-1],[1,0,0]])]
sage: R = PolynomialRing(K, ['x_%d_%d' % (a, b) for a in range(n) for b in range(n)])
sage: X = matrix(R, n, R.gens()); X
[x_0_0 x_0_1 x_0_2]
[x_1_0 x_1_1 x_1_2]
[x_2_0 x_2_1 x_2_2]
The condition $X Y - Y X = 0$ (entrywise) imposes linear relations on the variables $x_{i,j}$. These form an ideal $J$.
sage: J = R.ideal(flatten([(X*Y-Y*X).list() for Y in S]))
sage: J.dimension()
3
As the ideal is generated by linear forms, this (Krull) dimension of the ideal should agree with the vector space dimension you are after (I think). It should agree with the length of
sage: J.normal_basis(1)
[x_2_2, x_2_1, x_2_0]
which gives the variables that parametrize $X$ modulo $J$. We can map $X$ to the quotient ring:
sage: Q = R.quotient(J)
sage: X.change_ring(Q)
[ x_2_2bar 2*x_2_0bar -x_2_1bar]
[-1/2*x_2_1bar x_2_2bar -x_2_0bar]
[ x_2_0bar x_2_1bar x_2_2bar]
The result indeed only depends on these three parameters. From there, you could construct e.g. a basis by substituting these three variables by elements from $K$.
Alternatively, to avoid $Q$ altogether, you can compute $X$ modulo $J$ like this:
sage: X.apply_map(J.reduce)
[ x_2_2 2*x_2_0 -x_2_1]
[-1/2*x_2_1 x_2_2 -x_2_0]
[ x_2_0 x_2_1 x_2_2]Mon, 31 May 2021 20:59:56 +0200https://ask.sagemath.org/question/57363/finding-centraliser-algebras-of-a-finite-set-of-matrices/?answer=57383#post-id-57383