Skip to content

Latest commit

 

History

History
245 lines (108 loc) · 4 KB

File metadata and controls

245 lines (108 loc) · 4 KB

Home > @josh-brown/vector > ComplexNumberOperations

ComplexNumberOperations class

Implements the basic ScalarOperations on ComplexNumbers

Signature:

export declare class ComplexNumberOperations extends ScalarOperations<ComplexNumber> 

Extends: ScalarOperations<ComplexNumber>

Methods

Method

Modifiers

Description

add(first, second)

Returns the sum of two scalars first and second.

conjugate(scalar)

Returns the complex conjugate of a scalar.

equals(first, second)

Tests if the scalars are equal. Implementors should ensure that the operation is reflexive, associative, and transitive.

fromComplex(real, imag)

Returns an instance of the scalar type from its real and imaginary parts. If the scalar type does not support complex numbers, then an error will be thrown.

fromNumber(num)

Returns an instance of the scalar type which most accurately corresponds to the value of num

getAdditiveIdentity()

Returns the unique scalar that, when added to another scalar, returns that scalar

getAdditiveInverse(scalar)

Returns the unique value that, when added to x, returns the additive identity

getMultiplicativeIdentity()

Returns the unique scalar that, when multiplied by another scalar, returns that scalar

getMultiplicativeInverse(scalar)

Returns the unique scalar that, when multiplied by scalar, returns the multiplicative identity

getPrincipalSquareRoot(x)

Returns the principal square root of a scalar.

multiply(first, second)

Returns the product of two scalars first and second.

norm(x)

Returns the norm (absolute value or magnitude) of a scalar

prettyPrint(x)

Returns a readable string that represents the value of the scalar

random(min, max)

Returns a random scalar value between min and max

randomNormal(mean, standardDeviation)

Returns a random scalar value from a normal distribution centered on mean with standard deviation standardDeviation