2015-12-23 14:27:45 +0200 received badge ● Taxonomist 2012-04-11 15:49:47 +0200 commented answer Using polynomial over matrices Thanks ! That was quite tricky... 2012-04-11 15:49:18 +0200 marked best answer Using polynomial over matrices The problem is just with printing elements of the ring; the function is_atomic_repr is just used to determine whether or not to write parentheses around the coefficients of a polynomial (e.g. the elements of ZZ are atomic, but elements of a polynomial ring are not). Matrix_space doesn't have one, but you can give it one easily: sage: A = MatrixSpace(QQ, 2) sage: PA. = PolynomialRing(A) sage: def iar(): ... return True ... sage: A.is_atomic_repr = iar sage: x [1 0] [0 1]*x  Note that things will still print in silly ways, because matrices always print a linebreak after printing the top row: sage: f = PA.random_element() sage: f [ 1 1] [-1/2 0]*x^2 + [1/2 1/2] [ 0 -2]*x + [-1/2 0] [ -1 0] sage: f[0] [-1/2 0] [ -1 0] sage: f[1] [1/2 1/2] [ 0 -2]  You can still work with polynomials and print their coefficients without defining is_atomic_repr: sage: B = MatrixSpace(ZZ, 2) sage: PB. = PolynomialRing(B) sage: f = x - 1 sage: (f^2).coeffs() [ [1 0] [-2 0] [1 0] [0 1], [ 0 -2], [0 1] ] sage: (f^2+1).dict() {0: [2 0] [0 2], 1: [-2 0] [ 0 -2], 2: [1 0] [0 1]} sage: ((x^2 + 1)^2).padded_list() [ [1 0] [0 0] [2 0] [0 0] [1 0] [0 1], [0 0], [0 2], [0 0], [0 1] ] sage: ((f^2 - f)^3)[0] [8 0] [0 8] sage: ((f^2 - f)^3)[4] [33 0] [ 0 33]  2012-04-11 15:49:18 +0200 received badge ● Scholar (source) 2012-04-11 15:49:17 +0200 received badge ● Supporter (source) 2012-04-11 15:00:09 +0200 received badge ● Student (source) 2012-04-11 14:05:12 +0200 asked a question Using polynomial over matrices Things goes wrong when I try to define polynomial ring over a matrix algebra. When I type A = MatrixSpace(QQ, 2) PA. = PolynomialRing(A) x  I obtain the following error : AttributeError: 'MatrixSpace_generic' object has no attribute 'is_atomic_repr'  Of course, I could use matrices over polynomial rings, but I would loss generality of the code... Do you have any idea ?