Polynomials

Sort by

recency

|

243 Discussions

|

  • + 0 comments

    code

    import numpy print(numpy.polyval(list(map(float,input().split())),int(input())))

  • + 0 comments

    import numpy as np arr = np.array(list(map(float, input().split()))) x = int(input()) print(np.polyval(arr, x))

  • + 0 comments

    import numpy as np A = np.array(list(map(float,input().split()))) B=int(input()) print(np.polyval(A, B))

  • + 0 comments

    Understandable solution from my side

    import numpy
    print(numpy.polyval(list(map(float,input().split())),int(input())))
    
  • + 0 comments

    try:

    coefficients = list(map(float , input().strip().split()))
    
    
    x = int(input().strip())
    
    
    result = 0
    degree = len(coefficients) - 1  
    
    for i, coeff in enumerate(coefficients):
        result += coeff * (x ** (degree - i))  
    
    
    print(result)
    

    except ValueError as e: print(f"Input error: {e}")