HackerRank Python - Polynomials
poly
The poly tool returns the coefficients of a polynomial with the given sequence of roots.
roots
The roots tool returns the roots of a polynomial with the given coefficients.
polyint
The polyint tool returns an antiderivative (indefinite integral) of a polynomial.
polyder
The polyder tool returns the derivative of the specified order of a polynomial.
polyval
The polyval tool evaluates the polynomial at specific value.
polyfit
The polyfit tool fits a polynomial of a specified order to a set of data using a least-squares approach.
- import numpy as np
-
- poly = [float(x) for x in input().split()]
- x = float(input())
- print(np.polyval(poly, x))