Complex
import { Complex } from "https://raw.githubusercontent.com/JOTSR/Denum/master/mod.ts";⚠️ Complex is an unstable API, expect breaking changes ⚠️
§Type Parameters
§Constructors
§Properties
§Methods
⚠️ real and imaginary part must be integer Exponential or Frac ⚠️ ⚠️ return an instance of Exponential ⚠️ It takes a complex number, and returns its modulus
The return value is a new instance of the Exponential class.
⚠️ Complex can't be compared ⚠️ It compares two complex and returns 0 if they are equal, 1 if the first is greater than the second, and -1 if the first is less than the second.
- The complex to compare to.
The sign of the difference between the two complex.
If the real part is even and the imaginary part is even, then return true, otherwise return false.
The return value is a boolean.
⚠️ Complex can't be compared ⚠️ Returns true if the current complex is greater than the compared complex, or if the compared complex is equal to the current complex and ifEqual is true.
- The complex to compare to.
A boolean value.
Return true if the imaginary part is not null, if pure, return true if real part is null, otherwise return false
Returns true if the real and imaginary parts of the complex number are integers.
The return value is a boolean.
⚠️ Complex can't be compared ⚠️ Returns true if the current complex is lesser than the compared complex, or if the compared complex is equal to the current complex and the ifEqual parameter is true.
- The complex to compare to.
The return value is a boolean.
Return true if the real part is not null, if pure, return true if imaginary part is null, otherwise return false
⚠️ Sign is not Complex is not relevant for a complex ⚠️ The function returns the sign of a number
⚠️ Complex is not convertible to float32 ⚠️ If you try to convert a complex number to a float, you'll get an error.
- bigint
The function returns a string that is a JSON representation of the object
A string.
returns the LaTeX representation of the complex number
The return value is a LaTeX string.
⚠️ Complex is not convertible to an evaluable js string ⚠️ If you try to convert a Complex object to a string, you'll get an error.
§Static Methods
⚠️ float32 is not convertible to Complex ⚠️ If you try to convert a float to a complex you'll get an error.
- float32
It takes a string or an object with two properties, re and im, and returns a Complex object
- string | Record<string, unknown>
A new Complex object.
It takes a LaTeX string in the form of a + ib and returns a Complex object with a and b as the
real and imaginary parts respectively
- string
A new Complex object with the real and imaginary parts being the Frac or Exponential objects.