might be more concise to use the function `np.polyval` here.