The complex module allows you to work with complex numbers. There is not much else to say. We have basic constructors, basic operations, trig, exponentials, and logarithms. More may be added in the future.
Generates a complex number.
complex 1 2 == 1 + 2 iThe number i
i == complex 0 1The number 1.
complex 1 0 == oneThe number 0.
complex 0 0 == zeroCreates a complex number from one real numer.
fromReal 5 == 5 + 0 iProvides the real part of a complex number.
real 2 + 3 i == 2Provides the imaginary part of a complex number.
imaginary 2 + 3 i == 3Takes the absolute value of a complex number.
abs 2 + 2 i == sqrt 8
abs -2 - 2 i == sqrt 8
abs 0 + 0 i == 0Returns the conjugate of a complex number
conjugate 2 + 3 i == 2 - 3 i
conjugate 2 - 3 i == 2 + 3 iNegates a complex number.
negation 1 + 2 i == -1 - 2 i
negation -1 - 2 i == 1 + 2 i
negation -1 + 2 i == 1 - 2 iReturns the sign of a complex number.
sgn 0 + 0 i == 0
sgn 0 + 2 i == 0
sgn 1 + -10 i == 1
sgn -1 + 10 i == -1
sgn -1 + -10 i == -1The argument of a complex number. It is in radians. This is also known as the phase or angle.
arg 0 + 0 i == 0
arg 0 + i == pi / 2Square root of a complex number. Returns only one of two possibilites.
sqrt (2+2i) == (1.55...) + i0.6435..Adds two complex numbers by adding the real and imaginary parts.
Subtacts two complex numbers by negating and adding.
Multiplies two complex numbers so that
mult (a + bi) (c + di) == (ac - bd) + (ad + bc)Divides two complex numbers.
div 2 + 2 i 1 + 1 i == 2 + 0
div 2 + 2 i 0 + 0 i == NaN + NaNiComplex sine.
Complex cosine.
Complex tangent.
Complex inverse sine.
Complex inverse cosine.
Complex inverse tan.
Euler's formula.
euler 2 == e^{i*2} == cos 2 + i*sin 2The natrual log of a complex number.
The exponent of a complex number.
Take a complex number to a complex power.
pow 1+0i 2+2i == (1)^{2+2i} == 1
A complex number is a record of a real part and an imaginary part.