On Mon, 2021-08-02 at 05:14 -0700, 'Martin R' via sage-devel wrote: > is currently rather awkward: > > > sage: M = MatrixSpace(QQ, 2) > sage: L.<x> = PolynomialRing(M) > sage: 1-x > ([-1 0] > [ 0 -1])*x + [1 0] > [0 1] > > Is there a cure? >
This also happens with CombinatorialFreeModule, where you have the ability to reference the generators with an arbitrary(ish) index rather than by number. If you use matrices as the index, though, then linear combinations print as above. I've no idea how to solve it of course. There's no good syntax for writing matrices inline, and it's preferable that the printed output be copy/pasteable back into the REPL. My solution is to force the use of natural numbers as the indices, and then perform the mapping to/from matrices myself. That may actually work for you, too, if you use a CFM instead of MatrixSpace(QQ, 2). It's pretty easy to implement product_on_basis() for the space of matrices, but there are some dark corners where MatrixSpace diverges from the rest of the Sage universe, so it depends on what you want to do with the result. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/bdf65f7301b08d9f96c4b164349b34bc558b7c89.camel%40orlitzky.com.