I have an equation like that: $$ x = (x-A)^{2/3}+B $$ And I want to find the value of x. The problem is that during the iteration, x can became negative and then appears complex number. But that x is a distance, then I don't want complex number. How can I solve it?
Thanks
First consider $y = x-A$. Then $y+A = y^{2/3} + B$ which we can rearrange into $$ y - y^{2/3} + A - B = 0 $$ If $A = B$, then this has the two solutions $y = 1, y = 0$, which is to say $x = 1+A, x = A$.
Assuming $A\neq B$, then we also have $y\neq 0$, and we can divide the whole equation by $(A-B)y$ to get $$ \frac1{A-B} - \frac{1}{A-B}y^{-1/3} + y^{-1} = 0 $$ Now consider $z = 1/\sqrt[3]y$. We have $$ \frac1{A-B} - \frac{1}{A-B}z + z^3 = 0 $$ which is a depressed cubic. As such it may be solved through, for instance, the Cardano formula.