[Math] Why does the calculator give weird answers for certain problems involving complex numbers

calculatorcomplex numbers

I was using my calculator (TI-83 Plus) to do some calculations involving complex and imaginary numbers, and I found in two cases that something weird will happen in the following scenario:

I did $log(-1)$ which gave some decimal along with i (my calculator was in a+bi mode). I stored that in a variable $D$, and did $10^D$, which should return just $-1$, as $log(-1)=x$ is the same as $10^x=-1$. However, it gave me back a complex number with a really small negative part. $-1+2\cdot 10^{-13}i$ (the calculator just said $-1+2e-13i$, so I'm not sure if it means $2\cdot 10^{-13}i$ or $2\cdot 10^{-13}i$, I think it is the latter) Why does it do that?

It happened in a different scenario for me a long time ago, but I don't quite remember what it was.

Edit:
I remember the second scenario, and this one I don't know why it does this:
i did $(-2-2i)^2$ and it said the answer is $8\cdot10^{-13}+8i$. It doesn't happen when I change the sign of the first 2, but not the second. With $log(-1)$, it's probably because it's irrational, but with this scenario, I'm not really dealing with any irrational numbers.

Best Answer

If you compute $1/3$ and store it in $Q$, and then compute $3*Q$, you'll find that you don't get 1 -- there's a tiny numerical imprecision, related to the fact that calculators use binary, in which $1/3$ is not representable in a finite number of bits(just as it is not in decimal, where it cannot be represented with a finite number of decimal digits: you have to write $.33333\ldots$).

The same is true for $\log -1$: it can't be represented exactly in binary. So when you exponentiate it, you get something very near $-1$; the error in this case happens to be in the imaginary component rather than the real part, but it's the same phenomenon.

By the way, 1+2e-13i means $-1 + 2 \times 10^{-13} \Bbb {i}$.

Related Question