Simple module for handling complex numbers. This module was made for the needs of the signal processing library and thus kept to minimum.
Construct a Complex number with imaginary value only
imaginary 1 --> { re = 0, im = 1 }Construct a Complex number with real value only
real 1 --> { re = 1, im = 0 }The complex zero
Add two complex numbers
add (real 1) (imaginary 2) --> { re = 1, im = 2 }Subtract two complex numbers
subtract { re = 1, im = 2 } (real 2) --> { re = -1, im = 2 }Multiply two complex numbers
multiply (imaginary 1) (real 2) --> { re = 0, im = 2 }Divide a complex number by a real number. Notice that the divisor is given first.
real 2 |> divideByReal 2 --> { re = 1, im = 0 }Check equality of two complex numbers
Given complex number z, computes e^z
The absolute value of complex number, which is also its distance from zero
computes the conjugate of a complex number
conjugate { re = 1, im = 1 } --> { re = 1, im = -1 }
Simple representation of a complex number