Options
All
  • Public
  • Public/Protected
  • All
Menu

A class that descibes Complex numbers and their operations.

To define a new Complex:

new Complex(1, -1); // Numeric arguments
new Complex({ x: 1, y: -3 }); // Cartesian argument
new Complex({ r: 1, p: Math.PI / 2 }); // Polar argument
new Complex(z); // Complex argument

Hierarchy

  • Complex

Index

Constructors

constructor

  • Creates an instance of Complex from another Complex number.

    Parameters

    Returns Complex

  • Creates an instance of Complex from a Cartesian coordinate.

    Parameters

    Returns Complex

  • Creates an instance of Complex from a Polar coordinate.

    Parameters

    • p: Polar

      The Polar coordinate.

    Returns Complex

  • Creates an instance of Complex from two optional values. If a value is omitted it's considered 0.

    Parameters

    • Optional re: number

      The real part.

    • Optional im: number

      The imaginary part.

    Returns Complex

Properties

Private im

im: number

The imaginary part.

Private re

re: number

The real part.

Static E

E: Complex = ...

Constant e: z = e.

Static EPSILON

EPSILON: number = ...

Difference between 1 and the smallest floating point number greater than 1. Simply stores Number.EPSILON in a static property.

Static HALFPI

HALFPI: Complex = ...

Constant pi: z = π / 2.

Static I

I: Complex = ...

Constant i: z = i.

Static INFINITY

INFINITY: Complex = ...

Infinity: z = ∞.

Static NAN

NAN: Complex = ...

Not a number: z = NaN.

Static ONE

ONE: Complex = ...

Constant one: z = 1.

Static PI

PI: Complex = ...

Constant pi: z = π.

Static ZERO

ZERO: Complex = ...

Costant zero: z = 0.

Methods

getIm

  • getIm(): number
  • Gets the imaginary part of a Complex number.

    Returns number

getRe

  • getRe(): number
  • Gets the real part of a Complex number.

    Returns number

toCartesian

toPolar

  • A method that returns a complex number in Polar coordinates.

    Returns Polar

toString

  • toString(): string
  • A method that formats a complex number to: ±a ± bi.

    todo

    Find a more elegant solution.

    Returns string

Legend

  • Constructor
  • Method
  • Private property
  • Static property

Generated using TypeDoc