numpy.polyval() Method with Example

Python | numpy.polyval(): Learn about the numpy.polyval() method, its usages and example.
Submitted by Pranit Sharma, on February 27, 2023

NumPy is an abbreviated form of Numerical Python. It is used for different types of scientific operations in python. Numpy is a vast library in python which is used for almost every kind of scientific or mathematical operation. It is itself an array which is a collection of various methods and functions for processing the arrays.

numpy.polyval() Method

A mathematical expression generally composed of more than one variable where the degree of the variable is usually a whole number is said to be a polynomial.

It takes an array like input p which is the polynomial coefficient. It takes another array like parameter x which can be a number or an array of numbers at which to evaluate the p. If p is of length N, the polyval() method returns the values in terms of p, x, and N.


numpy.polyval(p, x)


  • p: polynomial coefficients
  • x: specific point/points at which to evaluate p.

Let us understand with the help of an example,

Python code to demonstrate the example of numpy.polyval() method

import numpy as np

# Using numpy.polyval
res = np.polyval([3,0,1], 5)

# Display result


Example: numpy.polyval() Method with Example

Python NumPy Programs »


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.