poly1d

Creates polynomial given the coefficients. Number of coefficients determine the order of the polynomial.

pol = np.poly1d([2, 3, 4])
print(pol)
#   2
# 2 x + 3 x + 4

Polynomial can be evaluated by giving x values to it.

pol(2)
# 18
 
pol([1, 2, 3, 4])
# array([ 9, 18, 31, 48])

References

  1. https://numpy.org/doc/stable/reference/generated/numpy.poly1d.html