Formal determinant of symbolic matrix
I have some sparse symbolic matrices, and want to compute their formal determinant (without cancellation of terms). In other words, if I have the matrix
x,y = var('x,y')
M = Matrix(SR, [[x,y],[x,y]])
I would like the result of
M.determinant()
to be xy - xy, rather than just 0. The variables in each monomial are allowed to commute with each other, but on the other hand I would like all monomials containing a 0 to vanish (i.e if in the example above M = Matrix(SR, [[x,0],[x,y]])), then the determinant should be just xy, rather than xy - 0*x). Is there a way to achieve this (without using the expansion of the determinant as permutations, since the dimension of the matrices gets quite big!)? Thanks in advance!
You might be interested by this tutorial : the quaternions are a good example of a non-commutative ring. Matrices of such elements would have the properties you seek.
You may find inspiration in this free textbook and its Sagemath supplement...
Also, ISTR that Maxima allows you to define non-commutating sets of variables ; however, I have ni way to dive in its doc now, and I can't remember if it allows to define matrices of such elements...
the properties asked do not seem to be related to the non-commutativity of variables if I guess correctly
DanieleC : I agree. I misread/misunderstood the whishes of the anonymous OP. I'm not sure it makes sense...
the question seems something like: how many nonzero terms are there in the determinant, if we don't allow for cancellations?
I do not know how suitable this is for your needs, but my idea here would be to use several distinct variables
x1, x2, ...
.