An idea: A function
finv that returns the functional inverse of a function. For instance
finv(::typeof(cos)) = acos
I thought of this not for
cos, but for a particular function whose inverse does not have a recognized name nor a conventional computer function name like arccosine ->
Two possible uses:
- discoverability in the case that
myfuncis well known, but there is no standard name for the inverse. Instead of remembering
invmyfunc(x)or whatever, it is always `finv(myfunc)(x).
- To get the functional inverse of an unknown function. Maybe in a computation similar to automatic differentiation.
Possible complications are how to handle multiple branches and multiple arguments.
Are there outstanding cases where this would be useful, or is my use case more or less isolated ? A related question, is there already a convention used in some packages that I have not discovered?