poly(seq_of_zeros)
This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in :None:None:`numpy.polynomial`
is preferred. A summary of the differences can be found in the :None:doc:`transition guide </reference/routines.polynomials>`
.
Returns the coefficients of the polynomial whose leading coefficient is one for the given sequence of zeros (multiple roots must be included in the sequence as many times as their multiplicity; see Examples). A square matrix (or array, which will be treated as a matrix) can also be given, in which case the coefficients of the characteristic polynomial of the matrix are returned.
Specifying the roots of a polynomial still leaves one degree of freedom, typically represented by an undetermined leading coefficient. In the case of this function, that coefficient - the first one in the returned array - is always taken as one. (If for some reason you have one other point, the only automatic way presently to leverage that information is to use polyfit
.)
The characteristic polynomial, $p_a(t)$
, of an :None:None:`n`
-by-:None:None:`n`
matrix A is given by
$p_a(t) = \mathrm{det}(t\, \mathbf{I} - \mathbf{A})$ ,
where I is the :None:None:`n`
-by-:None:None:`n`
identity matrix.
A sequence of polynomial roots, or a square array or matrix object.
If input is the wrong shape (the input must be a 1-D or square 2-D array).
1D array of polynomial coefficients from highest to lowest degree:
c[0] * x**(N) + c[1] * x**(N-1) + ... + c[N-1] * x + c[N]
where c[0] always equals 1.
Find the coefficients of a polynomial with the given sequence of roots.
poly1d
A one-dimensional polynomial class.
polyfit
Least squares polynomial fit.
polyval
Compute polynomial values.
roots
Return the roots of a polynomial.
Given a sequence of a polynomial's zeros:
>>> np.poly((0, 0, 0)) # Multiple root example array([1., 0., 0., 0.])
The line above represents z**3 + 0*z**2 + 0*z + 0.
>>> np.poly((-1./2, 0, 1./2)) array([ 1. , 0. , -0.25, 0. ])
The line above represents z**3 - z/4
>>> np.poly((np.random.random(1)[0], 0, np.random.random(1)[0])) array([ 1. , -0.77086955, 0.08618131, 0. ]) # random
Given a square array object:
>>> P = np.array([[0, 1./3], [-1./2, 0]])
... np.poly(P) array([1. , 0. , 0.16666667])
Note how in all cases the leading coefficient is always 1.
See :The following pages refer to to this document either explicitly or contain code examples using this.
numpy.roots
scipy.signal._signaltools.residue
numpy.polymul
numpy.polydiv
numpy.polyadd
scipy.linalg._special_matrices.fiedler_companion
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them