I want to invert the following function with respect to $x$:
$$f(x, k)=x+k x^3$$
where typical values for $x$ are between $0$ and $100$ and typical values for $k$ are between $-0.00005$ and $0.00005$. Further, it is known that:
$$k >-\frac{1}{3x^2}$$
therefore, the function should be invertible. The derivatives:
$$\begin{align}\frac{df}{dx}&=1+3kx^2\\ \frac{df}{dk} &= x^3\end{align}$$
are non-negative for all possible values of x and k. So the Function $f$ is monotonically increasing in both dimensions.
I need the function $g(y, k)$ so that $g(f(x, k), k) = x$ for all $x$ and all $k$.
What I have tried: The following function returns correct values for all $k>0$. For negative $k$ it does not work (returns complex numbers).
$$w = \sqrt[3]{\frac{y}{2 k} + \sqrt{\frac{y^2}{4 k^2} + \frac{1}{27 k^3}}}\\ g(y,k) = w - \frac{1}{3 kw}$$
Okay, i got it.
Using the second solution from WolframAlpha, and discarding the imaginary part, does the job for negative $k$. As both solutions do not work for $k=0$ I have the following solution:
This is Matlab Code (sorry) but gives results for all possible combinations for $k$ and $x$. The constraint for $k$: $$ k > -\frac{4}{27 y^2} $$ Not sure whether I was wrong, or the difference is because I used x, wheres WA uses y.