-
Notifications
You must be signed in to change notification settings - Fork 0
math.Complex.Class.Complex
dsp-collection / math/Complex / Complex
An immutable complex number.
new Complex(re, im?): Complex;Constructs a Complex.
number
The real part.
number = 0
The imaginary part. Optional. Default is 0.
Complex
abs(): number;Returns the absolute value (magnitude, vector length, radius).
number
add(x): Complex;Returns this + x;
Complex
Complex
addReal(x): Complex;Returns this + x;
number
Complex
arg(): number;Returns the argument (angle).
number
conj(): Complex;Returns the conjugate.
Complex
div(x): Complex;Returns this / x;
Complex
Complex
divReal(x): Complex;Returns this / x;
number
Complex
equals(x): boolean;Returns true if this complex number is exactly equal to another.
Complex
boolean
exp(): Complex;Returns the exponential function. (The Euler's number e raised to the power of this complex number).
Complex
fuzzyEquals(x, eps): boolean;Returns true if the real and imaginary parts of the two numbers
do not differ more than eps.
Complex
number
boolean
isFinite(): boolean;Returns true if the real and imaginary parts are both finite.
boolean
isInfinite(): boolean;Returns true if the real or the imaginary part is infinite (positive or negative).
boolean
isNaN(): boolean;Returns true if the real part or the imaginary part is NaN.
boolean
log(): Complex;Returns the natural logarithm (base e).
Complex
mul(x): Complex;Returns this * x;
Complex
Complex
mulReal(x): Complex;Returns this * x;
number
Complex
neg(): Complex;Returns the negation (-this).
Complex
pow(x): Complex;Returns this raised to the power of x.
Complex
Complex
powInt(x): Complex;Returns this raised to the power of x.
number
Complex
powReal(x): Complex;Returns this raised to the power of x.
number
Complex
reciprocal(): Complex;Returns the reciprocal (1 / this, multiplicative inverse).
Complex
sqr(): Complex;Returns the square.
Complex
sqrt(): Complex;Returns one of the two square roots.
Complex
sub(x): Complex;Returns this - x;
Complex
Complex
subReal(x): Complex;Returns this - x;
number
Complex
toNumber(eps): number;Returns the real part.
Verifies that abs(im) <= eps or abs(im) <= abs(re) * eps.
number
number
toString(): string;Returns a string representing the complex number.
string
static divFromReal(x, y): Complex;Returns x / y;
number
Complex
Complex
static expj(arg): Complex;Creates a Complex of length 1 and argument arg.
number
Complex
static fromPolar(abs, arg): Complex;Creates a Complex from polar coordinates.
number
number
Complex
static subFromReal(x, y): Complex;Returns x - y;
number
Complex
Complex