Functions to operate on polynomials.
eigvals = None
lstsq = None
Look for linear algebra functions in numpy
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.])
Adds two polynomials represented as sequences
Return the mth derivative of the polynomial p.
Computes q and r polynomials so that u(s) = q(s)*v(s) + r(s) and deg r < deg v.
Do a best fit polynomial of order N of y to x. Return value is a vector of polynomial coefficients [pk ... p1 p0]. Eg, for N=2
p2*x0^2 + p1*x0 + p0 = y1 p2*x1^2 + p1*x1 + p0 = y1 p2*x2^2 + p1*x2 + p0 = y2 ..... p2*xk^2 + p1*xk + p0 = yk
Method: if X is a the Vandermonde Matrix computed from x (see http://mathworld.wolfram.com/VandermondeMatrix.html), then the polynomial least squares solution is given by the 'p' in
X*p = y
where X is a len(x) x N+1 matrix, p is a N+1 length vector, and y is a len(x) x 1 vector
This equation can be solved as
p = (XT*X)^-1 * XT * y
where XT is the transpose of X and -1 denotes the inverse.
For more info, see http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html, but note that the k's and n's in the superscripts and subscripts on that page. The linear algebra is correct, however.
See also polyval
Return the mth analytical integral of the polynomial p.
If k is None, then zero-valued constants of integration are used. otherwise, k should be a list of length m (or a scalar if m=1) to represent the constants of integration to use for each integration (starting with k[0])
Multiplies two polynomials represented as sequences.
Subtracts two polynomials represented as sequences
Evaluate the polynomial p at x. If x is a polynomial then composition.
Description:
If p is of length N, this function returns the value: p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1]
x can be a sequence and p(x) will be returned for all elements of x. or x can be another polynomial and the composite polynomial p(x) will be returned.
Notice: This can produce inaccurate results for polynomials with significant variability. Use carefully.
Return the roots of the polynomial coefficients 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 p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]
| Local name | Refers to |
|---|---|
| atleast_1d | numpy.lib.shape_base.atleast_1d |
| diag | numpy.lib.twodim_base.diag |
| hstack | numpy.lib.shape_base.hstack |
| isscalar | numpy.core.numeric.isscalar |
| NX | numpy.core.numeric |
| re | re |
| sort_complex | numpy.lib.function_base.sort_complex |
| trim_zeros | numpy.lib.function_base.trim_zeros |
| vander | numpy.lib.twodim_base.vander |