This class allows the manipulation of complex numbers. You can pass a complex number in different formats. Either as object, double, string or two integer parameters.

Object form { re: , im: } { arg: , abs: } { phi: , r: }

Array / Vector form [ real, imaginary ]

Double form 99.3 - Single double value

String form '23.1337' - Simple real number '15+3i' - a simple complex number '3-i' - a simple complex number

Example:

var c = new Complex('99.3+8i'); c.mul({r: 3, i: 9}).div(4.9).sub(3, 2);

Constructors

  • Parameters

    Returns Complex

Properties

im: number
re: number
EPSILON: number
INFINITY: Complex
NAN: Complex
ONE: Complex
ZERO: Complex

Methods

  • Calculate the magnitude of the complex number

    Returns number

  • Calculate the complex arcus cosinus

    Returns Complex

  • Calculate the complex acosh

    Returns Complex

  • Calculate the complex arcus cotangent

    Returns Complex

  • Calculate the complex acoth

    Returns Complex

  • Calculate the complex arcus cosecans

    Returns Complex

  • Calculate the complex acsch

    Returns Complex

  • Adds two complex numbers

    Parameters

    Returns Complex

  • Calculate the angle of the complex number

    Returns number

  • Calculate the complex arcus secant

    Returns Complex

  • Calculate the complex asech

    Returns Complex

  • Calculate the complex arcus sinus

    Returns Complex

  • Calculate the complex asinh

    Returns Complex

  • Calculate the complex arcus tangent

    Returns Complex

  • Calculate the complex atanh

    Returns Complex

  • Ceils the actual complex number

    Parameters

    • places: number

    Returns Complex

  • Clones the actual object

    Returns Complex

  • Returns the complex conjugate

    Returns Complex

  • Calculate the cosine

    Returns Complex

  • Calculate the complex cosh

    Returns Complex

  • Calculate the cotangent

    Returns Complex

  • Calculate the complex coth

    Returns Complex

  • Calculate the cosecans

    Returns Complex

  • Calculate the complex coth

    Returns Complex

  • Divides two complex numbers

    Parameters

    Returns Complex

  • Compares two complex numbers

    Note: new Complex(Infinity).equals(Infinity) === false

    Parameters

    Returns boolean

  • Calculate the complex exponent

    Returns Complex

  • Calculate the complex exponent and subtracts one.

    This may be more accurate than Complex(x).exp().sub(1) if x is small.

    Returns Complex

  • Floors the actual complex number

    Parameters

    • places: number

    Returns Complex

  • Calculate the complex inverse 1/z

    Returns Complex

  • Determines whether a complex number is not at the infinity pole of the Riemann sphere.

    Returns boolean

  • Determines whether or not a complex number is at the infinity pole of the Riemann sphere.

    Returns boolean

  • Determines whether a complex number is not on the Riemann sphere.

    Returns boolean

  • Determines whether or not a complex number is at the zero pole of the Riemann sphere.

    Returns boolean

  • Calculate the natural log

    Returns Complex

  • Multiplies two complex numbers

    Parameters

    Returns Complex

  • Gets the negated complex number

    Returns Complex

  • Calculate the power of two complex numbers

    Parameters

    Returns Complex

  • Ceils the actual complex number

    Parameters

    • places: number

    Returns Complex

  • Calculate the secant

    Returns Complex

  • Calculate the complex sech

    Returns Complex

  • Calculates the sign of a complex number, which is a normalized complex

    Returns Complex

  • Calculate the sine of the complex number

    Returns Complex

  • Calculate the complex sinh

    Returns Complex

  • Calculate the complex square root

    Returns Complex

  • Subtracts two complex numbers

    Parameters

    Returns Complex

  • Calculate the tangent

    Returns Complex

  • Calculate the complex tanh

    Returns Complex

  • Gets a string of the actual complex number

    Returns string

  • Returns the actual number as a vector

    Returns number[]

  • Returns the actual real value of the current object

    Returns null | number