αβγ

Complex number calculations

The following explains some of the reasoning behind the operation of XCALC. If you are not familiar with complex numbers, go read a maths textbook.

I have chosen a complex-only solution for the floating-point routines in XCALC. This means that when you do decimal calculations, behind the scene quite a few invisible things happen (like addition of imaginary parts of numbers). Normally, this goes without any problems, and you might appreciate the solution if you want to know, say, the inverse sine of 2. If the imaginary part as the result of any calculation becomes non-zero, the mode is automatically set to Complex. In the accuracy section you can see some unfortunate effects of this, but it certainly makes the internal operation of XCALC a lot tidier!

Since complex numbers and radian angle measures are inseparable, there is no provision for “degrees” in the Complex mode. Euler's formulae simply do not make any sense unless radians are used.

Principal values

There is an ambiguity in many complex operations; the value returned by XCALC is correct, but only one of many possible solutions. For example, the natural logarithm of -1 is πi·(1+2n), for any integer n. XCALC can only return one value, an in this particular example this is πi. Another example is the third root of -27 (27 m Enter 3 r or 27 m u). XCALC returns -3 as expected, but only if you enter an exact integer as the root. If you offset 3 by just a fraction (for example, by taking the square of the square root of 3), XCALC will no longer return -3, but rather 1.5 + i2.59… This number raised to the third power is indeed also -27, but XCALC can no longer use the integer root formula, and ends up with one of the other roots. If you have an integer root, the result will be the one with the same complex angle as the radical if the root is odd (as above), and the root at 1/n'th of the angle for even roots n=2, 4... For example, the square root of -1 is returned as you would expect, as i.

See also: