q5m.js - Quantum Computing Library - v0.1.1
    Preparing search index...

    Class Complex

    Native implementation of a complex number class. Represents a complex number with real and imaginary parts.

    Index

    Constructors

    Methods

    • Divides this complex number by another.

      Parameters

      • other: number | Complex

        The complex number to divide by

      Returns Complex

      A new complex number representing the quotient

      If dividing by zero

    • Returns the magnitude (absolute value) of this complex number.

      Returns number

      The magnitude as a real number

    • Returns the argument (phase angle) of this complex number in radians.

      Returns number

      The argument as a real number

    • Raises this complex number to the given power.

      Parameters

      • exponent: number

        The exponent (real number)

      Returns Complex

      A new complex number representing this^exponent

    • Checks if this complex number equals another.

      Parameters

      • other: Complex

        The complex number to compare to

      • tolerance: number = 1e-10

        Optional tolerance for floating point comparison

      Returns boolean

      True if the numbers are equal within tolerance

    • Returns a string representation of this complex number.

      Returns string

      String representation in the form "a + bi"

    Properties

    re: number
    im: number