As already mentioned, not all functions are reversible. In some cases, using additional constraints helps: think about the opposite of sin(x) .
Once you make sure your function has a unique inverse, solve the equation f(x) = y . The solution gives you the inverse, y(x) .
In python, find nonlinear solvers from scipy.optimize .
ev-br source share