public class Complex<FLOAT_TYPE extends AbstractFloat = Double> extends AbstractNumber:
Represents a complex number with real and imaginary parts.
@param <FLOAT_TYPE> Numeric type used for the components.
z = Complex<Double>(3.0, 4.0) print(z.magnitude()) # 5.0
| Modifier and Type | Member | Description |
|---|---|---|
| public property | imagimag as FLOAT_TYPE |
The imaginary part of the complex number. |
| public property | realreal as FLOAT_TYPE |
The real part of the complex number. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | ComplexComplex(real as FLOAT_TYPE = 0, imaginary as FLOAT_TYPE = 0): |
Constructor for Complex class. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | conjugateconjugate() as Complex<FLOAT_TYPE>: |
Returns the conjugate of the complex number. |
| public | magnitudemagnitude() as Double: |
Returns the magnitude (or absolute value) of the complex number. |
| public | phasephase() as Double: |
Returns the phase (or angle) of the complex number in radians. |
| public readonly | toStringtoString() as String: |
Returns a string representation of the complex number. |