Class: Complex

algeobra~Complex()

Grouping of complex number functions. Complex numbers are represented as 2-element arrays for simplicity, so this is not its own type

Constructor

new Complex()

Source:

Methods

(static) abs(z) → {Number}

Computes the absolute value sqrt(a^2 + b^2) for the number a + bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The absolute value
Type
Number

(static) abs2(z) → {Number}

Computes the absolute value squared a^2 + b^2 for the number a + bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The absolute value squared
Type
Number

(static) add(z0, z1) → {Array.<Number>}

Adds two complex numbers
Parameters:
Name Type Description
z0 Array.<Number> The first number
z1 Array.<Number> The second number
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>

(static) conj(z) → {Array.<Number>}

Computes the complex conjugate a - bi for the number a + bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>

(static) div(z0, z1) → {Array.<Number>}

Divides two complex numbers
Parameters:
Name Type Description
z0 Array.<Number> The first number
z1 Array.<Number> The second number
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>

(static) equals(z0, z1, eps) → {Boolean}

Checkes, whether two complex numbers are approximately equal
Parameters:
Name Type Default Description
z0 Array.<Number> The first number
z1 Array.<Number> The second number
eps Number 1e-10 [1E-10] The epsilon value to check for approximate equality
Source:
Returns:
True, if the two numbers are approximately equal, false otherwise
Type
Boolean

(static) imag(z) → {Number}

Extracts the imaginary part b of the number a + bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The imaginary component
Type
Number

(static) mult(z0, z1) → {Array.<Number>}

Multiplies two complex numbers
Parameters:
Name Type Description
z0 Array.<Number> The first number
z1 Array.<Number> The second number
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>

(static) neg(z) → {Array.<Number>}

Negates the complex number a + bi to give -a - bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>

(static) num(a, b) → {Array.<Number>}

Simple complex number representation as an array with two components. The first component is the real and the second the imaginary part. So the number a + bi is represented as [a,b]
Parameters:
Name Type Default Description
a Number 0 The real component
b Number 0 The imaginary component
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>

(static) real(z) → {Number}

Extracts the real part a of the number a + bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The real component
Type
Number

(static) sqrt(z) → {Number}

Computes the principal square root sign(b) * sqrt(a + bi) of the complex number a + bi
Parameters:
Name Type Description
z Array.<Number> The number
Source:
Returns:
The real component
Type
Number

(static) sub(z0, z1) → {Array.<Number>}

Subtracts two complex numbers
Parameters:
Name Type Description
z0 Array.<Number> The first number
z1 Array.<Number> The second number
Source:
Returns:
The imaginary number as entries [a,b]
Type
Array.<Number>