Companion for the concrete complex value _Complex; holds the smart factory and all arithmetic on _Value operands.
Arithmetic returns Option[_Value] — None signals a non-finite or undefined result (e.g. log 0, 0 ^ negative) so the caller stays symbolic, mirroring the "domain errors stay symbolic" contract of the real path.
_Complex.of collapses a zero imaginary part back to a plain _Number, so every existing _Number(x) pattern match across the codebase keeps firing on real results — only a genuinely non-real value ever becomes a _Complex. Binary operations promote _Number operands to (x, 0) via _Complex.parts.
Attributes
Members list
Type members
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Complex addition a + b; None when either operand is non-numeric or the result is non-finite.
Complex addition a + b; None when either operand is non-numeric or the result is non-finite.
Attributes
Complex cosine cos(a + bi) = cos(a)cosh(b) − i·sin(a)sinh(b). None for non-numeric input or non-finite result.
Complex cosine cos(a + bi) = cos(a)cosh(b) − i·sin(a)sinh(b). None for non-numeric input or non-finite result.
Attributes
Complex hyperbolic cosine cosh(a + bi) = cosh(a)cos(b) + i·sinh(a)sin(b).
Complex hyperbolic cosine cosh(a + bi) = cosh(a)cos(b) + i·sinh(a)sin(b).
Attributes
Complex cotangent cot(v) = cos(v) / sin(v); None when the sine is zero.
Complex cotangent cot(v) = cos(v) / sin(v); None when the sine is zero.
Attributes
Complex hyperbolic cotangent coth(v) = cosh(v) / sinh(v); None when the sinh is zero.
Complex hyperbolic cotangent coth(v) = cosh(v) / sinh(v); None when the sinh is zero.
Attributes
Complex cosecant csc(v) = 1 / sin(v); None when the sine is zero.
Complex cosecant csc(v) = 1 / sin(v); None when the sine is zero.
Attributes
Complex hyperbolic cosecant csch(v) = 1 / sinh(v); None when the sinh is zero.
Complex hyperbolic cosecant csch(v) = 1 / sinh(v); None when the sinh is zero.
Attributes
Complex division a / b; None when either operand is non-numeric, the denominator is zero, or the result is non-finite.
Complex division a / b; None when either operand is non-numeric, the denominator is zero, or the result is non-finite.
Attributes
Complex exponential exp(v) = e^a(cos b + i·sin b) where v = a + bi. None for non-numeric input or non-finite result.
Complex exponential exp(v) = e^a(cos b + i·sin b) where v = a + bi. None for non-numeric input or non-finite result.
Attributes
Principal complex logarithm log(v) = ln|v| + i·arg(v). None when v is zero, non-numeric, or the result is non-finite.
Principal complex logarithm log(v) = ln|v| + i·arg(v). None when v is zero, non-numeric, or the result is non-finite.
Attributes
Complex multiplication a * b; None when either operand is non-numeric or the result is non-finite.
Complex multiplication a * b; None when either operand is non-numeric or the result is non-finite.
Attributes
Smart factory: collapses a zero imaginary part to _Number, preserving the real fast-path and all _Number(x) pattern matches.
Smart factory: collapses a zero imaginary part to _Number, preserving the real fast-path and all _Number(x) pattern matches.
Value parameters
- im
-
imaginary part; if
0.0the result is_Number(re) - re
-
real part
Attributes
Extracts the (re, im) parts from any numeric value. None for non-numeric values such as _Bool or _MatrixValue.
Extracts the (re, im) parts from any numeric value. None for non-numeric values such as _Bool or _MatrixValue.
Attributes
Principal complex power z ^ w = exp(w · log z). 0 ^ w is 0 for a positive real w and None otherwise, matching the real path's "0 ^ negative stays symbolic".
Principal complex power z ^ w = exp(w · log z). 0 ^ w is 0 for a positive real w and None otherwise, matching the real path's "0 ^ negative stays symbolic".
Value parameters
- a
-
base
- b
-
exponent
Attributes
Complex secant sec(v) = 1 / cos(v); None when the cosine is zero.
Complex secant sec(v) = 1 / cos(v); None when the cosine is zero.
Attributes
Complex hyperbolic secant sech(v) = 1 / cosh(v); None when the cosh is zero.
Complex hyperbolic secant sech(v) = 1 / cosh(v); None when the cosh is zero.
Attributes
Complex sine sin(a + bi) = sin(a)cosh(b) + i·cos(a)sinh(b). None for non-numeric input or non-finite result.
Complex sine sin(a + bi) = sin(a)cosh(b) + i·cos(a)sinh(b). None for non-numeric input or non-finite result.
Attributes
Complex hyperbolic sine sinh(a + bi) = sinh(a)cos(b) + i·cosh(a)sin(b).
Complex hyperbolic sine sinh(a + bi) = sinh(a)cos(b) + i·cosh(a)sin(b).
Attributes
Complex subtraction a - b; None when either operand is non-numeric or the result is non-finite.
Complex subtraction a - b; None when either operand is non-numeric or the result is non-finite.
Attributes
Complex tangent tan(v) = sin(v) / cos(v). None when the cosine is zero, the input is non-numeric, or the result is non-finite.
Complex tangent tan(v) = sin(v) / cos(v). None when the cosine is zero, the input is non-numeric, or the result is non-finite.