Condensing variables of a matrix
I'm working with matrices such as
M = matrix([ [a, b, 0], [c, 0, d], [0, e, 0]])
where a, b, c, d, and e are variables. Then I loop through some numbers for each of a, b, c, d, and e, looking at the eigenvalues of the resulting matrix. $$ char(M) = x^3 - ax^2 - (bc + de)x + ade $$ So, I'm doing more work than necessary, and ideally, I'd reduce M down to
M = matrix([ [a, b, 0], [1, 0, d], [0, 1, 0]])
Is there a simple way of using Sage to do so?