Polynomials

Sort by

recency

|

241 Discussions

|

  • + 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}")

  • + 0 comments

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

  • + 0 comments
    import numpy as np
    
    p = list(map(float,input().split()))
    x = int(input())
    arr = np.polyval(p,x)
    print(arr)