Next: , Previous: Floats, Up: Data Types

5.4 Complex Numbers

There are two supported formats for complex numbers: rectangular and polar. The default format is rectangular, displayed in the form ‘(real,imag)’ where real is the real part and imag is the imaginary part, each of which may be any real number. Rectangular complex numbers can also be displayed in ‘a+bi’ notation; see Complex Formats.

Polar complex numbers are displayed in the form `(r;theta)' where r is the nonnegative magnitude and theta is the argument or phase angle. The range of theta depends on the current angular mode (see Angular Modes); it is generally between -180 and +180 degrees or the equivalent range in radians.

Complex numbers are entered in stages using incomplete objects. See Incomplete Objects.

Operations on rectangular complex numbers yield rectangular complex results, and similarly for polar complex numbers. Where the two types are mixed, or where new complex numbers arise (as for the square root of a negative real), the current Polar mode is used to determine the type. See Polar Mode.

A complex result in which the imaginary part is zero (or the phase angle is 0 or 180 degrees or ‘pi’ radians) is automatically converted to a real number.