Is there any method or way to get the approximate equation(x = g(y)) for doing a reverse lookup from Y to X. The following is the simple y = f(x) and its plot.
import numpy as np
import matplotlib.pyplot as plt
formula = "2*x**6 + x**5 -3*x**4 + 7*x**3 + 9*x**2 + x + 6"
x = np.arange(1, 10)
y = eval(formula)
plt.plot(x, y)
plt.xlabel('X')
plt.ylabel('Y')
plt.show()
Can you please suggest any possible way in R or Python to get the reverse lookup function(From Y to X) with a minimal margin of error?