npm.nicfv.com
    Preparing search index...

    Class Complex

    Represents a complex number a + bi.

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Define a complex number a + bi.

      Parameters

      • real: number

        The real portion.

      • imag: number

        The imaginary portion.

      Returns Complex

    Properties

    imag: number

    The imaginary portion.

    r: number

    Magnitude of the complex number.

    real: number

    The real portion.

    theta: number

    Angle of the complex number.

    Methods

    • Determine whether this complex number is equal to another.

      Parameters

      • other: Complex

        The other complex number to compare.

      • tolerance: number = 0

        Optional tolerance for approximate equality.

      Returns boolean

      true when both real and imaginary components are equal within tolerance.

    • Subtract another complex number from this one.

      Parameters

      • other: Complex

        The complex number to subtract.

      Returns Complex

      The difference of the two complex numbers.

    • Divide this complex number by another.

      Parameters

      • other: Complex

        The complex number to divide by.

      Returns Complex

      The quotient of the two complex numbers.

    • Add another complex number to this one.

      Parameters

      • other: Complex

        The complex number to add.

      Returns Complex

      The sum of the two complex numbers.

    • Raise this complex number to a power.

      Parameters

      • exp: number

        The exponent.

      Returns Complex

      The complex number raised to the given power.

    • Multiply this complex number by another.

      Parameters

      • other: Complex

        The complex number to multiply with.

      Returns Complex

      The product of the two complex numbers.

    • Create a complex number from polar coordinates.

      Parameters

      • r: number

        The magnitude (radius).

      • theta: number

        The angle in radians.

      Returns Complex

      A complex number represented by r * e^{i theta}.