Is there any library available to have inverse of a function? To be more specific, given a function y=f(x)
and domain, is there any library which can output x=f(y)
? Sadly I cannot use matlab/mathematics in my application, looking for C/Python library..
As has already been mentioned, not all functions are invertible. In some cases imposing additional constraints helps: think about the inverse of sin(x)
.
Once you are sure your function has a unique inverse, solve the equation f(x) = y
. The solution gives you the inverse, y(x)
.
In python, look for nonlinear solvers from scipy.optimize
.
I am a bit late, but for future readers of the post, I just published a python package that does this precisely. https://pypi.python.org/pypi/pynverse There is a detailed description of how to use it and how it does it in the description!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With