1 | initial version |
I have realized that my problem here was of mathematical nature rather than computational. I was assuming that
$-\frac{a}{b} =\frac{a}{-b}$ $\implies$ $\sqrt{-\frac{a}{b}}=\sqrt{\frac{a}{-b}}$ $\implies$ $\frac{\sqrt{-a}}{\sqrt{b}}=\frac{\sqrt{a}}{\sqrt{-b}}$
However, if we consider only the positive branches of the square roots, the last equality does not hold.