ComplexNum
Defined in: complex/complex-num.ts:31
A complex number re + im·i, boxed as a value with its own field API.
The contract shell over Complex. Every operation delegates to the
free functions in complex.ts; no arithmetic happens in this class.
const z = ComplexNum.from(3, 4);z.abs(); // 5z.mul(ComplexNum.I).re; // -4Implements
Section titled “Implements”IField<ComplexNum>
Properties
Section titled “Properties”
readonlystaticI:ComplexNum
Defined in: complex/complex-num.ts:45
The imaginary unit i, satisfying i² = −1.
readonlystaticONE:ComplexNum
Defined in: complex/complex-num.ts:42
The complex number 1 + 0i.
readonlystaticZERO:ComplexNum
Defined in: complex/complex-num.ts:39
The complex number 0 + 0i.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get im():
number
Defined in: complex/complex-num.ts:68
Imaginary part b of a + bi.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get re():
number
Defined in: complex/complex-num.ts:63
Real part a of a + bi.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”abs():
number
Defined in: complex/complex-num.ts:73
Modulus |z| = √(re² + im²). Always non-negative.
Returns
Section titled “Returns”number
add(
other):ComplexNum
Defined in: complex/complex-num.ts:87
The additive operation a + b.
Parameters
Section titled “Parameters”ComplexNum
Returns
Section titled “Returns”ComplexNum
Implementation of
Section titled “Implementation of”IField.add
arg():
number
Defined in: complex/complex-num.ts:78
Argument arg(z) = atan2(im, re) ∈ (−π, π].
Returns
Section titled “Returns”number
conj()
Section titled “conj()”conj():
ComplexNum
Defined in: complex/complex-num.ts:83
conj(a + bi) = a − bi.
Returns
Section titled “Returns”ComplexNum
div(
other):ComplexNum
Defined in: complex/complex-num.ts:109
Parameters
Section titled “Parameters”ComplexNum
Returns
Section titled “Returns”ComplexNum
Throws
Section titled “Throws”When other is zero.
Implementation of
Section titled “Implementation of”IField.div
inv():
ComplexNum
Defined in: complex/complex-num.ts:104
Returns
Section titled “Returns”ComplexNum
Throws
Section titled “Throws”When called on zero.
Implementation of
Section titled “Implementation of”IField.inv
mul(
other):ComplexNum
Defined in: complex/complex-num.ts:99
The operation a · b.
Parameters
Section titled “Parameters”ComplexNum
Returns
Section titled “Returns”ComplexNum
Implementation of
Section titled “Implementation of”IField.mul
neg():
ComplexNum
Defined in: complex/complex-num.ts:95
The additive inverse −a.
Returns
Section titled “Returns”ComplexNum
Implementation of
Section titled “Implementation of”IField.neg
sub(
other):ComplexNum
Defined in: complex/complex-num.ts:91
Subtraction a − b, equivalent to a.add(b.neg()).
Parameters
Section titled “Parameters”ComplexNum
Returns
Section titled “Returns”ComplexNum
Implementation of
Section titled “Implementation of”IField.sub
toTuple()
Section titled “toTuple()”toTuple():
Complex
Defined in: complex/complex-num.ts:58
The underlying tuple, for callers working at the arithmetic layer.
Returns
Section titled “Returns”from()
Section titled “from()”
staticfrom(re,im?):ComplexNum
Defined in: complex/complex-num.ts:48
Creates a complex number from its real and imaginary parts.
Parameters
Section titled “Parameters”number
number = 0
Returns
Section titled “Returns”ComplexNum
fromTuple()
Section titled “fromTuple()”
staticfromTuple(value):ComplexNum
Defined in: complex/complex-num.ts:53
Wraps an already-computed Complex tuple.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”ComplexNum