1 | initial version |

There is no implementation for substituting a matrix into a symbolic expression, because the operation is not well-defined in general. (For example, what should happen when you substitute a matrix into `exp(-1/t)`

?)

Of course it is well-defined for polynomials. This substitution *is* implemented, but only for polynomials as members of a polynomial ring (rather than symbolic expressions), so you have to do a conversion:

```
sage: t2.polynomial(QQ).subs(t=I4)
[16 0 0 0 0]
[ 0 16 0 0 0]
[ 0 0 16 0 0]
[ 0 0 0 16 0]
[ 0 0 0 0 16]
```

It is easier (in life in general) to avoid symbolic expressions altogether, and to define `t`

as a generator of a polynomial ring (instead of a symbolic variable), so that substitutions into polynomials in `t`

work immediately:

```
sage: t = polygen(QQ, name='t')
sage: t^2
t^2
sage: (t^2).subs(t=I4)
[16 0 0 0 0]
[ 0 16 0 0 0]
[ 0 0 16 0 0]
[ 0 0 0 16 0]
[ 0 0 0 0 16]
```

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.