问题 I have fit a second order polynomial to a number of x/y points in the following way: poly = np.polyfit(x, y, 2) How can I invert this function in python, to get the two x-values corresponding to a specific y-value? 回答1: Here's an example that shows how you can combine your poly with my answer at Inverse function of numpy.polyval(). First some data: In [44]: x Out[44]: array([0, 1, 2, 3, 4, 5, 6, 7]) In [45]: y Out[45]: array([ 9, 4, 0, -1, -1, 4, 8, 16]) Fit a polynomial to the data: In [46]: