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.

  1. import numpy as np
  2. poly = [float(x) for x in input().split()]
  3. x = float(input())
  4. print(np.polyval(poly, x))

download android app