Skip to content

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(); // 5
z.mul(ComplexNum.I).re; // -4
  • IField<ComplexNum>

readonly static I: ComplexNum

Defined in: complex/complex-num.ts:45

The imaginary unit i, satisfying i² = −1.


readonly static ONE: ComplexNum

Defined in: complex/complex-num.ts:42

The complex number 1 + 0i.


readonly static ZERO: ComplexNum

Defined in: complex/complex-num.ts:39

The complex number 0 + 0i.

get im(): number

Defined in: complex/complex-num.ts:68

Imaginary part b of a + bi.

number


get re(): number

Defined in: complex/complex-num.ts:63

Real part a of a + bi.

number

abs(): number

Defined in: complex/complex-num.ts:73

Modulus |z| = √(re² + im²). Always non-negative.

number


add(other): ComplexNum

Defined in: complex/complex-num.ts:87

The additive operation a + b.

ComplexNum

ComplexNum

IField.add


arg(): number

Defined in: complex/complex-num.ts:78

Argument arg(z) = atan2(im, re) ∈ (−π, π].

number


conj(): ComplexNum

Defined in: complex/complex-num.ts:83

conj(a + bi) = a − bi.

ComplexNum


div(other): ComplexNum

Defined in: complex/complex-num.ts:109

ComplexNum

ComplexNum

When other is zero.

IField.div


inv(): ComplexNum

Defined in: complex/complex-num.ts:104

ComplexNum

When called on zero.

IField.inv


mul(other): ComplexNum

Defined in: complex/complex-num.ts:99

The operation a · b.

ComplexNum

ComplexNum

IField.mul


neg(): ComplexNum

Defined in: complex/complex-num.ts:95

The additive inverse −a.

ComplexNum

IField.neg


sub(other): ComplexNum

Defined in: complex/complex-num.ts:91

Subtraction a − b, equivalent to a.add(b.neg()).

ComplexNum

ComplexNum

IField.sub


toTuple(): Complex

Defined in: complex/complex-num.ts:58

The underlying tuple, for callers working at the arithmetic layer.

Complex


static from(re, im?): ComplexNum

Defined in: complex/complex-num.ts:48

Creates a complex number from its real and imaginary parts.

number

number = 0

ComplexNum


static fromTuple(value): ComplexNum

Defined in: complex/complex-num.ts:53

Wraps an already-computed Complex tuple.

Complex

ComplexNum