1 | initial version |

One way to do it is to use apply_map:

```
sage: x = var('x')
sage: h = Matrix(SR, [[x,2],[3*x+5,4]])
sage:
sage: h0 = h.apply_map(lambda i: i.coeff(x,0))
sage: h1 = h.apply_map(lambda i: i.coeff(x,1))
sage: h0
[0 2]
[5 4]
sage: h1
[1 0]
[3 0]
```

Or you could use one of the Matrix constructors:

```
sage: Matrix(2,2,lambda i,j: h[i,j].coeff(x,0))
[0 2]
[5 4]
sage: Matrix(2,2,lambda i,j: h[i,j].coeff(x,1))
[1 0]
[3 0]
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.