Return the roots of a polynomial with coefficients given in p.
The values in the rank-1 array p are coefficients of a polynomial. If the length of p is n+1 then the polynomial is described by:
p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]
Parameters : | p : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError : :
|
See also
Notes
The algorithm relies on computing the eigenvalues of the companion matrix [R241].
References
[R241] | (1, 2) R. A. Horn & C. R. Johnson, Matrix Analysis. Cambridge, UK: Cambridge University Press, 1999, pp. 146-7. |
Examples
>>> coeff = [3.2, 2, 1]
>>> np.roots(coeff)
array([-0.3125+0.46351241j, -0.3125-0.46351241j])