numpy.polyval
- 
numpy.polyval(p, x)[source]
- 
Evaluate a polynomial at specific values. If pis 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]If xis a sequence, thenp(x)is returned for each element ofx. Ifxis another polynomial then the composite polynomialp(x(t))is returned.Parameters: p : array_like or poly1d object 1D array of polynomial coefficients (including coefficients equal to zero) from highest degree to the constant term, or an instance of poly1d. x : array_like or poly1d object A number, an array of numbers, or an instance of poly1d, at which to evaluate p.Returns: values : ndarray or poly1d If xis a poly1d instance, the result is the composition of the two polynomials, i.e.,xis “substituted” inpand the simplified result is returned. In addition, the type ofx- array_like or poly1d - governs the type of the output:xarray_like =>valuesarray_like,xa poly1d object =>valuesis also.See also - poly1d
- A polynomial class.
 NotesHorner’s scheme [R65] is used to evaluate the polynomial. Even so, for polynomials of high degree the values may be inaccurate due to rounding errors. Use carefully. References[R65] (1, 2) I. N. Bronshtein, K. A. Semendyayev, and K. A. Hirsch (Eng. trans. Ed.), Handbook of Mathematics, New York, Van Nostrand Reinhold Co., 1985, pg. 720. Examples>>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1 76 >>> np.polyval([3,0,1], np.poly1d(5)) poly1d([ 76.]) >>> np.polyval(np.poly1d([3,0,1]), 5) 76 >>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5)) poly1d([ 76.]) 
    © 2008–2016 NumPy Developers
Licensed under the NumPy License.
    https://docs.scipy.org/doc/numpy-1.11.0/reference/generated/numpy.polyval.html