Wilang Documentation1.0.0+4

Complex numbers#

Create a complex value#

Use i, or call complex(real, imaginary). Complex arithmetic uses the ordinary operators.

Example
complex()
Example
(1+2i) * (3-4i)
abs(3+4i)
arg(1+i)
re(3+4i)
im(3+4i)
conj(3+4i)

Magnitude, angle, and roots#

abs gives the magnitude, arg gives the angle in radians, and re and im extract the components. conj negates the imaginary part.

Under the normal settings, sqrt(-4) can return a complex result. Predictable mode changes type behavior and may return NaN instead.

Use nthRoots to ask for every complex root rather than one of them. Branches matter: powers, inverse trig functions, and logarithms each pick a principal value.

Vectors and matrices#

Complex matrices use the ordinary matrix operations. The conjugate transpose, written ctranspose or with the apostrophe operator, is not the same as transpose, which only swaps rows and columns.

All functions · Matrices and vectors