The Urn Logo

math/complex

(->polar z)

Defined at lib/math/complex.lisp:103:2

Get the magnitude and angle of complex number Z.

Example

> (first (->polar (complex 3 4)))
out = 5
> (math/deg (second (-> polar (complex 2 2))))
out = 45

(angle z)

Defined at lib/math/complex.lisp:149:2

Get the angle of complex number Z.

If you need the magnitude as well, one should probably use ->polar.

Example

> (math/floor (math/deg (angle (complex 2 2))))
out = 45

complex

Defined at lib/math/complex.lisp:16:2

Represents a complex number, formed of a real and imaginary part.

(conjugate z)

Defined at lib/math/complex.lisp:91:2

Get the complex conjugate of Z.

Example

> (conjugate (complex 1 2))
out = 1-2i

(imaginary complex)

Defined at lib/math/complex.lisp:16:2

The imaginary part of this complex number.

(magnitude z)

Defined at lib/math/complex.lisp:135:2

Get the magnitude of complex number Z.

If you need the angle as well, one should probably use ->polar.

Example

> (magnitude (complex 3 4))
out = 5

(polar-> magnitude angle)

Defined at lib/math/complex.lisp:122:2

Create a complex number from the given MAGNITUDE and ANGLE.

Example

> (polar-> (math/sqrt 2) (math/rad 45))
out = 1+1i

(real complex)

Defined at lib/math/complex.lisp:16:2

The real part of this complex number.

Undocumented symbols

  • $complex Defined at lib/math/complex.lisp:16:2
  • (complex? complex) Defined at lib/math/complex.lisp:16:2