[SciPy-user] Characteristic polynomial

Bryan Van de Ven bryanv at enthought.com
Tue Dec 11 10:37:37 EST 2007


In [16]: numpy.lib.poly?
Type:           function
Base Class:     <type 'function'>
String Form:    <function poly at 0xb7a66224>
Namespace:      Interactive
File: 
/workspace/python2.5/lib/python2.5/site-packages/numpy/lib/polynomial.py
Definition:     numpy.lib.poly(seq_of_zeros)
Docstring:
     Return a sequence representing a polynomial given a sequence of roots.

     If the input is a matrix, return the characteristic polynomial.

     Example:

         >>> b = roots([1,3,1,5,6])
         >>> poly(b)
         array([ 1.,  3.,  1.,  5.,  6.])


In [17]: a = array([[1,0],[0,2]])

In [18]: coeffs = numpy.lib.poly(a)

In [19]: numpy.lib.poly1d(coeffs)
Out[19]: poly1d([ 1., -3.,  2.])




Nikolas Karalis wrote:
> Hello... I'm trying to compute the characteristic polynomial of an 
> integer (numpy) matrix. But i cannot find any way of doing this.
> Do you have any ideas/suggestions?
> 
> -- 
> Nikolas Karalis
> Applied Mathematics and Physics Undergraduate
> National Technical University of Athens, Greece
> http://users.ntua.gr/ge04042
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list