This package wants you to express the function as a composition of functions:
julia> using InverseFunctions
julia> foo = sqrt ∘ Base.Fix1(*, 4)
sqrt ∘ Base.Fix1{typeof(*), Int64}(*, 4)
julia> inverse(foo)
Base.Fix1{typeof(\), Int64}(\, 4) ∘ InverseFunctions.square
julia> inverse(foo).(1:8)
8-element Vector{Float64}:
0.25
1.0
2.25
4.0
6.25
9.0
12.25
16.0
It does raise interesting questions about function composition fallbacks, something that’s recently been on my mind (see here). It could be interesting if Julia allowed our own fallbacks for this kind of purpose. Calculating inverse functions sure is handy, e.g., when using the Kolmogorov-Nagumo Average.
Edit: On further thought, we wouldn’t need any custom fallback to satisfy this desire beyond what was suggested in that link (i.e., a composition fallback for partially-applied functions).