A class representing complex numbers. Note that this is a simplified representation of a complex number, which does not implement the full mathematical notion of a complex number.
Create a new complex number with the given real and imaginary parts.
real |
the real part |
imag |
the imaginary part |
a new instance of Complex.
The real part of the number.
The imaginary part of the number.
the complex conjugate.
Complex addition.
Complex subtraction
Complex multiplication
Complex division.
Complex exponentiation with base e.
Complex self multiplication.
complex triple self multiplication.
Complex square root
returns the principal root
Complex exponentiation
not implemented for all combinations - some are mathematically ambiguous.
the comparison of just the real parts.
the comparison assuming that the reals (floats) are fully embedded in the complex numbers
negation of both parts
the reciprocal of a complex number
the absolute value of a complex number is its magnitude.
distance to the origin.
the distance to the origin.
the angle in radians.
Convert to a Point.
Convert to a Polar
real part as Integer.
real part as Float.
returns this
a hash value
print this on given stream
Basic example:
Julia set approximation: