Inverse function of $y=x+kx^3$ 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}$$
 A: 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:
function [ x ] = im2w( y, Kappa )
    if abs(Kappa) < 1e-10
        x = y / (1 + Kappa *  (y' * y));
    elseif(Kappa > 0)
        direction = y/norm(y);
        w = nthroot(norm(y)/(2*Kappa) + sqrt((y'*y)/(4 * Kappa^2) + 1/(27*Kappa^3)), 3);
        x = direction * (w - 1./(3*Kappa*w));
    elseif(Kappa < 0)
        direction = y/norm(y);
        y = norm(y);
        x_wa2 = (1-1i * sqrt(3))/(2^(2/3) * 3^(1/3) * (9 * Kappa^2 * y+sqrt(3) * sqrt(27 * Kappa^4 * y^2+4 * Kappa^3))^(1/3))-((1+1i * sqrt(3)) * (9 * Kappa^2 * y+sqrt(3) * sqrt(27 * Kappa^4 * y^2+4 * Kappa^3))^(1/3))/(2 * 2^(1/3) * 3^(2/3) * Kappa);

        x = direction * real(x_wa2);
    else
        x = [0; 0]; % should not happen
    end
end

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.
