Complex

Complex

High-Precision Complex Number Utility Class. Provides arithmetic and transcendental functions for complex numbers using BigFloat.

Constructor

new Complex(re, imopt)

Source:
Properties:
Name Type Description
re BigFloat

The real part.

im BigFloat

The imaginary part.

Parameters:
Name Type Attributes Description
re number | string | BigFloat | Complex

Real part or Complex object

im number | string | BigFloat <optional>

Imaginary part

Classes

Complex

Members

operatorAdd

Source:

operatorDiv

Source:

operatorMul

Source:

operatorNeg :function

Source:
Type:
  • function

operatorPow

Source:

operatorSub

Source:

Methods

abs() → {BigFloat}

Description:
  • Magnitude (Absolute value) |z|

Source:
Returns:
Type
BigFloat

acos() → {Complex}

Description:
  • Inverse Cosine acos(z) = -i * ln(z + i*sqrt(1 - z^2))

Source:
Returns:
Type
Complex

acosh() → {Complex}

Description:
  • Inverse Hyperbolic Cosine acosh(z) = ln(z + sqrt(z^2 - 1))

Source:
Returns:
Type
Complex

add(other) → {Complex}

Description:
  • Adds another complex number.

Source:
Parameters:
Name Type Description
other Complex | number | string | BigFloat
Returns:
Type
Complex

arg() → {BigFloat}

Description:
  • Argument (Angle) arg(z)

Source:
Returns:
Type
BigFloat

asin() → {Complex}

Description:
  • Inverse Sine asin(z) = -i * ln(iz + sqrt(1 - z^2))

Source:
Returns:
Type
Complex

asinh() → {Complex}

Description:
  • Inverse Hyperbolic Sine asinh(z) = ln(z + sqrt(z^2 + 1))

Source:
Returns:
Type
Complex

atan() → {Complex}

Description:
  • Inverse Tangent atan(z) = (i/2) * ln((i+z)/(i-z))

Source:
Returns:
Type
Complex

atanh() → {Complex}

Description:
  • Inverse Hyperbolic Tangent atanh(z) = 0.5 * ln((1+z)/(1-z))

Source:
Returns:
Type
Complex

conj() → {Complex}

Description:
  • Returns the complex conjugate.

Source:
Returns:
Type
Complex

cos() → {Complex}

Description:
  • Trigonometric Cosine cos(z) cos(x+iy) = cos(x)cosh(y) - i sin(x)sinh(y)

Source:
Returns:
Type
Complex

cosh() → {Complex}

Description:
  • Hyperbolic Cosine cosh(z) cosh(x+iy) = cosh(x)cos(y) + i sinh(x)sin(y)

Source:
Returns:
Type
Complex

div(other) → {Complex}

Description:
  • Divides by another complex number.

Source:
Parameters:
Name Type Description
other Complex | number | string | BigFloat
Returns:
Type
Complex

equals(b) → {boolean}

Description:
  • Checks for equality with another complex number.

Source:
Parameters:
Name Type Description
b Complex | number | string | BigFloat
Returns:
Type
boolean

exp() → {Complex}

Description:
  • Complex Exponential e^z

Source:
Returns:
Type
Complex

isAlmostZero() → {boolean}

Description:
  • Checks if the complex number is almost zero.

Source:
Returns:
Type
boolean

isZero() → {boolean}

Description:
  • Checks if the complex number is exactly zero.

Source:
Returns:
Type
boolean

log() → {Complex}

Description:
  • Complex Natural Logarithm ln(z)

Source:
Returns:
Type
Complex

mul(other) → {Complex}

Description:
  • Multiplies by another complex number.

Source:
Parameters:
Name Type Description
other Complex | number | string | BigFloat
Returns:
Type
Complex

neg() → {Complex}

Description:
  • Negates the complex number.

Source:
Returns:
Type
Complex

pow(other) → {Complex}

Description:
  • Raises this complex number to the power of another.

Source:
Parameters:
Name Type Description
other Complex | number | string | BigFloat
Returns:
Type
Complex

sin() → {Complex}

Description:
  • Trigonometric Sine sin(z) sin(x+iy) = sin(x)cosh(y) + i cos(x)sinh(y)

Source:
Returns:
Type
Complex

sinh() → {Complex}

Description:
  • Hyperbolic Sine sinh(z) sinh(x+iy) = sinh(x)cos(y) + i cosh(x)sin(y)

Source:
Returns:
Type
Complex

sqrt() → {Complex}

Description:
  • Complex Square Root sqrt(z)

Source:
Returns:
Type
Complex

sub(other) → {Complex}

Description:
  • Subtracts another complex number.

Source:
Parameters:
Name Type Description
other Complex | number | string | BigFloat
Returns:
Type
Complex

tan() → {Complex}

Description:
  • Trigonometric Tangent tan(z)

Source:
Returns:
Type
Complex

tanh() → {Complex}

Description:
  • Hyperbolic Tangent tanh(z)

Source:
Returns:
Type
Complex

toString(baseopt, precisionopt, prettyopt) → {string}

Description:
  • Converts the complex number to a string.

Source:
Parameters:
Name Type Attributes Default Description
base number <optional>
10
precision number <optional>
-1
pretty boolean <optional>
false

pretty print

Returns:
Type
string

(static) fromPolar(r, theta) → {Complex}

Description:
  • Creates a complex number from polar coordinates.

Source:
Parameters:
Name Type Description
r number | string | BigFloat

The radius.

theta number | string | BigFloat

The angle.

Returns:
Type
Complex

(static) fromString(s) → {Complex}

Description:
  • Creates a complex number from a string.

Source:
Parameters:
Name Type Description
s string
Returns:
Type
Complex