Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get the coefficient of $x^n$ in symbolic expression of matrix

I have the symbolic matrix:

x = var('x')
h = Matrix(SR, [[x,2],[3*x+5,4]])

How can I get the coefficients of $x^n$ in symbolic expression of matrix. I need to get the follow two matrix from that one:

[[1,0],[3,0]]
[[0,2],[5,4]]