# [SciPy-user] any symbolic manipulation of eigenvalue in Scipy?

Emmanuelle Gouillart emmanuelle.gouillart@normalesup....
Tue Jun 9 12:08:38 CDT 2009

```Hi Xiaojian ,

you can use sympy, a very good Python module for symbolic mathematics

>>> from sympy import Symbol, Matrix

>>> a = Symbol('a')

>>> b = Symbol('b')

>>> c = Symbol('c')

>>> m = Matrix(([a, b, a*b], [a+b, 0, 0], [c, a, c+b]))

>>> m.det()
-a*b*c + a**2*b**2 - a*b**2 - c*b**2 - b**3 + b*a**3

>>> m.eigenvals()
[... long lines of symbols!!]

Check the sympy documentation on http://docs.sympy.org (and
http://docs.sympy.org/modules/matrices.html#linear-algebra of linear
algebra).

Cheers,

Emmanuelle

On Tue, Jun 09, 2009 at 09:35:45AM -0700, Xiaojian Wang wrote:
>    Hi,
>    I would like to know if there is any module in Scipy (or Numpy?),  which
>    has capability
>    of symbolic manipulation and can generate matrix's
>    eigenvalues/eigenvectors.
>    My matrix is symbolic, such as a 3x3 matrix:

>    [ a,     b,   a*b  ]
>    [a+b,  0,    0    ]
>    [c,     a,     c+b]

>    a,b,c could be any values in my future applications.
>    if not, do you guy know any other programs can do this?