How can we find all inverses of a multivalued function?

How can we find all inverses of a multivalued function using Mathematica?

For example, if we try to find the inverse of $x^2$, Mathematica will say something like this:

In:= f[x_] := x^2

In:= InverseFunction[f][x]

During evaluation of In:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

Out:= -Sqrt[x]

And the other inverse, $\sqrt x$, will be missed. I've found something similar here. But it would be preferable if we can get a set all solutions instead. How can we do this?

My main interest is to find all inverses of the function $\frac{2^{x-1}-1}{x}$. How can we do this?

In:= g[x_] := (2^(x-1)-1)/x

In:= InverseFunction[g][x]

During evaluation of In:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

Out:= (-Log-x ProductLog[-((2^(-1-1/x) Log)/x)])/(x Log)

In:= h[x_]:=InverseFunction[g][x]

In:= g

Out= 3

In:= N[h]

During evaluation of In:= InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.

Out= -0.18692 // Wrong answer to me, for example
• Reduce[y==x^2,x] finds both inverses. Reduce[y==(2^(x-1)-1)/x,x] finds 2*Infinity inverses. Are there more? There are design decisions made in Mathematica where it will miss individual points in some cases.
– Bill
May 19 '18 at 20:45
• Very interesting. Can you post this as a solution? Do you know a way to find the correct h(x) where h(3) = 5? The solutions found by mathematica were: $c_1\in \mathbb{Z}\land \left(\left(y=0\land x=1+\frac{2 i \pi c_1}{\log (2)}\right)\lor \left(x\neq 0\land y\neq 0\land x=\frac{-y W_{c_1}\left(-\frac{2^{-\frac{1}{y}-1} \log (2)}{y}\right)-\log (2)}{y \log (2)}\right)\right)$ May 19 '18 at 20:59

As requested

Reduce[y==x^2,x]

finds both inverses.

Reduce[y==(2^(x-1)-1)/x,x]

finds 2*Infinity inverses. Are there more?

There are design decisions made in Mathematica where it will miss individual points in some cases.

If I looked at that result and wanted to find C for x==3 and y==5 I would start with

x==(-Log-y*ProductLog[C,-((2^(-1-y^(-1))*Log)/y)])/(y*Log)/.{x->3,y->5}

and consider the available tools which might solve that for C. I would not necessarily assume that C would be Real. I would carefully study the details tab here ProductLog and cautiously consider which tools might help me correctly find one or perhaps even an infinite number of solutions. But it is not at all obvious to me that you should be able to choose arbitrary numbers for both x and y and find a solution in C, particularly since I think Reduce said that C had to be an integer and looking at a handful of values for C don't seem to show there is a Real solution for x==3 and y==5.