Complex Numbers

The Complex constructor implements complex objects over a commutative ring R. Typically, the ring R is Integer, Fraction Integer, Float, DoubleFloat, R can also be a symbolic type, like Polynomial Integer. For more information about the numerical and graphical aspects of complex numbers, see Numeric Functions in section 8.1. Complex objects are created by the complex operation

The standard arithmetic operations are available.

If R is a field, you can also divide the complex objects.

Use a conversion (see Conversion in section 2.7) to view the last object as a fraction of complex integers.

The predefined macro `%i` is defined to be complex(0,1).

You can also compute the conjugate and norm of a complex number.

The real and imag operations are provided to extract the real and imaginary parts, respectively.

The domain Complex Integer is also called the Gaussian integers. If R is the integers (or, more generally, a Euclidean Domain), you can compute greatest common divisors.

You can also compute least common multiples

You can factor Gaussian integers.