Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Complex

Index

Constructors

  • new Complex(re: number, im?: number): Complex
  • Creates a complex number

    Parameters

    • re: number

      The first input number

    • im: number = 0

      The second input number

    Returns Complex

    Creates a complex number z = z.re + i z.im

Properties

im: number
re: number

Accessors

  • get phi(): number
  • Phi angle in polar coordinate

    Returns number

    angle

  • get phiTau(): number
  • Phi angle in polar coordinate with TAU

    Returns number

    angle divided by TAU

  • get r(): number
  • Radius in polar coordinate

    Returns number

    number

Methods

  • abs(): number
  • Absolute value (length)

    Returns number

    absolute value

  • abs2(): number
  • Length squared: intensity probability

    Returns number

    number

  • arg(): number
  • Complex number argument in range [0,Tau]

    Returns number

    number

  • Tests if a complex is equal to another

    Parameters

    • z2: Complex

      complex to test equality

    Returns boolean

    z1 === z2

  • isAlmostZero(): boolean
  • Check if a complex number is very close zero (norm at most 1e-6 from zero)

    Returns boolean

    z1 ~= 0

  • isCloseTo(z2: Complex, eps?: number): boolean
  • Tests if a complex is close to another

    Parameters

    • z2: Complex

      complex to test proximity

    • eps: number = 1e-6

      tolerance for the Euclidean norm

    Returns boolean

    z1 ~= z2

  • isNormal(): boolean
  • Check if a complex number is normalized

    Returns boolean

    z1.r === 1

  • isOne(): boolean
  • Check if a complex number is one

    Returns boolean

    z1 === 1

  • isZero(): boolean
  • Check if a complex number is zero

    Returns boolean

    z1 === 0

  • toColor(): string
  • Generate HSL color from complex number See complex domain coloring

    Returns string

    RGB string

  • toString(complexFormat?: ComplexFormat, precision?: number): string
  • Override toString() method

    Parameters

    • complexFormat: ComplexFormat = 'cartesian'

      choice between ["cartesian", "polar", "polarTau"]

    • precision: number = 2

      float display precision

    Returns string

    string with appropriate format

  • fromPolar(r: number, phi: number): Complex
  • Create a complex number from polar coordinates

    Parameters

    • r: number

      Radius in polar coordinates

    • phi: number

      Angle in polar coordinates

    Returns Complex

Generated using TypeDoc