Re: [Numpy-discussion] Inverse function of numpy.polyval()

2014-05-20 Thread Neal Becker
Yuxiang Wang wrote: > Dear all, > > I was wondering is there a convenient inverse function of > np.polyval(), where I give the y value and it solves for x? > > I know one way I could do this is: > > import numpy as np > > # Set up the question > p = np.array([1, 1, -10]) > y = 100 > > # Solve

[Numpy-discussion] Inverse function of numpy.polyval()

2014-05-19 Thread Yuxiang Wang
Dear all, I was wondering is there a convenient inverse function of np.polyval(), where I give the y value and it solves for x? I know one way I could do this is: import numpy as np # Set up the question p = np.array([1, 1, -10]) y = 100 # Solve p_temp = p p_temp[-1] -= y x = np.roots(p_temp)