[Numpy-discussion] Inverse function of numpy.polyval()
Yuxiang Wang
yw5aj at virginia.edu
Mon May 19 21:23:12 EDT 2014
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)
However my guess is most would agree on that this code has low
readability. Any suggestions?
Thanks!
-Shawn
--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
yw5aj at virginia.edu
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/
More information about the NumPy-Discussion
mailing list