Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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!