dear all, I've some problems with numpy.roots. take a look at the following code:
======================================== import numpy OK = numpy.roots([1, 1, 1]) OK = numpy.roots([1j, 1]) KO = numpy.roots([1, 1j, 1]) ======================================== it fails with this error message, trying to execute the last line: TypeError: can't convert complex to float; use abs(z)/usr/lib/python2.4/site-packages/numpy/lib/polynomial.py in roots(p) 119 if N > 1: 120 # build companion matrix and find its eigenvalues (the roots) --> 121 A = diag(NX.ones((N-2,), p.dtype), -1) 122 A[0, :] = -p[1:] / p[0] 123 roots = _eigvals(A) /usr/lib/python2.4/site-packages/numpy/lib/twodim_base.py in diag(v, k) 66 i = arange(0,n+k) 67 fi = i+(i-k)*n ---> 68 res.flat[fi] = v 69 return res 70 elif len(s)==2: TypeError: can't convert complex to float; use abs(z) any ideas? thanks, Lorenzo
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion