Return polynomial coefficients given a sequence of roots.
Calculate the coefficients of a polynomial given the zeros of the polynomial.
If a square matrix is given, then the coefficients for characteristic equation of the matrix, defined by , are returned.
Parameters: | seq_of_zeros : ndarray
|
---|---|
Returns: | coefs : ndarray
|
See also
Examples
Given a sequence of polynomial zeros,
>>> b = np.roots([1, 3, 1, 5, 6])
>>> np.poly(b)
array([ 1., 3., 1., 5., 6.])
Given a square matrix,
>>> P = np.array([[19, 3], [-2, 26]])
>>> np.poly(P)
array([ 1., -45., 500.])