Equation operators
Generated by
sema docfrom the compiler’s authoritative native-signature registry.
equation operators
Section titled “equation operators”Differential operators available inside equation: blocks (LANGUAGE §5.28) — not math. members.
constants
Section titled “constants”π: float
Section titled “π: float”Unicode equation alias of pi.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float - example:
π
ℯ: float
Section titled “ℯ: float”Unicode equation alias of e.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float - example:
ℯ
τ: float
Section titled “τ: float”Unicode equation alias of tau.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float - example:
τ
imaginary_unit: float | complex
Section titled “imaginary_unit: float | complex”Finite complex unit i.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float | complex - example:
imaginary_unit
ⅈ: float | complex
Section titled “ⅈ: float | complex”Unicode equation alias of imaginary_unit.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float | complex - example:
ⅈ
infinity: float
Section titled “infinity: float”Named equation alias of positive infinity.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float - example:
infinity
∞: float
Section titled “∞: float”Mathematical positive-infinity literal.
- domain: immutable equation-scope constant; not callable
- shape: scalar
- returns:
float - example:
∞
elementary
Section titled “elementary”exp(value) -> any
Section titled “exp(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
exp(1.0)
expm1(value) -> any
Section titled “expm1(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
expm1(0.25)
log(value) -> any
Section titled “log(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
log(e)
ln(value) -> any
Section titled “ln(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
ln(e)
log1p(value) -> any
Section titled “log1p(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
log1p(0.25)
log2(value) -> any
Section titled “log2(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
log2(8.0)
log10(value) -> any
Section titled “log10(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
log10(100.0)
sin(value) -> any
Section titled “sin(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
sin(pi / 2.0)
cos(value) -> any
Section titled “cos(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
cos(0.0)
tan(value) -> any
Section titled “tan(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
tan(0.0)
asin(value) -> any
Section titled “asin(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
asin(0.5)
acos(value) -> any
Section titled “acos(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
acos(0.5)
atan(value) -> any
Section titled “atan(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
atan(1.0)
atan2(left, right) -> float
Section titled “atan2(left, right) -> float”Bounded binary elementary equation function with typed non-finite failure.
- domain: two finite real numeric scalars
- shape: scalar
- returns:
float - example:
atan2(1.0, 1.0)
sinh(value) -> any
Section titled “sinh(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
sinh(0.5)
cosh(value) -> any
Section titled “cosh(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
cosh(0.5)
tanh(value) -> any
Section titled “tanh(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
tanh(0.5)
asinh(value) -> any
Section titled “asinh(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
asinh(0.5)
acosh(value) -> any
Section titled “acosh(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
acosh(2.0)
atanh(value) -> any
Section titled “atanh(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
atanh(0.5)
hypot(left, right) -> float
Section titled “hypot(left, right) -> float”Bounded binary elementary equation function with typed non-finite failure.
- domain: two finite real numeric scalars
- shape: scalar
- returns:
float - example:
hypot(3.0, 4.0)
degrees(value) -> any
Section titled “degrees(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
degrees(pi)
radians(value) -> any
Section titled “radians(value) -> any”Bounded elementary equation function with typed non-finite failure.
- domain: one finite numeric, symbolic, or supported dense/domain value
- shape: elementwise
- returns:
any - example:
radians(180.0)
conjugate(value) -> any
Section titled “conjugate(value) -> any”Complex conjugation, preserving real values and dense shape.
- domain: finite real/complex/symbolic scalar or rank-1/rank-2 dense real/complex value
- shape: elementwise
- returns:
any - example:
conjugate(imaginary_unit)
conj(value) -> any
Section titled “conj(value) -> any”Compact alias of conjugate.
- domain: same finite scalar and dense-container contract as conjugate
- shape: elementwise
- returns:
any - example:
conj(imaginary_unit)
overbar(value) -> any
Section titled “overbar(value) -> any”Textual alias of complex conjugation.
- domain: same finite scalar and dense-container contract as conjugate
- shape: elementwise
- returns:
any - example:
overbar(imaginary_unit)
real_part(value) -> any
Section titled “real_part(value) -> any”Real-part projection preserving dense shape.
- domain: finite real/complex/symbolic scalar or rank-1/rank-2 dense real/complex value
- shape: elementwise
- returns:
any - example:
real_part(imaginary_unit)
Re(value) -> any
Section titled “Re(value) -> any”Conventional alias of real_part.
- domain: same finite scalar and dense-container contract as real_part
- shape: elementwise
- returns:
any - example:
Re(imaginary_unit)
imag_part(value) -> any
Section titled “imag_part(value) -> any”Imaginary-part projection preserving dense shape; real inputs yield exact or shaped zero.
- domain: finite real/complex/symbolic scalar or rank-1/rank-2 dense real/complex value
- shape: elementwise
- returns:
any - example:
imag_part(imaginary_unit)
Im(value) -> any
Section titled “Im(value) -> any”Conventional alias of imag_part.
- domain: same finite scalar and dense-container contract as imag_part
- shape: elementwise
- returns:
any - example:
Im(imaginary_unit)
polar(value) -> any
Section titled “polar(value) -> any”Principal polar pair (radius, angle) with angle in [-pi, pi].
- domain: one finite real or complex scalar; radius must remain finite
- shape: scalar
- returns:
any - example:
polar(imaginary_unit)
rounding
Section titled “rounding”floor(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx
Section titled “floor(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx”Greatest-integer rounding, applied recursively to numeric containers.
- domain: finite exact/float scalars, symbolic expressions, same-evaluation Approx evidence, recursively numeric list/tuple, rank-1/rank-2 dense-real Tensor, or Embedding coerced to rank-1 Tensor; at most 1,000,000 visited values and nesting depth 128; rank-0/higher-rank tensors, non-finite lanes, and non-numeric containers fail typed
- shape: elementwise
- returns:
int | rational | float | list | tuple | Tensor | Sym | Approx - example:
floor(7 / 2)
ceil(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx
Section titled “ceil(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx”Least-integer rounding, applied recursively to numeric containers.
- domain: finite exact/float scalars, symbolic expressions, same-evaluation Approx evidence, recursively numeric list/tuple, rank-1/rank-2 dense-real Tensor, or Embedding coerced to rank-1 Tensor; at most 1,000,000 visited values and nesting depth 128; rank-0/higher-rank tensors, non-finite lanes, and non-numeric containers fail typed
- shape: elementwise
- returns:
int | rational | float | list | tuple | Tensor | Sym | Approx - example:
ceil(-7 / 2)
round(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx
Section titled “round(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx”Nearest-integer round-half-to-even, applied recursively to numeric containers.
- domain: finite exact/float scalars, symbolic expressions, same-evaluation Approx evidence, recursively numeric list/tuple, rank-1/rank-2 dense-real Tensor, or Embedding coerced to rank-1 Tensor; at most 1,000,000 visited values and nesting depth 128; rank-0/higher-rank tensors, non-finite lanes, and non-numeric containers fail typed
- shape: elementwise
- returns:
int | rational | float | list | tuple | Tensor | Sym | Approx - example:
round(5 / 2)
trunc(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx
Section titled “trunc(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx”Round toward zero, applied recursively to numeric containers.
- domain: finite exact/float scalars, symbolic expressions, same-evaluation Approx evidence, recursively numeric list/tuple, rank-1/rank-2 dense-real Tensor, or Embedding coerced to rank-1 Tensor; at most 1,000,000 visited values and nesting depth 128; rank-0/higher-rank tensors, non-finite lanes, and non-numeric containers fail typed
- shape: elementwise
- returns:
int | rational | float | list | tuple | Tensor | Sym | Approx - example:
trunc(-7 / 2)
fract(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx
Section titled “fract(value) -> int | rational | float | list | tuple | Tensor | Sym | Approx”Signed fractional part x - trunc(x), applied recursively to numeric containers.
- domain: finite exact/float scalars, symbolic expressions, same-evaluation Approx evidence, recursively numeric list/tuple, rank-1/rank-2 dense-real Tensor, or Embedding coerced to rank-1 Tensor; at most 1,000,000 visited values and nesting depth 128; rank-0/higher-rank tensors, non-finite lanes, and non-numeric containers fail typed
- shape: elementwise
- returns:
int | rational | float | list | tuple | Tensor | Sym | Approx - example:
fract(-7 / 2)
symbolic
Section titled “symbolic”normalize(expression) -> any
Section titled “normalize(expression) -> any”Canonical expanded multivariate polynomial in deterministic lexicographic variable order.
- domain: bounded exact multivariate polynomial over QQ with at most 8 variables, degree 64, and 4096 terms
- shape: symbolic
- returns:
any - example:
normalize(("x" + "y")^2)
collect(expression, variable) -> any
Section titled “collect(expression, variable) -> any”Collect an exact multivariate polynomial by descending powers of one variable.
- domain: bounded exact multivariate polynomial over QQ and one symbolic collection variable
- shape: symbolic
- returns:
any - example:
collect(("x" + "y")^2, "x")
resultant(left, right, variable) -> any
Section titled “resultant(left, right, variable) -> any”Exact multivariate resultant using a bounded division-free Sylvester determinant.
- domain: two bounded exact multivariate polynomials over QQ; Sylvester dimension at most 12
- shape: symbolic
- returns:
any - example:
resultant("x"^2 - "y", "x" - 1, "x")
groebner(polynomials, variables) -> any
Section titled “groebner(polynomials, variables) -> any”Reduced monic lexicographic Groebner basis from a bounded exact Buchberger computation.
- domain: 1..16 exact polynomials over QQ, 1..8 ordered variables, basis size at most 32 and at most 2048 Buchberger pairs
- shape: symbolic
- returns:
any - example:
groebner(["x"^2 - "y", "x" * "y" - 1], ["x", "y"])
normal_form(expression, basis, variables) -> any
Section titled “normal_form(expression, basis, variables) -> any”Deterministic exact multivariate remainder modulo an ordered polynomial basis.
- domain: one exact polynomial, at most 32 exact basis polynomials, and 1..8 ordered variables
- shape: symbolic
- returns:
any - example:
normal_form("x"^2, ["x"^2 - "y"], ["x", "y"])
assumptions(expression) -> any
Section titled “assumptions(expression) -> any”Return the normalized explicit domain assumptions required by a symbolic expression.
- domain: bounded real symbolic expression with representable nonzero, nonnegative, or positive definedness conditions
- shape: symbolic
- returns:
any - example:
assumptions(1 / "x")
cancel(expression) -> tuple[Sym, list[Sym]]
Section titled “cancel(expression) -> tuple[Sym, list[Sym]]”Condition-aware cancellation returning the simplified expression and every required real-domain condition.
- domain: bounded real symbolic expressions with explicit representable side conditions
- shape: symbolic
- returns:
tuple[Sym, list[Sym]] - example:
cancel("x" / "x")
integrate(expression, variable, lower?, upper?) -> tuple[Sym, list[Sym]]
Section titled “integrate(expression, variable, lower?, upper?) -> tuple[Sym, list[Sym]]”Exact conditional antiderivative for the bounded polynomial, rational-power, and affine-elementary fragment, or an exact definite integral when bounds are provided.
- domain: bounded exact rational powers plus affine exp/sin/cos/sinh/cosh/ln/sqrt/reciprocal forms; optional exact bounds must satisfy every side condition
- shape: symbolic
- returns:
tuple[Sym, list[Sym]] - example:
integrate("x"^2, "x")
limit(expression, variable, point, side?) -> tuple[Sym, list[Sym]]
Section titled “limit(expression, variable, point, side?) -> tuple[Sym, list[Sym]]”Exact rational-function limit with one-sided pole behavior or substitution-checked continuous elementary limit, preserving source-domain conditions and typed unknown outcomes.
- domain: bounded exact univariate rational functions or domain-valid continuous elementary expressions at an exact finite point; side is both, left, or right
- shape: symbolic
- returns:
tuple[Sym, list[Sym]] - example:
limit(("x"^2 - 1) / ("x" - 1), "x", 1)
series(expression, variable, point, order) -> tuple[Sym, list[Sym]]
Section titled “series(expression, variable, point, order) -> tuple[Sym, list[Sym]]”Exact rational-recurrence or derivative-generated Taylor polynomial through the requested order with source-domain conditions.
- domain: bounded exact univariate rational or differentiable elementary Taylor series at an exact finite point, order 0..=12; Laurent poles unsupported
- shape: symbolic
- returns:
tuple[Sym, list[Sym]] - example:
series(1 / (1 - "x"), "x", 0, 3)
partial(expression, variable) -> any
Section titled “partial(expression, variable) -> any”Symbolic partial derivative using the checked product, chain, and power rules.
- domain: bounded exact/formal symbolic expression and one explicit differentiation variable
- shape: symbolic
- returns:
any - example:
partial(sin("x") * "x", "x")
taylor(expression, variable, point, order) -> tuple[Sym, list[Sym]]
Section titled “taylor(expression, variable, point, order) -> tuple[Sym, list[Sym]]”Alias of the checked bounded Taylor-series kernel.
- domain: bounded exact univariate rational or differentiable elementary Taylor series at an exact finite point, order 0..=12
- shape: symbolic
- returns:
tuple[Sym, list[Sym]] - example:
taylor(exp("x"), "x", 0, 4)
symbolic.sum(expression, variable, lower, upper) -> any
Section titled “symbolic.sum(expression, variable, lower, upper) -> any”Exact bounded inclusive symbolic summation by checked substitution.
- domain: exact symbolic expression over an inclusive finite i64 interval of at most 1024 terms
- shape: reduction
- returns:
any - example:
symbolic.sum("k"^2, "k", 1, 4)
symbolic.product(expression, variable, lower, upper) -> any
Section titled “symbolic.product(expression, variable, lower, upper) -> any”Exact bounded inclusive symbolic product by checked substitution.
- domain: exact symbolic expression over an inclusive finite i64 interval of at most 1024 terms
- shape: reduction
- returns:
any - example:
symbolic.product("k", "k", 1, 5)
formal
Section titled “formal”rewrite(source, target) -> ProofResult
Section titled “rewrite(source, target) -> ProofResult”Produce and independently replay an exact polynomial identity certificate authorizing the requested rewrite; never returns Proved from producer output alone.
- domain: bounded exact ZZ polynomial identity: at most 8 variables, degree 32, 4096 terms, and i128 coefficients
- shape: constructor
- returns:
ProofResult - example:
rewrite(("x" + 1)^2, "x"^2 + 2*"x" + 1)
prove_bezout(left, right) -> ProofResult
Section titled “prove_bezout(left, right) -> ProofResult”Produce and independently replay an exact ZZ certificate that leftx + righty equals the canonical nonnegative gcd. Results expose typed certificate_data and a domain-separated SHA-256 proof_ref while retaining legacy certificate text and legacy_proof_ref for migration; unsupported bounds return Unknown.
- domain: exact integers of at most 4,096 bits; producer and independent checker each allow at most 10,000 Euclidean steps
- shape: constructor
- returns:
ProofResult - example:
prove_bezout(-240, 46)
verify_bezout(left, right, gcd, left_coefficient, right_coefficient) -> ProofResult
Section titled “verify_bezout(left, right, gcd, left_coefficient, right_coefficient) -> ProofResult”Independently replay caller-supplied certificate fields; corruption and resource bounds return Unknown and can never forge an accepted proof.
- domain: caller-supplied v1/ZZ Bézout fields, each at most 4,096 bits; independent checker allows at most 10,000 Euclidean steps
- shape: constructor
- returns:
ProofResult - example:
verify_bezout(-240, 46, 2, 9, 47)
number_theory
Section titled “number_theory”is_prime(value) -> bool
Section titled “is_prime(value) -> bool”Deterministic bounded primality predicate; larger integers return typed NotImplemented.
- domain: exact non-negative integer through 2^32-1; deterministic bounded trial division
- shape: scalar
- returns:
bool - example:
is_prime(104729)
factorint(value) -> list[tuple[int, int]]
Section titled “factorint(value) -> list[tuple[int, int]]”Exact prime factorization as sorted (prime, exponent) pairs; zero and negatives fail typed.
- domain: exact positive integer through 2^32-1; deterministic bounded trial division
- shape: constructor
- returns:
list[tuple[int, int]] - example:
factorint(360)
next_prime(value) -> int
Section titled “next_prime(value) -> int”Least prime strictly greater than value under a bounded deterministic candidate search.
- domain: exact non-negative integer through 2^32-1; result must remain inside the bounded profile
- shape: scalar
- returns:
int - example:
next_prime(100)
prev_prime(value) -> int
Section titled “prev_prime(value) -> int”Greatest prime strictly less than value; integers <= 2 fail with DomainError.
- domain: exact integer in 3..=2^32-1; deterministic bounded candidate search
- shape: scalar
- returns:
int - example:
prev_prime(100)
totient(value) -> int
Section titled “totient(value) -> int”Exact Euler totient; zero, negatives, and integers above the bounded profile fail typed.
- domain: exact positive integer through 2^32-1; deterministic bounded factorization
- shape: scalar
- returns:
int - example:
totient(36)
divisors(value) -> list[int]
Section titled “divisors(value) -> list[int]”All positive divisors in strictly increasing canonical order.
- domain: exact positive integer through 2^32-1; deterministic bounded factorization
- shape: constructor
- returns:
list[int] - example:
divisors(36)
divisor_count(value) -> int
Section titled “divisor_count(value) -> int”Exact count of positive divisors from the canonical prime factorization.
- domain: exact positive integer through 2^32-1; deterministic bounded factorization
- shape: scalar
- returns:
int - example:
divisor_count(360)
mobius(value) -> int
Section titled “mobius(value) -> int”Exact Möbius function in {-1, 0, 1}; repeated prime factors map to zero.
- domain: exact positive integer through 2^32-1; deterministic bounded factorization
- shape: scalar
- returns:
int - example:
mobius(30)
mod_inverse(value, modulus) -> int
Section titled “mod_inverse(value, modulus) -> int”Canonical modular inverse in 0..modulus via bounded extended Euclid.
- domain: exact integers under the 16,384-bit ceiling, modulus >= 2, and gcd(value, modulus) = 1
- shape: scalar
- returns:
int - example:
mod_inverse(-3, 11)
crt(moduli, residues) -> tuple[int, int]
Section titled “crt(moduli, residues) -> tuple[int, int]”Generalized Chinese remainder merge returning the least nonnegative solution and LCM modulus; consistent non-coprime systems are supported.
- domain: equal-length exact integer lists with 0..=256 positive moduli and a consistent generalized CRT system; combined modulus <= 16,384 bits
- shape: constructor
- returns:
tuple[int, int] - example:
crt([3, 5, 7], [2, 3, 2])
chinese_remainder(moduli, residues) -> tuple[int, int]
Section titled “chinese_remainder(moduli, residues) -> tuple[int, int]”Alias of crt, returning the canonical solution and combined modulus.
- domain: equal-length exact integer lists with 0..=256 positive moduli and a consistent generalized CRT system; combined modulus <= 16,384 bits
- shape: constructor
- returns:
tuple[int, int] - example:
chinese_remainder([6, 8], [4, 4])
integer_nth_root(value, degree) -> int
Section titled “integer_nth_root(value, degree) -> int”Floor exact integer root using bounded overflow-aware binary search.
- domain: nonnegative exact value through 2^32-1 and integer degree in 1..=64
- shape: scalar
- returns:
int - example:
integer_nth_root(28, 3)
continued_fraction(value) -> list[int]
Section titled “continued_fraction(value) -> list[int]”Canonical finite simple continued fraction using bounded Euclidean division.
- domain: one exact rational under the scalar bit ceiling
- shape: constructor
- returns:
list[int] - example:
continued_fraction(415 / 93)
diophantine(left, right, target) -> tuple[int, int]
Section titled “diophantine(left, right, target) -> tuple[int, int]”One deterministic exact solution to leftx + righty = target from bounded extended Euclid.
- domain: three exact integers under the scalar bit ceiling with target divisible by gcd(left, right)
- shape: constructor
- returns:
tuple[int, int] - example:
diophantine(15, 21, 6)
quadratic_residues(modulus) -> list[int]
Section titled “quadratic_residues(modulus) -> list[int]”Sorted distinct quadratic residues from a bounded exhaustive modular enumeration.
- domain: positive exact modulus at most 65,536
- shape: constructor
- returns:
list[int] - example:
quadratic_residues(11)
discrete_log(base, target, modulus) -> int
Section titled “discrete_log(base, target, modulus) -> int”Least nonnegative modular exponent from a bounded exhaustive orbit search.
- domain: exact integer residues with modulus in 2..=65,536 and target in the generated orbit
- shape: scalar
- returns:
int - example:
discrete_log(2, 8, 13)
primitive_root(modulus) -> int
Section titled “primitive_root(modulus) -> int”Least primitive root of a bounded prime modulus, qualified against the prime factors of p-1.
- domain: prime exact modulus in 2..=65,536
- shape: scalar
- returns:
int - example:
primitive_root(17)
prime_nth(index) -> int
Section titled “prime_nth(index) -> int”The index-th prime, 1-indexed (prime_nth(1) = 2), from a preflighted deterministic sieve.
- domain: exact integer index in 1..=100,000; deterministic bounded sieve
- shape: scalar
- returns:
int - example:
prime_nth(25)
prime(index) -> int
Section titled “prime(index) -> int”Alias of prime_nth.
- domain: exact integer index in 1..=100,000; deterministic bounded sieve
- shape: scalar
- returns:
int - example:
prime(25)
prime_count(value) -> int
Section titled “prime_count(value) -> int”Exact prime-counting function pi(value) over the bounded sieve profile.
- domain: exact non-negative integer through 2,000,000; deterministic bounded sieve
- shape: scalar
- returns:
int - example:
prime_count(100)
primepi(value) -> int
Section titled “primepi(value) -> int”Alias of prime_count.
- domain: exact non-negative integer through 2,000,000; deterministic bounded sieve
- shape: scalar
- returns:
int - example:
primepi(541)
interpolation
Section titled “interpolation”interpolate(xs, ys, x) -> int | rational | float
Section titled “interpolate(xs, ys, x) -> int | rational | float”Evaluate the unique degree <= n-1 interpolating polynomial (Newton form) at the query point; duplicate knots and non-finite values fail typed.
- domain: 1..=64 distinct knots with equal-length values and a scalar query; all-exact inputs stay exact under the 16,384-bit ceiling, any float input evaluates in strict finite f64
- shape: reduction
- returns:
int | rational | float - example:
interpolate([0, 1, 2], [1, 3, 7], 4)
polynomial_interpolate(xs, ys) -> list[int | rational | float]
Section titled “polynomial_interpolate(xs, ys) -> list[int | rational | float]”Ascending monomial coefficients (exactly one per sample point) of the unique interpolating polynomial; entry i multiplies x^i and trailing zeros are kept.
- domain: 1..=64 distinct knots with equal-length values; all-exact inputs stay exact under the 16,384-bit ceiling, any float input evaluates in strict finite f64
- shape: constructor
- returns:
list[int | rational | float] - example:
polynomial_interpolate([0, 1, 2], [1, 3, 7])
linear_interpolate(xs, ys, x) -> float
Section titled “linear_interpolate(xs, ys, x) -> float”Piecewise-linear interpolation without implicit extrapolation.
- domain: 1..=64 equal finite samples with strictly increasing knots and a finite query inside the closed knot range
- shape: reduction
- returns:
float - example:
linear_interpolate([0.0, 1.0], [2.0, 4.0], 0.25)
nearest_interpolate(xs, ys, x) -> float
Section titled “nearest_interpolate(xs, ys, x) -> float”Nearest-neighbor interpolation; exact midpoint ties choose the lower knot.
- domain: 1..=64 equal finite samples with strictly increasing knots and a finite query inside the closed knot range
- shape: reduction
- returns:
float - example:
nearest_interpolate([0.0, 1.0], [2.0, 4.0], 0.5)
spline(xs, ys, x) -> float
Section titled “spline(xs, ys, x) -> float”Natural cubic spline interpolation without implicit extrapolation.
- domain: 2..=64 equal finite samples with strictly increasing knots and a finite query inside the closed knot range
- shape: reduction
- returns:
float - example:
spline([0.0, 1.0, 2.0], [0.0, 1.0, 0.0], 0.5)
cubic_spline(xs, ys, x) -> float
Section titled “cubic_spline(xs, ys, x) -> float”Explicit alias of the natural cubic spline evaluator.
- domain: same bounded natural-cubic contract as spline
- shape: reduction
- returns:
float - example:
cubic_spline([0.0, 1.0, 2.0], [0.0, 1.0, 0.0], 0.5)
bspline(control_points, degree, parameter) -> float
Section titled “bspline(control_points, degree, parameter) -> float”Open-uniform scalar B-spline evaluated by bounded de Boor recursion.
- domain: 1..=64 finite scalar control points, degree in 0..control_points.len(), and finite parameter in [0, 1]
- shape: reduction
- returns:
float - example:
bspline([0.0, 1.0, 0.0], 2, 0.5)
resample(values, count) -> Vec
Section titled “resample(values, count) -> Vec”Endpoint-preserving piecewise-linear resampling on a uniform index grid.
- domain: 1..=1,000,000 finite real values and output count in the same range
- shape: constructor
- returns:
Vec - example:
resample([0.0, 2.0], 5)
rbf_interpolate(points, values, query, epsilon) -> float
Section titled “rbf_interpolate(points, values, query, epsilon) -> float”Gaussian radial-basis interpolation with an explicit shape parameter and checked linear solve.
- domain: 1..=64 distinct finite points of matching dimension 1..=64, equal finite values, finite query, and epsilon > 0; Gaussian kernel system must pass checked dense solve
- shape: reduction
- returns:
float - example:
rbf_interpolate([[0.0], [1.0]], [0.0, 1.0], [0.5], 1.0)
statistics
Section titled “statistics”expectation(values) -> float
Section titled “expectation(values) -> float”Empirical expectation, identical to the bounded population mean.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
expectation([1.0, 2.0, 3.0])
E(values) -> float
Section titled “E(values) -> float”Alias of expectation.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
E([1.0, 2.0, 3.0])
mean(values) -> float
Section titled “mean(values) -> float”Population mean using scaled compensated accumulation.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
mean([1.0, 2.0, 3.0])
variance(values) -> float
Section titled “variance(values) -> float”Population variance with ddof=0 using a two-pass scaled centered moment.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
variance([1.0, 2.0, 3.0])
Var(values) -> float
Section titled “Var(values) -> float”Alias of population variance.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
Var([1.0, 2.0, 3.0])
std(values) -> float
Section titled “std(values) -> float”Population standard deviation with ddof=0.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
std([1.0, 2.0, 3.0])
covariance(left, right) -> float
Section titled “covariance(left, right) -> float”Population covariance with ddof=0 over equal-length samples.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
covariance([1.0, 2.0], [2.0, 4.0])
Cov(left, right) -> float
Section titled “Cov(left, right) -> float”Alias of population covariance.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
Cov([1.0, 2.0], [2.0, 4.0])
correlation(left, right) -> float
Section titled “correlation(left, right) -> float”Pearson population correlation; zero-variance samples fail typed.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
correlation([1.0, 2.0], [2.0, 4.0])
Corr(left, right) -> float
Section titled “Corr(left, right) -> float”Alias of Pearson population correlation.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
Corr([1.0, 2.0], [2.0, 4.0])
entropy(values) -> float
Section titled “entropy(values) -> float”Shannon entropy in nats over a strict probability simplex.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
entropy([0.25, 0.75])
H(values) -> float
Section titled “H(values) -> float”Alias of Shannon entropy in nats.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
H([0.25, 0.75])
cross_entropy(left, right) -> float
Section titled “cross_entropy(left, right) -> float”Cross entropy in nats under a strict finite-result simplex contract.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
cross_entropy([0.25, 0.75], [0.5, 0.5])
kl_divergence(left, right) -> float
Section titled “kl_divergence(left, right) -> float”Kullback-Leibler divergence in nats under a strict finite-result simplex contract.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
kl_divergence([0.25, 0.75], [0.5, 0.5])
D_KL(left, right) -> float
Section titled “D_KL(left, right) -> float”Alias of Kullback-Leibler divergence in nats.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
D_KL([0.25, 0.75], [0.5, 0.5])
js_divergence(left, right) -> float
Section titled “js_divergence(left, right) -> float”Symmetric Jensen-Shannon divergence in nats.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
js_divergence([0.25, 0.75], [0.5, 0.5])
JS(left, right) -> float
Section titled “JS(left, right) -> float”Alias of Jensen-Shannon divergence in nats.
- domain: 1..=1,000,000 finite real values in flat lists, tuples, or rank-1 vectors; population statistics use ddof=0; information statistics require strict simplexes and return nats
- shape: reduction
- returns:
float - example:
JS([0.25, 0.75], [0.5, 0.5])
probability(indicators) -> float
Section titled “probability(indicators) -> float”Empirical probability as the bounded mean of an explicit indicator sample.
- domain: one nonempty finite 0/1 indicator sample of length at most 1,000,000
- shape: reduction
- returns:
float - example:
probability([1, 0, 1])
P(indicators) -> float
Section titled “P(indicators) -> float”Compact alias of empirical probability.
- domain: same explicit indicator-sample contract as probability
- shape: reduction
- returns:
float - example:
P([1, 0, 1])
conditional_probability(event, condition) -> float
Section titled “conditional_probability(event, condition) -> float”Empirical P(event | condition) from paired explicit indicators.
- domain: equal nonempty finite 0/1 indicator samples of length at most 1,000,000 with at least one true condition
- shape: reduction
- returns:
float - example:
conditional_probability([1, 0, 1], [1, 1, 0])
moment(values, order) -> float
Section titled “moment(values, order) -> float”Raw empirical moment E[X^order] with compensated accumulation.
- domain: one nonempty finite-real sample of length at most 1,000,000 and raw integer order in 0..=64; result must remain finite
- shape: reduction
- returns:
float - example:
moment([1.0, 2.0, 3.0], 2)
quantile(values, probability) -> float
Section titled “quantile(values, probability) -> float”Deterministic linear empirical quantile after total-order sorting.
- domain: one nonempty finite-real sample of length at most 1,000,000 and finite probability in [0, 1]
- shape: reduction
- returns:
float - example:
quantile([1.0, 2.0, 4.0], 0.5)
histogram(values, bins) -> any
Section titled “histogram(values, bins) -> any”Pair of exact bin counts and finite edges over an automatic endpoint-inclusive range.
- domain: one nonempty finite-real sample of length at most 1,000,000 and 1..=65,536 equal-width bins
- shape: reduction
- returns:
any - example:
histogram([0.0, 0.5, 1.0], 2)
mutual_information(joint) -> float
Section titled “mutual_information(joint) -> float”Discrete mutual information in nats from an explicit joint-probability matrix.
- domain: one nonempty rank-2 nonnegative joint simplex summing to one within 1e-12
- shape: reduction
- returns:
float - example:
mutual_information([[0.5, 0.0], [0.0, 0.5]])
MI(joint) -> float
Section titled “MI(joint) -> float”Compact alias of mutual_information.
- domain: same explicit joint-simplex contract as mutual_information
- shape: reduction
- returns:
float - example:
MI([[0.5, 0.0], [0.0, 0.5]])
bayes_update(prior, likelihood) -> Vec
Section titled “bayes_update(prior, likelihood) -> Vec”Normalized categorical posterior from an explicit prior and likelihood vector.
- domain: equal nonempty finite vectors of length at most 1,000,000; prior is a simplex, likelihoods are nonnegative, and evidence is positive finite
- shape: constructor
- returns:
Vec - example:
bayes_update([0.5, 0.5], [0.8, 0.2])
transforms
Section titled “transforms”convolution(left, right) -> Vec
Section titled “convolution(left, right) -> Vec”Deterministic rank-1 full linear convolution with compensated accumulation and typed resource/nonfinite failures.
- domain: two non-empty finite real lists, tuples, or rank-1 vectors whose full output has at most 1,000,000 elements and direct work at most 10,000,000 multiply-adds
- shape: contraction
- returns:
Vec - example:
convolve([1.0, 2.0], [3.0, 4.0])
convolve(left, right) -> Vec
Section titled “convolve(left, right) -> Vec”Deterministic rank-1 full linear convolution with compensated accumulation and typed resource/nonfinite failures.
- domain: two non-empty finite real lists, tuples, or rank-1 vectors whose full output has at most 1,000,000 elements and direct work at most 10,000,000 multiply-adds
- shape: contraction
- returns:
Vec - example:
convolve([1.0, 2.0], [3.0, 4.0])
cross_correlation(left, right) -> Vec
Section titled “cross_correlation(left, right) -> Vec”Deterministic rank-1 full cross-correlation in ascending lag order with compensated accumulation and typed resource/nonfinite failures.
- domain: two non-empty finite real lists, tuples, or rank-1 vectors whose full lag output has at most 1,000,000 elements and direct work at most 10,000,000 multiply-adds
- shape: contraction
- returns:
Vec - example:
correlate([1.0, 2.0, 3.0], [4.0, 5.0])
correlate(left, right) -> Vec
Section titled “correlate(left, right) -> Vec”Deterministic rank-1 full cross-correlation in ascending lag order with compensated accumulation and typed resource/nonfinite failures.
- domain: two non-empty finite real lists, tuples, or rank-1 vectors whose full lag output has at most 1,000,000 elements and direct work at most 10,000,000 multiply-adds
- shape: contraction
- returns:
Vec - example:
correlate([1.0, 2.0, 3.0], [4.0, 5.0])
dft(signal) -> Vec[float | complex]
Section titled “dft(signal) -> Vec[float | complex]”Deterministic forward discrete Fourier transform with the negative-exponent convention and no forward normalization.
- domain: nonempty finite real/complex rank-1 signal of at most 16,384 points; direct work is capped at 4,194,304 terms
- shape: transform
- returns:
Vec[float | complex] - example:
dft([1.0, 0.0, -1.0, 0.0])
DFT(signal) -> Vec[float | complex]
Section titled “DFT(signal) -> Vec[float | complex]”Uppercase alias of dft.
- domain: same bounded signal contract as dft
- shape: transform
- returns:
Vec[float | complex] - example:
DFT([1.0, 0.0, -1.0, 0.0])
fft(signal) -> Vec[float | complex]
Section titled “fft(signal) -> Vec[float | complex]”Deterministic forward FFT with the DFT convention; arbitrary bounded lengths are accepted.
- domain: nonempty finite real/complex rank-1 signal of at most 16,384 points; power-of-two inputs use radix-2 and other lengths use the bounded direct transform
- shape: transform
- returns:
Vec[float | complex] - example:
fft([1.0, 0.0, -1.0, 0.0])
FFT(signal) -> Vec[float | complex]
Section titled “FFT(signal) -> Vec[float | complex]”Uppercase alias of fft.
- domain: same bounded signal contract as fft
- shape: transform
- returns:
Vec[float | complex] - example:
FFT([1.0, 0.0, -1.0, 0.0])
ifft(signal) -> Vec[float | complex]
Section titled “ifft(signal) -> Vec[float | complex]”Inverse DFT/FFT using positive exponent and exact 1/n normalization.
- domain: nonempty finite real/complex rank-1 spectrum of at most 16,384 points under the same work ceilings as fft
- shape: transform
- returns:
Vec[float | complex] - example:
ifft(fft([1.0, 2.0, 3.0, 4.0]))
IFFT(signal) -> Vec[float | complex]
Section titled “IFFT(signal) -> Vec[float | complex]”Uppercase alias of ifft.
- domain: same bounded spectrum contract as ifft
- shape: transform
- returns:
Vec[float | complex] - example:
IFFT(FFT([1.0, 2.0, 3.0, 4.0]))
autocorrelation(signal) -> Vec[float | complex]
Section titled “autocorrelation(signal) -> Vec[float | complex]”Full Hermitian autocorrelation in ascending lag order from -(n-1) through n-1.
- domain: nonempty finite real/complex rank-1 signal whose direct n^2 work is at most 4,194,304 terms
- shape: transform
- returns:
Vec[float | complex] - example:
autocorrelation([1.0, 2.0, 3.0])
stft(signal, window_size, hop_size) -> Matrix[float | complex]
Section titled “stft(signal, window_size, hop_size) -> Matrix[float | complex]”Short-time Fourier transform returning a frame-by-frequency complex matrix with deterministic framing and no implicit padding.
- domain: nonempty finite real/complex rank-1 signal; 1 <= hop_size <= window_size <= signal length; complete frames only, periodic Hann window, at most 32,000,000 bounded transform-work units
- shape: transform
- returns:
Matrix[float | complex] - example:
stft([1.0, 2.0, 3.0, 4.0], 2, 1)
STFT(signal, window_size, hop_size) -> Matrix[float | complex]
Section titled “STFT(signal, window_size, hop_size) -> Matrix[float | complex]”Short-time Fourier transform returning a frame-by-frequency complex matrix with deterministic framing and no implicit padding.
- domain: nonempty finite real/complex rank-1 signal; 1 <= hop_size <= window_size <= signal length; complete frames only, periodic Hann window, at most 32,000,000 bounded transform-work units
- shape: transform
- returns:
Matrix[float | complex] - example:
stft([1.0, 2.0, 3.0, 4.0], 2, 1)
hilbert_transform(signal) -> Vec[float | complex]
Section titled “hilbert_transform(signal) -> Vec[float | complex]”Analytic signal formed by the standard one-sided DFT multiplier; the real part reconstructs the input.
- domain: nonempty finite-real rank-1 signal of at most 16,384 points under the fft work contract
- shape: transform
- returns:
Vec[float | complex] - example:
hilbert_transform([1.0, 0.0, -1.0, 0.0])
wavelet(signal, levels) -> Vec[float | complex]
Section titled “wavelet(signal, levels) -> Vec[float | complex]”Orthonormal Haar discrete wavelet transform with recursively packed approximation/detail coefficients.
- domain: nonempty finite real/complex power-of-two rank-1 signal through 16,384 points; levels is in 1..=log2(length)
- shape: transform
- returns:
Vec[float | complex] - example:
wavelet([1.0, 1.0, -1.0, -1.0], 2)
radon_transform(image, angles) -> Matrix
Section titled “radon_transform(image, angles) -> Matrix”Deterministic pixel-driven parallel-beam Radon transform using linear detector-bin splatting.
- domain: nonempty finite rank-2 real image and 1..=720 finite angles in radians; detector count spans the odd diagonal and pixel/angle work is capped at 32,000,000
- shape: transform
- returns:
Matrix - example:
radon_transform([[1.0, 0.0], [0.0, 1.0]], [0.0, 1.5707963267948966])
distributions
Section titled “distributions”normal_pdf(x, loc, scale) -> float
Section titled “normal_pdf(x, loc, scale) -> float”Normal probability density; finite tail underflow returns canonical +0.0.
- domain: finite real x and loc with finite scale > 0; scalar only; pdf may underflow to +0.0, cdf/sf may saturate within [0, 1], and unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_pdf(1.0, 0.0, 1.0)
normal_logpdf(x, loc, scale) -> float
Section titled “normal_logpdf(x, loc, scale) -> float”Normal log-density computed directly without taking the logarithm of an underflowed density.
- domain: finite real x and loc with finite scale > 0; scalar only; pdf may underflow to +0.0, cdf/sf may saturate within [0, 1], and unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_logpdf(1.0, 0.0, 1.0)
normal_cdf(x, loc, scale) -> float
Section titled “normal_cdf(x, loc, scale) -> float”Normal cumulative distribution with stable finite-tail evaluation and closed [0, 1] saturation.
- domain: finite real x and loc with finite scale > 0; scalar only; pdf may underflow to +0.0, cdf/sf may saturate within [0, 1], and unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_cdf(1.0, 0.0, 1.0)
normal_sf(x, loc, scale) -> float
Section titled “normal_sf(x, loc, scale) -> float”Normal survival function evaluated directly rather than as 1 - cdf, preserving upper-tail precision.
- domain: finite real x and loc with finite scale > 0; scalar only; pdf may underflow to +0.0, cdf/sf may saturate within [0, 1], and unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_sf(1.0, 0.0, 1.0)
normal_logcdf(x, loc, scale) -> float
Section titled “normal_logcdf(x, loc, scale) -> float”Normal log-CDF evaluated directly with stable lower-tail precision.
- domain: finite real x and loc with finite scale > 0; scalar only; pdf may underflow to +0.0, cdf/sf may saturate within [0, 1], and unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_logcdf(1.0, 0.0, 1.0)
normal_logsf(x, loc, scale) -> float
Section titled “normal_logsf(x, loc, scale) -> float”Normal log-survival evaluated directly with stable upper-tail precision.
- domain: finite real x and loc with finite scale > 0; scalar only; pdf may underflow to +0.0, cdf/sf may saturate within [0, 1], and unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_logsf(1.0, 0.0, 1.0)
normal_ppf(p, loc, scale) -> float
Section titled “normal_ppf(p, loc, scale) -> float”Normal quantile for a strict interior probability, with location and scale transformation.
- domain: finite real p, loc, and scale with 0 < p < 1 and scale > 0; scalar only; unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_ppf(0.975, 0.0, 1.0)
normal_logppf(log_p, loc, scale) -> float
Section titled “normal_logppf(log_p, loc, scale) -> float”Normal quantile from a strict negative log-probability, preserving underflowed and near-one probabilities.
- domain: finite real log_p, loc, and scale with log_p < 0 and scale > 0; scalar only; unrepresentable results fail typed
- shape: scalar
- returns:
float - example:
normal_logppf(-800.0, 0.0, 1.0)
normal_sample(loc, scale, count, seed) -> Vec
Section titled “normal_sample(loc, scale, count, seed) -> Vec”Deterministic explicit-seed Normal sampling via SplitMix64 and Box-Muller; no ambient entropy.
- domain: finite loc, scale > 0, count in 1..=1,000,000, and a nonnegative 64-bit explicit seed
- shape: constructor
- returns:
Vec - example:
normal_sample(0.0, 1.0, 4, 42)
normal_moments(loc, scale) -> Vec
Section titled “normal_moments(loc, scale) -> Vec”Normal [mean, variance, skewness, excess_kurtosis].
- domain: finite loc and scale > 0
- shape: constructor
- returns:
Vec - example:
normal_moments(2.0, 3.0)
normal_fit(samples) -> Vec
Section titled “normal_fit(samples) -> Vec”Bounded Normal maximum-likelihood [location, scale] fit using stable online moments.
- domain: 2..=1,000,000 finite real samples with positive MLE variance
- shape: reduction
- returns:
Vec - example:
normal_fit([-1.0, 1.0])
normal_log_likelihood(samples, loc, scale) -> float
Section titled “normal_log_likelihood(samples, loc, scale) -> float”Compensated finite Normal log-likelihood.
- domain: 1..=1,000,000 finite real samples, finite loc, and scale > 0
- shape: reduction
- returns:
float - example:
normal_log_likelihood([-1.0, 1.0], 0.0, 1.0)
bernoulli_pmf(outcome, probability) -> float
Section titled “bernoulli_pmf(outcome, probability) -> float”Bernoulli probability mass, returning zero outside outcomes {0, 1}.
- domain: exact integer outcome and finite 0 < probability < 1
- shape: scalar
- returns:
float - example:
bernoulli_pmf(1, 0.25)
bernoulli_cdf(outcome, probability) -> float
Section titled “bernoulli_cdf(outcome, probability) -> float”Bernoulli cumulative distribution.
- domain: exact integer outcome and finite 0 < probability < 1
- shape: scalar
- returns:
float - example:
bernoulli_cdf(0, 0.25)
bernoulli_ppf(quantile, probability) -> int
Section titled “bernoulli_ppf(quantile, probability) -> int”Bernoulli inverse cumulative distribution.
- domain: finite strict-interior quantile and 0 < probability < 1
- shape: scalar
- returns:
int - example:
bernoulli_ppf(0.8, 0.25)
bernoulli_sample(probability, count, seed) -> list[int]
Section titled “bernoulli_sample(probability, count, seed) -> list[int]”Deterministic explicit-seed Bernoulli samples.
- domain: finite 0 < probability < 1, count in 1..=1,000,000, and a nonnegative 64-bit explicit seed
- shape: constructor
- returns:
list[int] - example:
bernoulli_sample(0.25, 4, 42)
bernoulli_moments(probability) -> Vec
Section titled “bernoulli_moments(probability) -> Vec”Bernoulli [mean, variance, skewness, excess_kurtosis].
- domain: finite 0 < probability < 1
- shape: constructor
- returns:
Vec - example:
bernoulli_moments(0.25)
bernoulli_fit(samples) -> float
Section titled “bernoulli_fit(samples) -> float”Bernoulli maximum-likelihood probability fit.
- domain: 1..=1,000,000 exact samples in {0, 1}
- shape: reduction
- returns:
float - example:
bernoulli_fit([0, 1, 1, 0])
bernoulli_log_likelihood(samples, probability) -> float
Section titled “bernoulli_log_likelihood(samples, probability) -> float”Finite Bernoulli log-likelihood.
- domain: 1..=1,000,000 exact samples in {0, 1} and finite 0 < probability < 1
- shape: reduction
- returns:
float - example:
bernoulli_log_likelihood([0, 1], 0.5)
uniform_pdf(value, low, high) -> float
Section titled “uniform_pdf(value, low, high) -> float”Continuous uniform density on the closed support.
- domain: finite value and finite high > low
- shape: scalar
- returns:
float - example:
uniform_pdf(0.0, -1.0, 1.0)
uniform_cdf(value, low, high) -> float
Section titled “uniform_cdf(value, low, high) -> float”Continuous uniform cumulative distribution.
- domain: finite value and finite high > low
- shape: scalar
- returns:
float - example:
uniform_cdf(0.0, -1.0, 1.0)
uniform_ppf(quantile, low, high) -> float
Section titled “uniform_ppf(quantile, low, high) -> float”Continuous uniform inverse cumulative distribution.
- domain: finite 0 < quantile < 1 and finite high > low
- shape: scalar
- returns:
float - example:
uniform_ppf(0.75, -1.0, 1.0)
uniform_sample(low, high, count, seed) -> Vec
Section titled “uniform_sample(low, high, count, seed) -> Vec”Deterministic explicit-seed continuous uniform samples.
- domain: finite high > low, count in 1..=1,000,000, and a nonnegative 64-bit explicit seed
- shape: constructor
- returns:
Vec - example:
uniform_sample(-1.0, 1.0, 4, 42)
uniform_moments(low, high) -> Vec
Section titled “uniform_moments(low, high) -> Vec”Continuous uniform [mean, variance, skewness, excess_kurtosis].
- domain: finite high > low
- shape: constructor
- returns:
Vec - example:
uniform_moments(-1.0, 1.0)
uniform_fit(samples) -> Vec
Section titled “uniform_fit(samples) -> Vec”Continuous uniform [low, high] maximum-likelihood support fit.
- domain: 1..=1,000,000 finite real samples with distinct extrema
- shape: reduction
- returns:
Vec - example:
uniform_fit([-2.0, 1.0, 4.0])
uniform_log_likelihood(samples, low, high) -> float
Section titled “uniform_log_likelihood(samples, low, high) -> float”Finite continuous uniform log-likelihood; out-of-support samples fail typed.
- domain: 1..=1,000,000 finite real samples all inside finite high > low
- shape: reduction
- returns:
float - example:
uniform_log_likelihood([-1.0, 1.0], -2.0, 2.0)
exponential_pdf(value, rate) -> float
Section titled “exponential_pdf(value, rate) -> float”Exponential density, zero below its support.
- domain: finite value and finite rate > 0
- shape: scalar
- returns:
float - example:
exponential_pdf(1.0, 2.0)
exponential_cdf(value, rate) -> float
Section titled “exponential_cdf(value, rate) -> float”Stable exponential cumulative distribution.
- domain: finite value and finite rate > 0
- shape: scalar
- returns:
float - example:
exponential_cdf(1.0, 2.0)
exponential_ppf(quantile, rate) -> float
Section titled “exponential_ppf(quantile, rate) -> float”Exponential inverse cumulative distribution using log1p.
- domain: finite 0 < quantile < 1 and finite rate > 0
- shape: scalar
- returns:
float - example:
exponential_ppf(0.8, 2.0)
exponential_sample(rate, count, seed) -> Vec
Section titled “exponential_sample(rate, count, seed) -> Vec”Deterministic explicit-seed exponential samples by inverse transform.
- domain: finite rate > 0, count in 1..=1,000,000, and a nonnegative 64-bit explicit seed
- shape: constructor
- returns:
Vec - example:
exponential_sample(2.0, 4, 42)
exponential_moments(rate) -> Vec
Section titled “exponential_moments(rate) -> Vec”Exponential [mean, variance, skewness, excess_kurtosis].
- domain: finite rate > 0
- shape: constructor
- returns:
Vec - example:
exponential_moments(2.0)
exponential_fit(samples) -> float
Section titled “exponential_fit(samples) -> float”Exponential maximum-likelihood rate fit.
- domain: 1..=1,000,000 finite nonnegative samples with positive sum
- shape: reduction
- returns:
float - example:
exponential_fit([0.25, 0.75])
exponential_log_likelihood(samples, rate) -> float
Section titled “exponential_log_likelihood(samples, rate) -> float”Compensated finite exponential log-likelihood.
- domain: 1..=1,000,000 finite nonnegative samples and finite rate > 0
- shape: reduction
- returns:
float - example:
exponential_log_likelihood([0.25, 0.75], 2.0)
poisson_pmf(outcome, rate) -> float
Section titled “poisson_pmf(outcome, rate) -> float”Poisson probability mass with log-gamma scaling; negative outcomes return zero.
- domain: exact integer outcome and finite 0 < rate <= 64
- shape: scalar
- returns:
float - example:
poisson_pmf(4, 4.0)
poisson_cdf(outcome, rate) -> float
Section titled “poisson_cdf(outcome, rate) -> float”Poisson cumulative distribution by bounded compensated recurrence.
- domain: exact integer outcome, finite 0 < rate <= 64, and at most 1,000,000 recurrence steps
- shape: scalar
- returns:
float - example:
poisson_cdf(4, 4.0)
poisson_ppf(quantile, rate) -> int
Section titled “poisson_ppf(quantile, rate) -> int”Poisson inverse cumulative distribution by bounded recurrence.
- domain: finite 0 < quantile < 1, finite 0 < rate <= 64, and at most 1,000,000 recurrence steps
- shape: scalar
- returns:
int - example:
poisson_ppf(0.5, 4.0)
poisson_sample(rate, count, seed) -> list[int]
Section titled “poisson_sample(rate, count, seed) -> list[int]”Deterministic explicit-seed Poisson samples using bounded Knuth draws.
- domain: finite 0 < rate <= 64, count in 1..=1,000,000, a nonnegative 64-bit explicit seed, and at most 32,000,000 draws
- shape: constructor
- returns:
list[int] - example:
poisson_sample(4.0, 4, 42)
poisson_moments(rate) -> Vec
Section titled “poisson_moments(rate) -> Vec”Poisson [mean, variance, skewness, excess_kurtosis].
- domain: finite 0 < rate <= 64
- shape: constructor
- returns:
Vec - example:
poisson_moments(4.0)
poisson_fit(samples) -> float
Section titled “poisson_fit(samples) -> float”Poisson maximum-likelihood rate fit.
- domain: 1..=1,000,000 exact nonnegative samples
- shape: reduction
- returns:
float - example:
poisson_fit([2, 4, 6])
poisson_log_likelihood(samples, rate) -> float
Section titled “poisson_log_likelihood(samples, rate) -> float”Compensated finite Poisson log-likelihood.
- domain: 1..=1,000,000 exact nonnegative samples and finite 0 < rate <= 64
- shape: reduction
- returns:
float - example:
poisson_log_likelihood([2, 4, 6], 4.0)
inference
Section titled “inference”linear_regression(xs, ys) -> Vec
Section titled “linear_regression(xs, ys) -> Vec”Simple ordinary least squares returning [slope, intercept, Pearson r, two-sided p-value, slope stderr, intercept stderr].
- domain: equal finite vectors of length 3..=1,000,000 with nonconstant xs; finite ordinary least-squares outputs
- shape: reduction
- returns:
Vec - example:
linear_regression([1.0, 2.0, 3.0], [2.0, 4.0, 5.0])
regression(xs, ys) -> Vec
Section titled “regression(xs, ys) -> Vec”Descriptive alias of linear_regression with the same six-field evidence vector.
- domain: same bounded simple ordinary least-squares contract as linear_regression
- shape: reduction
- returns:
Vec - example:
regression([1.0, 2.0, 3.0], [2.0, 4.0, 5.0])
pearson_test(left, right) -> Vec
Section titled “pearson_test(left, right) -> Vec”Pearson product-moment correlation and finite two-sided Student-t p-value.
- domain: equal finite vectors of length 3..=1,000,000 with positive variance on both sides
- shape: reduction
- returns:
Vec - example:
pearson_test([1.0, 2.0, 3.0], [1.0, 2.0, 4.0])
spearman_test(left, right) -> Vec
Section titled “spearman_test(left, right) -> Vec”Spearman average-tie rank correlation with asymptotic two-sided p-value.
- domain: equal finite vectors of length 3..=100,000 with nonconstant average-tie ranks
- shape: reduction
- returns:
Vec - example:
spearman_test([1.0, 2.0, 2.0, 4.0], [4.0, 1.0, 2.0, 3.0])
t_test_1samp(samples, expected_mean) -> Vec
Section titled “t_test_1samp(samples, expected_mean) -> Vec”One-sample Student t statistic, two-sided p-value, and degrees of freedom.
- domain: 2..=1,000,000 finite samples with positive variance and a finite expected mean
- shape: reduction
- returns:
Vec - example:
t_test_1samp([1.0, 2.0, 4.0], 2.0)
t_test_ind(left, right) -> Vec
Section titled “t_test_ind(left, right) -> Vec”Welch independent-samples t statistic, two-sided p-value, and effective degrees of freedom.
- domain: two finite samples of length 2..=1,000,000 with positive combined Welch variance
- shape: reduction
- returns:
Vec - example:
t_test_ind([1.0, 2.0, 3.0], [3.0, 4.0, 6.0])
t_test_rel(left, right) -> Vec
Section titled “t_test_rel(left, right) -> Vec”Paired-samples t statistic, two-sided p-value, and degrees of freedom.
- domain: equal finite vectors of length 2..=1,000,000 with positive paired-difference variance
- shape: reduction
- returns:
Vec - example:
t_test_rel([1.0, 2.0, 4.0], [1.5, 1.5, 2.0])
chi_square_test(observed, expected) -> Vec
Section titled “chi_square_test(observed, expected) -> Vec”Pearson chi-square goodness-of-fit statistic, survival probability, and degrees of freedom.
- domain: equal finite vectors of length 2..=1,000,000; observed >= 0, expected > 0, and totals equal within 64 eps
- shape: reduction
- returns:
Vec - example:
chi_square_test([12.0, 18.0, 30.0], [15.0, 15.0, 30.0])
anova_oneway(groups) -> Vec
Section titled “anova_oneway(groups) -> Vec”Classical one-way ANOVA F statistic, survival probability, numerator degrees of freedom, and denominator degrees of freedom.
- domain: a list or tuple of at least two nonempty finite-real groups, at most 1,000,000 total observations, positive within-group variance, and total observations > groups
- shape: reduction
- returns:
Vec - example:
anova_oneway([[1.0, 2.0, 3.0], [3.0, 4.0, 6.0]])
mann_whitney_u(left, right) -> Vec
Section titled “mann_whitney_u(left, right) -> Vec”Mann-Whitney U for the first sample with tie correction, continuity correction, and asymptotic two-sided p-value.
- domain: two nonempty finite samples with at most 100,000 combined sortable observations and positive tie-corrected variance
- shape: reduction
- returns:
Vec - example:
mann_whitney_u([1.0, 2.0, 3.0], [3.0, 4.0, 6.0])
ks_normal_test(samples, loc, scale) -> Vec
Section titled “ks_normal_test(samples, loc, scale) -> Vec”One-sample Kolmogorov-Smirnov statistic against a Normal CDF with bounded asymptotic two-sided p-value.
- domain: 1..=100,000 finite sortable observations, finite loc, and finite scale > 0
- shape: reduction
- returns:
Vec - example:
ks_normal_test([-1.0, 0.0, 1.0], 0.0, 1.0)
arithmetic
Section titled “arithmetic”choose(n, k) -> int
Section titled “choose(n, k) -> int”Exact binomial coefficient; descriptive alias of C(n, k).
- domain: exact machine integers with n >= 0 and 0 <= k <= n
- shape: scalar
- returns:
int - example:
choose(8, 3)
mod(left, right) -> any
Section titled “mod(left, right) -> any”Python-compatible modulo as a callable alias of the % operator.
- domain: two compatible exact, finite-real, symbolic, vector, or matrix numeric operands under ordinary equation broadcasting rules; divisor must be nonzero
- shape: elementwise
- returns:
any - example:
mod(17, 5)
special
Section titled “special”beta(left, right) -> float
Section titled “beta(left, right) -> float”Finite-real beta function evaluated through a stable log-gamma quotient.
- domain: two positive finite real scalars with a finite log-gamma result
- shape: scalar
- returns:
float - example:
beta(2.0, 3.0)
bessel_j(order, value) -> float
Section titled “bessel_j(order, value) -> float”Integer-order Bessel function of the first kind through the pinned libm kernel.
- domain: integer order fitting i32 and a finite real scalar whose result remains finite
- shape: scalar
- returns:
float - example:
bessel_j(0, 1.0)
bessel_y(order, value) -> float
Section titled “bessel_y(order, value) -> float”Integer-order Bessel function of the second kind through the pinned libm kernel.
- domain: integer order fitting i32 and a positive finite real scalar whose result remains finite
- shape: scalar
- returns:
float - example:
bessel_y(0, 1.0)
zeta(value) -> float
Section titled “zeta(value) -> float”Bounded finite-real Riemann zeta using a fixed Euler-Maclaurin evaluation.
- domain: finite real s > 0 except the pole at s = 1
- shape: scalar
- returns:
float - example:
zeta(2.0)
polylog(order, argument) -> float
Section titled “polylog(order, argument) -> float”Bounded finite-real polylogarithm from its defining convergent series.
- domain: finite real order and argument |z| < 1, converging within 100,000 compensated series terms
- shape: scalar
- returns:
float - example:
polylog(2.0, 0.5)
legendre(order, value) -> float
Section titled “legendre(order, value) -> float”Legendre polynomial evaluated by its checked three-term recurrence.
- domain: integer order 0..=10,000 and finite real scalar with finite recurrence intermediates
- shape: scalar
- returns:
float - example:
legendre(3, 0.5)
hermite(order, value) -> float
Section titled “hermite(order, value) -> float”Physicists’ Hermite polynomial evaluated by its checked three-term recurrence.
- domain: integer order 0..=10,000 and finite real scalar with finite recurrence intermediates
- shape: scalar
- returns:
float - example:
hermite(3, 0.5)
lgamma(value) -> float
Section titled “lgamma(value) -> float”Natural logarithm of absolute gamma through the pinned finite libm kernel.
- domain: one finite real scalar whose log-gamma result remains finite
- shape: scalar
- returns:
float - example:
lgamma(5.0)
erf(value) -> float
Section titled “erf(value) -> float”Error function through the pinned finite libm kernel.
- domain: one finite real scalar
- shape: scalar
- returns:
float - example:
erf(0.5)
erfc(value) -> float
Section titled “erfc(value) -> float”Complementary error function through the pinned finite libm kernel.
- domain: one finite real scalar
- shape: scalar
- returns:
float - example:
erfc(0.5)
Γ(value) -> float | Tensor
Section titled “Γ(value) -> float | Tensor”Unicode alias of the checked gamma function.
- domain: same bounded finite scalar/tensor domain as gamma
- shape: elementwise
- returns:
float | Tensor - example:
Γ(4.0)
Β(left, right) -> float
Section titled “Β(left, right) -> float”Unicode alias of the checked beta function.
- domain: same positive finite-real domain as beta
- shape: scalar
- returns:
float - example:
Β(2.0, 3.0)
Jν(order, value) -> float
Section titled “Jν(order, value) -> float”Unicode alias of the checked integer-order Bessel J function.
- domain: same bounded integer-order finite-real domain as bessel_j
- shape: scalar
- returns:
float - example:
Jν(0, 1.0)
Yν(order, value) -> float
Section titled “Yν(order, value) -> float”Unicode alias of the checked integer-order Bessel Y function.
- domain: same bounded integer-order positive-real domain as bessel_y
- shape: scalar
- returns:
float - example:
Yν(0, 1.0)
ζ(value) -> float
Section titled “ζ(value) -> float”Unicode alias of the bounded Riemann zeta function.
- domain: same finite-real domain as zeta
- shape: scalar
- returns:
float - example:
ζ(2.0)
sets_logic
Section titled “sets_logic”greater(left, right) -> bool
Section titled “greater(left, right) -> bool”Strict numeric greater-than predicate with exact comparison before any float boundary.
- domain: two ordered finite real or exact rational scalars
- shape: scalar
- returns:
bool - example:
greater(3, 2)
supremum(values) -> float
Section titled “supremum(values) -> float”Maximum of an explicit bounded finite numeric iterable.
- domain: one nonempty flat iterable of at most 1,000,000 finite real values
- shape: reduction
- returns:
float - example:
supremum([1.0, 4.0, 2.0])
sup(values) -> float
Section titled “sup(values) -> float”Compact alias of supremum.
- domain: same bounded finite-iterable contract as supremum
- shape: reduction
- returns:
float - example:
sup([1.0, 4.0, 2.0])
infimum(values) -> float
Section titled “infimum(values) -> float”Minimum of an explicit bounded finite numeric iterable.
- domain: one nonempty flat iterable of at most 1,000,000 finite real values
- shape: reduction
- returns:
float - example:
infimum([1.0, 4.0, 2.0])
inf(values) -> float
Section titled “inf(values) -> float”Compact alias of infimum.
- domain: same bounded finite-iterable contract as infimum
- shape: reduction
- returns:
float - example:
inf([1.0, 4.0, 2.0])
geometry
Section titled “geometry”distance(left, right) -> float
Section titled “distance(left, right) -> float”Euclidean distance with checked shape, dimension, and finite-result bounds.
- domain: matching nonempty finite-real vectors of dimension 1..=64
- shape: bounded geometry / manifold
- returns:
float - example:
distance([0.0, 0.0], [3.0, 4.0])
d(left, right) -> float
Section titled “d(left, right) -> float”Compact alias of distance.
- domain: same bounded Euclidean-vector contract as distance
- shape: bounded geometry / manifold
- returns:
float - example:
d([0.0, 0.0], [3.0, 4.0])
angle(left, right) -> float
Section titled “angle(left, right) -> float”Principal Euclidean vector angle in [0, pi], with clamped roundoff and typed zero-vector failure.
- domain: matching nonzero finite-real vectors of dimension 1..=64
- shape: bounded geometry / manifold
- returns:
float - example:
angle([1.0, 0.0], [0.0, 1.0])
coordinate_transform(matrix, point, offset) -> Vec
Section titled “coordinate_transform(matrix, point, offset) -> Vec”Explicit affine coordinate transform matrix * point + offset.
- domain: finite dense-real matrix with 1..=64 rows, columns equal to point dimension, and offset length equal to rows
- shape: bounded geometry / manifold
- returns:
Vec - example:
coordinate_transform([[0.0, -1.0], [1.0, 0.0]], [2.0, 3.0], [1.0, -1.0])
field.gradient(field, point, step) -> Vec
Section titled “field.gradient(field, point, step) -> Vec”Bounded central-difference gradient of a scalar field.
- domain: one-argument scalar field, finite point of dimension 1..=64, finite step > 0, and at most 1,024 central-difference evaluations
- shape: bounded geometry / manifold
- returns:
Vec - example:
field.gradient(scalar_field, [1.0, 2.0, 3.0], 0.0001)
divergence(field, point, step) -> float
Section titled “divergence(field, point, step) -> float”Bounded central-difference divergence of a vector field.
- domain: one-argument vector field returning the point dimension, finite point dimension 1..=64, finite step > 0, and at most 1,024 evaluations
- shape: bounded geometry / manifold
- returns:
float - example:
divergence(vector_field, [1.0, 2.0, 3.0], 0.0001)
div(field, point, step) -> float
Section titled “div(field, point, step) -> float”Compact alias of divergence.
- domain: same bounded vector-field contract as divergence
- shape: bounded geometry / manifold
- returns:
float - example:
div(vector_field, [1.0, 2.0, 3.0], 0.0001)
curl(field, point, step) -> Vec
Section titled “curl(field, point, step) -> Vec”Bounded central-difference curl in three dimensions.
- domain: one-argument three-dimensional finite vector field and finite step > 0 under six evaluations
- shape: bounded geometry / manifold
- returns:
Vec - example:
curl(vector_field, [1.0, 2.0, 3.0], 0.0001)
laplacian(field, point, step) -> float
Section titled “laplacian(field, point, step) -> float”Bounded central-difference scalar Laplacian.
- domain: one-argument scalar field, finite point dimension 1..=64, finite step > 0, and at most 1,024 evaluations
- shape: bounded geometry / manifold
- returns:
float - example:
laplacian(scalar_field, [1.0, 2.0, 3.0], 0.0001)
convex_hull(points) -> Matrix
Section titled “convex_hull(points) -> Matrix”Deterministic monotone-chain planar convex hull without a repeated closing point.
- domain: 1..=4,096 finite two-dimensional points
- shape: bounded geometry / manifold
- returns:
Matrix - example:
convex_hull([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.5, 0.5]])
conv(points) -> Matrix
Section titled “conv(points) -> Matrix”Compact alias of convex_hull.
- domain: same bounded planar point contract as convex_hull
- shape: bounded geometry / manifold
- returns:
Matrix - example:
conv([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]])
affine_hull(points) -> Matrix
Section titled “affine_hull(points) -> Matrix”Affine-hull origin followed by a deterministic orthonormal basis from modified Gram-Schmidt.
- domain: 1..=4,096 matching finite-real points of dimension 1..=64
- shape: bounded geometry / manifold
- returns:
Matrix - example:
affine_hull([[1.0, 2.0], [2.0, 2.0], [1.0, 4.0]])
aff(points) -> Matrix
Section titled “aff(points) -> Matrix”Compact alias of affine_hull.
- domain: same bounded finite point contract as affine_hull
- shape: bounded geometry / manifold
- returns:
Matrix - example:
aff([[1.0, 2.0], [2.0, 2.0], [1.0, 4.0]])
volume(vertices) -> float
Section titled “volume(vertices) -> float”Absolute simplex determinant divided by dimension factorial.
- domain: exactly dimension + 1 finite-real simplex vertices in dimension 1..=16
- shape: bounded geometry / manifold
- returns:
float - example:
volume([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]])
vol(vertices) -> float
Section titled “vol(vertices) -> float”Compact alias of volume.
- domain: same bounded simplex contract as volume
- shape: bounded geometry / manifold
- returns:
float - example:
vol([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]])
manifolds
Section titled “manifolds”geodesic(start, target, radius, segments) -> Matrix
Section titled “geodesic(start, target, radius, segments) -> Matrix”Sampled shortest round-sphere geodesic through logarithmic and exponential maps, including both endpoints.
- domain: non-antipodal matching points on a finite positive-radius round sphere, dimension 1..=64, and segments in 1..=4095
- shape: bounded geometry / manifold
- returns:
Matrix - example:
geodesic([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], 1.0, 4)
sphere.project(point, radius) -> Vec
Section titled “sphere.project(point, radius) -> Vec”Radial projection onto a round sphere.
- domain: nonzero finite-real point of dimension 1..=64 and finite radius > 0
- shape: bounded geometry / manifold
- returns:
Vec - example:
sphere.project([2.0, 0.0, 0.0], 1.0)
sphere.tangent(point, vector, radius) -> Vec
Section titled “sphere.tangent(point, vector, radius) -> Vec”Orthogonal projection of an ambient vector into a round-sphere tangent space.
- domain: matching finite vectors of dimension 1..=64, point on the positive-radius sphere
- shape: bounded geometry / manifold
- returns:
Vec - example:
sphere.tangent([1.0, 0.0, 0.0], [1.0, 1.0, 0.0], 1.0)
sphere.exp(point, tangent, radius) -> Vec
Section titled “sphere.exp(point, tangent, radius) -> Vec”Closed-form round-sphere exponential map after checked tangent projection.
- domain: point on a finite positive-radius sphere and matching finite ambient tangent vector, dimension 1..=64
- shape: bounded geometry / manifold
- returns:
Vec - example:
sphere.exp([1.0, 0.0, 0.0], [0.0, 1.5707963267948966, 0.0], 1.0)
sphere.log(point, target, radius) -> Vec
Section titled “sphere.log(point, target, radius) -> Vec”Principal round-sphere logarithmic map; antipodal ambiguity fails typed.
- domain: matching non-antipodal points on a finite positive-radius sphere, dimension 1..=64
- shape: bounded geometry / manifold
- returns:
Vec - example:
sphere.log([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], 1.0)
sphere.distance(point, target, radius) -> float
Section titled “sphere.distance(point, target, radius) -> float”Principal round-sphere geodesic distance.
- domain: matching points on a finite positive-radius sphere, dimension 1..=64
- shape: bounded geometry / manifold
- returns:
float - example:
sphere.distance([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], 1.0)
topology
Section titled “topology”betti_numbers(facets) -> list[int]
Section titled “betti_numbers(facets) -> list[int]”Exact F2 Betti numbers of the complete downward closure of finite maximal simplices.
- domain: 1..=4,096 maximal nonempty simplices with nonnegative exact vertices, at most 13 vertices per facet, 4,096 distinct vertices, 32,768 closure simplices, 4,000,000 boundary words, and 100,000,000 elimination XORs
- shape: finite simplicial topology
- returns:
list[int] - example:
betti_numbers([[0, 1], [1, 2], [0, 2]])
euler_characteristic(facets) -> int
Section titled “euler_characteristic(facets) -> int”Exact alternating simplex-count Euler characteristic.
- domain: same bounded finite simplicial-complex contract as betti_numbers
- shape: finite simplicial topology
- returns:
int - example:
euler_characteristic([[0, 1, 2]])
simplicial_topology(facets) -> tuple[list[int], list[int], int]
Section titled “simplicial_topology(facets) -> tuple[list[int], list[int], int]”Exact tuple of Betti numbers, simplex counts by dimension, and Euler characteristic.
- domain: same bounded finite simplicial-complex contract as betti_numbers
- shape: finite simplicial topology
- returns:
tuple[list[int], list[int], int] - example:
simplicial_topology([[0, 1, 2]])
discrete
Section titled “discrete”finite_difference(values, order) -> list[int]
Section titled “finite_difference(values, order) -> list[int]”Exact forward finite differences at the requested order.
- domain: 1..=4,096 exact integers, order nonnegative and smaller than the input length, exact intermediates at most 16,384 bits
- shape: bounded discrete / graph
- returns:
list[int] - example:
finite_difference([1, 4, 9, 16], 2)
recurrence(initial, coefficients, count) -> list[int]
Section titled “recurrence(initial, coefficients, count) -> list[int]”Exact constant-coefficient recurrence where coefficient j multiplies the j-th preceding term.
- domain: matching initial/coefficient lengths in 1..=64, count from the order through 100,000, exact values at most 16,384 bits, and at most 100,000,000 multiply-adds
- shape: bounded discrete / graph
- returns:
list[int] - example:
recurrence([0, 1], [1, 1], 8)
combinations(values, choose) -> list[list[int]]
Section titled “combinations(values, choose) -> list[list[int]]”Lexicographically indexed combinations preserving input order and position multiplicity.
- domain: 1..=128 exact integers, choose in 0..=length, and at most 100,000 position-distinct outputs
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
combinations([1, 2, 3], 2)
permutations(values, length) -> list[list[int]]
Section titled “permutations(values, length) -> list[list[int]]”Deterministic partial permutations preserving input position identity.
- domain: 1..=128 exact integers, length in 0..=input length, and at most 100,000 position-distinct outputs
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
permutations([1, 2, 3], 2)
integer_partitions(value) -> list[list[int]]
Section titled “integer_partitions(value) -> list[list[int]]”Exact integer partitions in descending lexicographic part order.
- domain: positive exact integer at most 128 and at most 100,000 outputs
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
integer_partitions(5)
stirling_numbers(n, k, kind) -> int
Section titled “stirling_numbers(n, k, kind) -> int”Unsigned Stirling number of the first kind or set-partition Stirling number of the second kind.
- domain: 0 <= k <= n <= 256, kind exactly 1 or 2, and exact intermediates at most 16,384 bits
- shape: bounded discrete / graph
- returns:
int - example:
stirling_numbers(5, 2, 2)
mobius_inversion(values) -> list[int]
Section titled “mobius_inversion(values) -> list[int]”Exact divisor-poset Möbius inversion returning f(1)..f(n).
- domain: 1..=4,096 exact values g(1)..g(n), interpreted as g(n)=sum over divisors d of f(d), with 16,384-bit results
- shape: bounded discrete / graph
- returns:
list[int] - example:
mobius_inversion([1, 3, 4, 7])
shortest_path(adjacency, source, target) -> tuple[float, list[int]]
Section titled “shortest_path(adjacency, source, target) -> tuple[float, list[int]]”Deterministic Dijkstra distance and vertex path for a directed nonnegative graph.
- domain: finite nonnegative square weighted adjacency of size 1..=512, zero meaning no edge, in-range vertices, reachable target, and finite path sums
- shape: bounded discrete / graph
- returns:
tuple[float, list[int]] - example:
shortest_path([[0.0, 2.0, 5.0], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]], 0, 2)
connected_components(adjacency) -> list[list[int]]
Section titled “connected_components(adjacency) -> list[list[int]]”Canonical ascending weakly connected components.
- domain: finite nonnegative square adjacency of size 1..=512; directed edges are interpreted by weak connectivity
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
connected_components([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
max_flow(capacity, source, sink) -> float
Section titled “max_flow(capacity, source, sink) -> float”Deterministic Edmonds-Karp maximum-flow value with bounded residual work.
- domain: finite nonnegative square capacities of size 1..=128, distinct in-range source/sink, at most 100,000,000 residual-edge visits, and finite totals
- shape: bounded discrete / graph
- returns:
float - example:
max_flow([[0.0, 3.0, 2.0, 0.0], [0.0, 0.0, 1.0, 2.0], [0.0, 0.0, 0.0, 3.0], [0.0, 0.0, 0.0, 0.0]], 0, 3)
matching(adjacency) -> list[list[int]]
Section titled “matching(adjacency) -> list[list[int]]”Deterministic maximum-cardinality bipartite matching as sorted [left, right] pairs.
- domain: finite nonnegative rectangular bipartite adjacency with each side in 1..=512
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
matching([[1.0, 1.0, 0.0], [0.0, 1.0, 1.0]])
coloring(adjacency) -> list[int]
Section titled “coloring(adjacency) -> list[int]”Deterministic vertex-order greedy proper coloring; color ids are zero-based and no minimum-color claim is made.
- domain: finite nonnegative symmetric loop-free adjacency of size 1..=512
- shape: bounded discrete / graph
- returns:
list[int] - example:
coloring([[0.0, 1.0, 1.0], [1.0, 0.0, 1.0], [1.0, 1.0, 0.0]])
graph_laplacian(adjacency) -> Matrix
Section titled “graph_laplacian(adjacency) -> Matrix”Unnormalized weighted graph Laplacian D - A.
- domain: finite nonnegative symmetric loop-free weighted adjacency of size 1..=512 with finite degree sums
- shape: bounded discrete / graph
- returns:
Matrix - example:
graph_laplacian([[0.0, 2.0], [2.0, 0.0]])
orbit(update, initial, steps) -> Matrix
Section titled “orbit(update, initial, steps) -> Matrix”Explicit discrete-time orbit including the initial state and every callback-produced iterate.
- domain: one-argument state update preserving a finite dense-real dimension in 1..=64, steps in 0..=100,000, and bounded output storage
- shape: bounded discrete / graph
- returns:
Matrix - example:
orbit(discrete_update, [0.0], 3)
constraints
Section titled “constraints”csp(domains, relations, max_solutions) -> list[list[int]]
Section titled “csp(domains, relations, max_solutions) -> list[list[int]]”Exhaustively solve a bounded pure finite table-CSP in canonical lexicographic order; output ceilings fail typed rather than returning a model prefix.
- domain: 1..=12 explicit finite exact-integer domains; pure [variable_indices, allowed_tuples] table relations; at most 1,000,000 assignments, 20,000,000 relation cells, and an exact 1..=4,096 model output ceiling
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
csp([[0, 1, 2], [0, 1, 2]], [[[0, 1], [[0, 2], [1, 1], [2, 0]]]], 8)
solve_constraints(domains, relations, max_solutions) -> list[list[int]]
Section titled “solve_constraints(domains, relations, max_solutions) -> list[list[int]]”Enumerate the complete bounded finite model set without invoking user callbacks or effects.
- domain: same exact bounded finite table-CSP contract as csp
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
solve_constraints([[0, 1]], [[[0], [[1]]]], 4)
sat(domains, relations) -> bool
Section titled “sat(domains, relations) -> bool”Decide satisfiability for a bounded finite table-CSP; false is backed by exhaustive enumeration of the accepted search space.
- domain: same exact bounded finite table-CSP contract as csp; decision may stop at the first canonical model
- shape: bounded discrete / graph
- returns:
bool - example:
sat([[0, 1]], [[[0], [[1]]]])
category_type
Section titled “category_type”category_validate(category) -> bool
Section titled “category_validate(category) -> bool”Validate endpoint closure, composition totality on composable pairs, identities, and associativity for a finite category.
- domain: finite category encoded as [object_count, sources, targets, identities, composition], with 1..=64 objects, 1..=128 morphisms, exact in-range indices, -1 only for non-composable pairs, and bounded exhaustive law checks
- shape: bounded discrete / graph
- returns:
bool - example:
category_validate([2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]])
category_compose(category, after, before) -> int
Section titled “category_compose(category, after, before) -> int”Compose two morphisms only after replaying the complete finite-category laws.
- domain: valid bounded finite category and two in-range composable morphism indices; composition orientation is after o before
- shape: bounded discrete / graph
- returns:
int - example:
category_compose([2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]], 1, 2)
category_hom(category, source, target) -> list[int]
Section titled “category_hom(category, source, target) -> list[int]”Return canonical ascending morphism indices in the requested finite hom-set.
- domain: valid bounded finite category and two in-range object indices
- shape: bounded discrete / graph
- returns:
list[int] - example:
category_hom([2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]], 0, 1)
category_isomorphisms(category) -> list[list[int]]
Section titled “category_isomorphisms(category) -> list[list[int]]”Return canonical [morphism, inverse] pairs whose two compositions are the corresponding identities.
- domain: valid bounded finite category
- shape: bounded discrete / graph
- returns:
list[list[int]] - example:
category_isomorphisms([2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]])
functor_validate(source, target, object_map, morphism_map) -> bool
Section titled “functor_validate(source, target, object_map, morphism_map) -> bool”Check endpoint, identity, and composition preservation for a total finite functor map.
- domain: two valid bounded finite categories and complete in-range object/morphism maps
- shape: bounded discrete / graph
- returns:
bool - example:
functor_validate([2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]], [2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]], [0, 1], [0, 1, 2])
natural_transformation_validate(source, target, left_objects, left_morphisms, right_objects, right_morphisms, components) -> bool
Section titled “natural_transformation_validate(source, target, left_objects, left_morphisms, right_objects, right_morphisms, components) -> bool”Check component endpoints and every naturality square for two bounded finite functors.
- domain: two valid bounded finite categories, two valid functor maps, and one in-range component morphism per source object
- shape: bounded discrete / graph
- returns:
bool - example:
natural_transformation_validate([2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]], [2, [0, 1, 0], [0, 1, 1], [0, 1], [[0, -1, -1], [-1, 1, 2], [2, -1, -1]]], [0, 1], [0, 1, 2], [0, 1], [0, 1, 2], [0, 1])
stlc_type(term, context) -> any
Section titled “stlc_type(term, context) -> any”Infer the exact type of a bounded STLC term; unbound variables and ill-typed eliminations fail typed.
- domain: tagged simply typed lambda-calculus term with de Bruijn indices, Unit/Bool/Nat/function/product/sum types, at most 256 context entries, depth 128, 4,096 combined term/annotation nodes, and 4,096 context type nodes
- shape: symbolic
- returns:
any - example:
stlc_type(["lam", "Nat", ["var", 0]], [])
stlc_check(term, context, expected) -> bool
Section titled “stlc_check(term, context, expected) -> bool”Compare bounded STLC inference with an explicit well-formed expected type.
- domain: same bounded STLC term/context contract as stlc_type and one well-formed expected type
- shape: symbolic
- returns:
bool - example:
stlc_check(["app", ["lam", "Nat", ["var", 0]], ["nat", 7]], [], "Nat")
stlc_normalize(term, max_steps) -> any
Section titled “stlc_normalize(term, max_steps) -> any”Compute capture-avoiding leftmost-outermost beta/product/sum/boolean/Nat normal form or fail on budget exhaustion.
- domain: closed well-typed bounded STLC term, reduction budget 0..=10,000, and normalized output at most 100,000 combined term/annotation nodes
- shape: symbolic
- returns:
any - example:
stlc_normalize(["app", ["lam", "Nat", ["var", 0]], ["nat", 7]], 1)
stlc_definitional_equal(left, right, max_steps) -> bool
Section titled “stlc_definitional_equal(left, right, max_steps) -> bool”Decide bounded STLC definitional equality only between terms of the same inferred type by exact capture-avoiding normalization.
- domain: two closed well-typed bounded STLC terms and a per-term reduction budget 0..=10,000
- shape: symbolic
- returns:
bool - example:
stlc_definitional_equal(["app", ["lam", "Nat", ["var", 0]], ["nat", 7]], ["nat", 7], 1)
numerics
Section titled “numerics”ode(rhs, t0, y0, t1, rtol, atol, max_steps, params, method) -> tuple[Approx[Vec], int, int]
Section titled “ode(rhs, t0, y0, t1, rtol, atol, max_steps, params, method) -> tuple[Approx[Vec], int, int]”Bounded ODE solver selected by its final method argument: rk45 is adaptive Dormand-Prince 5(4), while backward_euler is an implicit first-order stiff method with adaptive step doubling and bounded finite-difference Newton solves. Both return (Approx(final_state), accepted_steps, rejected_steps); parameter-vector items follow (t, y). Unsupported methods, events, dense output, and sensitivities fail typed.
- domain: finite dense real state;
rk45supports dimension 1..=256, whilebackward_eulersupports 1..=32 with bounded finite-difference Newton work; finite rtol > 0, atol >= 0, max_steps in 1..=1,000,000, finite real parameter vector of length 0..=64, and a final supported literal solver id - shape: time evolution
- returns:
tuple[Approx[Vec], int, int] - example:
ode(ode_rhs, 0.0, [1.0], 1.0, 1e-9, 1e-12, 10000, [], "rk45")
dae(residual, t0, y0, ydot0, t1, rtol, atol, max_steps, params, method) -> tuple[Approx[Vec], int, int]
Section titled “dae(residual, t0, y0, ydot0, t1, rtol, atol, max_steps, params, method) -> tuple[Approx[Vec], int, int]”Bounded residual-form index-1 DAE integration by implicit Euler with adaptive step doubling. Initial residual consistency, every nonlinear solve, state shape, finiteness, callback evaluations, and step work fail typed; returns (Approx(final_state), accepted_steps, rejected_steps).
- domain: consistent residual-form index-1 finite dense-real DAE F(t, y, ydot)=0 of dimension 1..=32; bounded finite-difference Newton work, finite tolerances, 1..=1,000,000 steps, 0..=64 parameters, and final literal method
backward_euler - shape: time evolution
- returns:
tuple[Approx[Vec], int, int] - example:
dae(dae_residual_system, 0.0, [1.0, 1.0], [-1.0, -2.0], 0.1, 1e-5, 1e-8, 10000, [], "backward_euler")
poisson(source, x0, x1, left, right) -> Approx[Vec]
Section titled “poisson(source, x0, x1, left, right) -> Approx[Vec]”Solve -u’’=source on a bounded uniform one-dimensional grid by a centered second-order Dirichlet tridiagonal solve; returns an Approx vector including both boundaries and a normalized discrete residual.
- domain: one-dimensional uniform grid, 1..=4,094 finite interior source samples, finite x1 > x0, and fixed finite Dirichlet boundaries
- shape: time evolution
- returns:
Approx[Vec] - example:
poisson([2.0, 2.0, 2.0], 0.0, 1.0, 0.0, 0.0)
heat_equation(initial, diffusivity, dx, dt, steps, left, right) -> Approx[Vec]
Section titled “heat_equation(initial, diffusivity, dx, dt, steps, left, right) -> Approx[Vec]”Evolve the one-dimensional heat equation by unconditionally stable Crank-Nicolson tridiagonal steps; returns an Approx final grid with the final normalized discrete residual.
- domain: one-dimensional uniform grid of 3..=4,096 finite points with matching fixed Dirichlet endpoints, finite diffusivity > 0, dx > 0, dt >= 0, and at most 32,000,000 bounded point-steps
- shape: time evolution
- returns:
Approx[Vec] - example:
heat_equation([0.0, 1.0, 0.0], 0.1, 0.5, 0.01, 2, 0.0, 0.0)
wave_equation(initial, velocity, wave_speed, dx, dt, steps, left, right) -> Approx[Vec]
Section titled “wave_equation(initial, velocity, wave_speed, dx, dt, steps, left, right) -> Approx[Vec]”Evolve the one-dimensional wave equation by a centered CFL-checked leapfrog scheme; returns an Approx final grid with a normalized discrete recurrence residual.
- domain: one-dimensional uniform grid of 3..=4,096 finite points and matching finite velocity, fixed Dirichlet endpoints with zero endpoint velocity, finite wave_speed > 0, dx > 0, dt >= 0, CFL <= 1, and at most 32,000,000 bounded point-steps
- shape: time evolution
- returns:
Approx[Vec] - example:
wave_equation([0.0, 1.0, 0.0], [0.0, 0.0, 0.0], 1.0, 0.5, 0.01, 2, 0.0, 0.0)
optimization
Section titled “optimization”linear_program(objective, coefficients, rhs, max_iterations?) -> LinearProgramResult
Section titled “linear_program(objective, coefficients, rhs, max_iterations?) -> LinearProgramResult”Deterministic two-phase dense-real simplex with Bland pivots; returns Optimal, Infeasible, Unbounded, IterationLimit, or NumericalFailure plus optional incumbent and primal residual.
- domain: finite dense real standard form max c·x subject to A x <= b and x >= 0; 1..=64 variables, 1..=128 constraints, bounded tableau and 1..=100,000 iterations
- shape: optimization
- returns:
LinearProgramResult - example:
linear_program([3.0, 2.0], [[1.0, 1.0], [1.0, 0.0], [0.0, 1.0]], [4.0, 2.0, 3.0])
lp(objective, coefficients, rhs, max_iterations?) -> LinearProgramResult
Section titled “lp(objective, coefficients, rhs, max_iterations?) -> LinearProgramResult”Alias of linear_program with identical status, residual, bounds, and deterministic two-phase simplex semantics.
- domain: alias of linear_program over the same bounded finite dense-real standard form
- shape: optimization
- returns:
LinearProgramResult - example:
lp([1.0], [[1.0]], [2.0])
quadratic_program(quadratic, linear, coefficients, rhs, max_active_sets?) -> OptimizationResult
Section titled “quadratic_program(quadratic, linear, coefficients, rhs, max_active_sets?) -> OptimizationResult”Strictly-convex dense-real QP solved by bounded exhaustive active-set KKT enumeration; returns a global-convex optimum with replayable primal/stationarity residual, or an explicit non-optimal status.
- domain: minimize 0.5 x’Qx + c’x subject to A x <= b and x >= 0; finite symmetric positive-definite Q, 1..=8 variables/constraints, and at most 100,000 exhaustively preflighted active sets
- shape: optimization
- returns:
OptimizationResult - example:
quadratic_program([[2.0, 0.0], [0.0, 2.0]], [-2.0, -4.0], [[1.0, 1.0], [1.0, 0.0], [0.0, 1.0]], [2.5, 2.0, 2.0])
qp(quadratic, linear, coefficients, rhs, max_active_sets?) -> OptimizationResult
Section titled “qp(quadratic, linear, coefficients, rhs, max_active_sets?) -> OptimizationResult”Alias of quadratic_program with identical convexity, KKT enumeration, status, residual, bound, and scope semantics.
- domain: alias of quadratic_program over the same bounded strictly-convex dense-real standard form
- shape: optimization
- returns:
OptimizationResult - example:
qp([[2.0]], [-4.0], [[1.0]], [3.0])
nonlinear_program(objective, initial, lower, upper, max_iterations, tolerance, method) -> OptimizationResult
Section titled “nonlinear_program(objective, initial, lower, upper, max_iterations, tolerance, method) -> OptimizationResult”Deterministic box-projected finite-difference gradient descent with Armijo search; a converged result is explicitly local-first-order, while exhausted or stalled work is never labeled optimal.
- domain: finite scalar callback over a 1..=32-dimensional finite box, bounded finite-difference/line-search work, max_iterations in 1..=10,000, tolerance in 1e-12..=1e-2, and final literal method
projected_gradient_fd - shape: optimization
- returns:
OptimizationResult - example:
nonlinear_program(optimization_objective, [0.0, 0.0], [-2.0, -2.0], [2.0, 2.0], 1000, 1e-7, "projected_gradient_fd")
nlp(objective, initial, lower, upper, max_iterations, tolerance, method) -> OptimizationResult
Section titled “nlp(objective, initial, lower, upper, max_iterations, tolerance, method) -> OptimizationResult”Alias of nonlinear_program; preserves the explicit method, local scope, projected-gradient residual, and typed exhaustion contract.
- domain: alias of nonlinear_program over the same bounded finite box and local-first-order method contract
- shape: optimization
- returns:
OptimizationResult - example:
nlp(optimization_objective, [0.0, 0.0], [-2.0, -2.0], [2.0, 2.0], 1000, 1e-7, "projected_gradient_fd")
mixed_integer_program(objective, coefficients, rhs, integer_indices, max_nodes?) -> OptimizationResult
Section titled “mixed_integer_program(objective, coefficients, rhs, integer_indices, max_nodes?) -> OptimizationResult”Depth-first mixed-integer branch-and-bound over replay-checked Bland-pivot LP relaxations; complete search returns a global bounded optimum, node exhaustion returns an incumbent/bound/gap, and relaxation unboundedness is not promoted to an integer proof.
- domain: maximize c’x subject to A x <= b and x >= 0 with 1..=32 sorted unique integer-variable indices; finite dense LP limits and 1..=10,000 deterministic branch nodes
- shape: optimization
- returns:
OptimizationResult - example:
mixed_integer_program([5.0, 4.0], [[6.0, 4.0], [1.0, 2.0], [-1.0, 1.0]], [24.0, 6.0, 1.0], [0, 1])
mip(objective, coefficients, rhs, integer_indices, max_nodes?) -> OptimizationResult
Section titled “mip(objective, coefficients, rhs, integer_indices, max_nodes?) -> OptimizationResult”Alias of mixed_integer_program with identical branch order, LP relaxation, status, incumbent, bound, relative-gap, and work-limit semantics.
- domain: alias of mixed_integer_program over the same bounded finite dense mixed-integer standard form
- shape: optimization
- returns:
OptimizationResult - example:
mip([1.0], [[1.0]], [2.5], [0])
linalg
Section titled “linalg”det(matrix) -> float | complex
Section titled “det(matrix) -> float | complex”Determinant via checked partial-pivot LU; singular matrices return numeric zero in the input domain.
- domain: finite non-empty square dense real or complex matrix within the bounded pivoted-LU work profile
- shape: reduction
- returns:
float | complex - example:
det([[1.0, 2.0], [3.0, 4.0]])
solve(matrix, rhs) -> Vec[float | complex]
Section titled “solve(matrix, rhs) -> Vec[float | complex]”Solve A x = b with checked LU, conditioning, and residual validation; any complex operand promotes the real side exactly and returns a complex vector.
- domain: finite non-singular square dense real or complex matrix and equal-length vector; complex operands use the checked complex LU with the shared residual gate
- shape: contraction
- returns:
Vec[float | complex] - example:
solve([[2.0, 0.0], [0.0, 4.0]], [2.0, 8.0])
inv(matrix) -> Matrix[float | complex]
Section titled “inv(matrix) -> Matrix[float | complex]”Checked dense real or complex matrix inverse with conditioning and residual validation.
- domain: finite non-singular square dense real or complex matrix within the bounded pivoted-LU work profile
- shape: decomposition
- returns:
Matrix[float | complex] - example:
inv([[4.0, 7.0], [2.0, 6.0]])
qr(matrix) -> tuple[Matrix[float | complex], Matrix[float | complex]]
Section titled “qr(matrix) -> tuple[Matrix[float | complex], Matrix[float | complex]]”Checked Householder QR returning (Q, R); complex inputs use phase-correct reflectors and conjugate orthogonality checks.
- domain: finite non-empty dense real or complex matrix within the bounded Householder work profile
- shape: decomposition
- returns:
tuple[Matrix[float | complex], Matrix[float | complex]] - example:
qr([[1.0, 0.0], [0.0, 2.0]])
lu(matrix) -> tuple[Matrix[float | complex], Matrix[float | complex], list[int]]
Section titled “lu(matrix) -> tuple[Matrix[float | complex], Matrix[float | complex], list[int]]”Checked partial-pivot LU returning (L, U, permutation) with P A = L U; real operands retain real matrices.
- domain: finite non-empty square dense real or complex matrix within the bounded checked partial-pivot LU work profile
- shape: decomposition
- returns:
tuple[Matrix[float | complex], Matrix[float | complex], list[int]] - example:
lu([[2.0, 1.0], [1.0, 3.0]])
cholesky(matrix) -> Matrix[float | complex]
Section titled “cholesky(matrix) -> Matrix[float | complex]”Lower-triangular Cholesky factor with Hermitian, positive-definite, and reconstruction checks.
- domain: finite non-empty Hermitian positive-definite dense real or complex matrix within the bounded cubic work profile
- shape: decomposition
- returns:
Matrix[float | complex] - example:
cholesky([[4.0, 2.0], [2.0, 5.0]])
trace(matrix) -> float | complex
Section titled “trace(matrix) -> float | complex”Checked diagonal sum preserving real or complex dtype.
- domain: finite non-empty square dense real or complex matrix
- shape: reduction
- returns:
float | complex - example:
trace([[1.0, 0.0], [0.0, 2.0]])
tr(matrix) -> float | complex
Section titled “tr(matrix) -> float | complex”Alias of trace with identical checked diagonal-sum semantics.
- domain: alias of trace over the same finite non-empty square dense real or complex matrix domain
- shape: reduction
- returns:
float | complex - example:
tr([[1.0, 0.0], [0.0, 2.0]])
matrix_exp(matrix) -> Matrix[float | complex]
Section titled “matrix_exp(matrix) -> Matrix[float | complex]”Principal matrix exponential with aggregate work and convergence gates.
- domain: finite non-empty square dense real or complex matrix; bounded scaling-and-squaring Taylor profile
- shape: decomposition
- returns:
Matrix[float | complex] - example:
matrix_exp([[0.0, 1.0], [-1.0, 0.0]])
matrix_sqrt(matrix) -> Matrix[float | complex]
Section titled “matrix_sqrt(matrix) -> Matrix[float | complex]”Principal matrix square root with iteration, aggregate-work, and reconstruction-residual gates.
- domain: finite non-singular square dense real or complex matrix in the convergent bounded Denman-Beavers profile
- shape: decomposition
- returns:
Matrix[float | complex] - example:
matrix_sqrt([[4.0, 0.0], [0.0, 9.0]])
matrix_log(matrix) -> Matrix[float | complex]
Section titled “matrix_log(matrix) -> Matrix[float | complex]”Principal matrix logarithm with bounded root reduction, aggregate work, and series convergence gates.
- domain: finite non-singular square dense real or complex matrix in the bounded principal-root and atanh-series profile
- shape: decomposition
- returns:
Matrix[float | complex] - example:
matrix_log([[1.0, 0.0], [0.0, 2.0]])
svd(matrix) -> tuple[Matrix[float | complex], Vec[float], Matrix[float | complex]]
Section titled “svd(matrix) -> tuple[Matrix[float | complex], Vec[float], Matrix[float | complex]]”Reduced real/complex singular-value decomposition returning (U, descending real singular values, Vh) with reconstruction and conjugate-orthogonality checks.
- domain: finite nonempty rank-2 dense real or complex matrix; reduced outputs and bounded scale-normalized Hermitian Jacobi work
- shape: decomposition
- returns:
tuple[Matrix[float | complex], Vec[float], Matrix[float | complex]] - example:
svd([[3.0, 0.0], [0.0, 2.0]])
pseudoinverse(matrix) -> Matrix[float | complex]
Section titled “pseudoinverse(matrix) -> Matrix[float | complex]”Moore-Penrose pseudoinverse derived from the checked reduced real/complex SVD with the public rank cutoff.
- domain: finite nonempty rank-2 dense real or complex matrix; SVD cutoff s_max * max(rows, cols) * f64::EPSILON; output shape cols x rows; bounded derived work
- shape: decomposition
- returns:
Matrix[float | complex] - example:
pinv([[1.0, 0.0], [0.0, 2.0]])
pinv(matrix) -> Matrix[float | complex]
Section titled “pinv(matrix) -> Matrix[float | complex]”Moore-Penrose pseudoinverse derived from the checked reduced real/complex SVD with the public rank cutoff.
- domain: finite nonempty rank-2 dense real or complex matrix; SVD cutoff s_max * max(rows, cols) * f64::EPSILON; output shape cols x rows; bounded derived work
- shape: decomposition
- returns:
Matrix[float | complex] - example:
pinv([[1.0, 0.0], [0.0, 2.0]])
least_squares(matrix, rhs) -> tuple[Vec[float | complex], float, int, Vec[float]]
Section titled “least_squares(matrix, rhs) -> tuple[Vec[float | complex], float, int, Vec[float]]”Minimum-norm real/complex SVD least-squares result as (solution, residual norm, numerical rank, singular values), with an explicit residual.
- domain: finite nonempty rank-2 dense real or complex matrix and finite real or complex right-hand side of length rows; same SVD cutoff as rank/pinv; bounded derived work
- shape: decomposition
- returns:
tuple[Vec[float | complex], float, int, Vec[float]] - example:
lstsq([[1.0], [1.0]], [1.0, 2.0])
lstsq(matrix, rhs) -> tuple[Vec[float | complex], float, int, Vec[float]]
Section titled “lstsq(matrix, rhs) -> tuple[Vec[float | complex], float, int, Vec[float]]”Minimum-norm real/complex SVD least-squares result as (solution, residual norm, numerical rank, singular values), with an explicit residual.
- domain: finite nonempty rank-2 dense real or complex matrix and finite real or complex right-hand side of length rows; same SVD cutoff as rank/pinv; bounded derived work
- shape: decomposition
- returns:
tuple[Vec[float | complex], float, int, Vec[float]] - example:
lstsq([[1.0], [1.0]], [1.0, 2.0])
condition_number(matrix) -> float
Section titled “condition_number(matrix) -> float”Spectral condition number from checked real/complex singular values; infinity explicitly represents numerical rank deficiency.
- domain: finite nonempty rank-2 dense real or complex matrix; spectral 2-norm condition using the public SVD cutoff; numerically rank-deficient matrices return infinity
- shape: reduction
- returns:
float - example:
cond([[1.0, 0.0], [0.0, 2.0]])
cond(matrix) -> float
Section titled “cond(matrix) -> float”Spectral condition number from checked real/complex singular values; infinity explicitly represents numerical rank deficiency.
- domain: finite nonempty rank-2 dense real or complex matrix; spectral 2-norm condition using the public SVD cutoff; numerically rank-deficient matrices return infinity
- shape: reduction
- returns:
float - example:
cond([[1.0, 0.0], [0.0, 2.0]])
rank(matrix) -> int
Section titled “rank(matrix) -> int”Scale-relative numerical matrix rank using the same real singular values as the checked real/complex SVD.
- domain: finite nonempty rank-2 dense real or complex reduced-SVD domain; threshold s_max * max(rows, cols) * f64::EPSILON
- shape: reduction
- returns:
int - example:
rank([[1.0, 0.0], [0.0, 0.0]])
eigh(matrix) -> tuple[Vec[float], Matrix[float | complex]]
Section titled “eigh(matrix) -> tuple[Vec[float], Matrix[float | complex]]”Symmetric/Hermitian eigendecomposition with ascending real eigenvalues, normalized eigenvectors, and reconstruction checks.
- domain: finite Hermitian non-empty square dense real or complex matrix within the bounded real-symmetric Jacobi profile
- shape: decomposition
- returns:
tuple[Vec[float], Matrix[float | complex]] - example:
eigh([[2.0, 1.0], [1.0, 3.0]])
eig(matrix) -> tuple[Vec[float], Matrix[float | complex]]
Section titled “eig(matrix) -> tuple[Vec[float], Matrix[float | complex]]”General spelling currently qualified to the symmetric/Hermitian eigendecomposition contract; nonsymmetric matrices fail typed.
- domain: finite Hermitian non-empty square dense real or complex matrix in the same bounded checked domain as eigh
- shape: decomposition
- returns:
tuple[Vec[float], Matrix[float | complex]] - example:
eig([[2.0, 1.0], [1.0, 3.0]])
eigenvalues(matrix) -> Vec
Section titled “eigenvalues(matrix) -> Vec”Ascending real eigenvalues from the checked symmetric/Hermitian eigendecomposition.
- domain: finite Hermitian non-empty square dense real or complex matrix in the same bounded checked domain as eigh
- shape: decomposition
- returns:
Vec - example:
eigenvalues([[2.0, 1.0], [1.0, 3.0]])
eigenvectors(matrix) -> Matrix[float | complex]
Section titled “eigenvectors(matrix) -> Matrix[float | complex]”Normalized eigenvector columns from the checked symmetric/Hermitian eigendecomposition.
- domain: finite Hermitian non-empty square dense real or complex matrix in the same bounded checked domain as eigh
- shape: decomposition
- returns:
Matrix[float | complex] - example:
eigenvectors([[2.0, 1.0], [1.0, 3.0]])
spectrum(matrix) -> Vec
Section titled “spectrum(matrix) -> Vec”Alias of eigenvalues over the qualified symmetric/Hermitian domain.
- domain: same checked symmetric/Hermitian matrix domain as eigenvalues
- shape: decomposition
- returns:
Vec - example:
spectrum([[2.0, 1.0], [1.0, 3.0]])
spec(matrix) -> Vec
Section titled “spec(matrix) -> Vec”Compact alias of eigenvalues over the qualified symmetric/Hermitian domain.
- domain: same checked symmetric/Hermitian matrix domain as eigenvalues
- shape: decomposition
- returns:
Vec - example:
spec([[2.0, 1.0], [1.0, 3.0]])
image(matrix) -> Matrix[float | complex]
Section titled “image(matrix) -> Matrix[float | complex]”Orthonormal column-space basis selected with the same scale-relative threshold as rank.
- domain: finite nonempty rank-2 dense real or complex matrix in the bounded reduced-SVD domain
- shape: decomposition
- returns:
Matrix[float | complex] - example:
image([[1.0, 2.0], [2.0, 4.0]])
im(matrix) -> Matrix[float | complex]
Section titled “im(matrix) -> Matrix[float | complex]”Compact alias of image.
- domain: same checked reduced-SVD column-space domain as image
- shape: decomposition
- returns:
Matrix[float | complex] - example:
im([[1.0, 2.0], [2.0, 4.0]])
span(vectors) -> Matrix[float | complex]
Section titled “span(vectors) -> Matrix[float | complex]”Orthonormal basis for the span of the supplied matrix columns.
- domain: finite vectors supplied as columns of one nonempty rank-2 dense real or complex matrix
- shape: decomposition
- returns:
Matrix[float | complex] - example:
span([[1.0, 2.0], [2.0, 4.0]])
nullspace(matrix) -> Matrix[float | complex]
Section titled “nullspace(matrix) -> Matrix[float | complex]”Orthonormal kernel basis from right singular vectors; wide matrices fail typed until a full-SVD kernel is available.
- domain: finite nonempty square or tall dense real or complex matrix in the bounded reduced-SVD domain
- shape: decomposition
- returns:
Matrix[float | complex] - example:
nullspace([[1.0, 2.0], [2.0, 4.0]])
ker(matrix) -> Matrix[float | complex]
Section titled “ker(matrix) -> Matrix[float | complex]”Compact alias of nullspace.
- domain: same checked square-or-tall reduced-SVD domain as nullspace
- shape: decomposition
- returns:
Matrix[float | complex] - example:
ker([[1.0, 2.0], [2.0, 4.0]])
matmul(a, b) -> Matrix[float | complex]
Section titled “matmul(a, b) -> Matrix[float | complex]”Strict matrix-matrix product over dense real or complex operands; the result dtype follows the operands.
- domain: finite nonempty rank-2 dense real or complex matrices with agreeing inner dimensions; mixed operands promote the real side exactly; checked finite accumulation under exact element/work ceilings
- shape: contraction
- returns:
Matrix[float | complex] - example:
matmul([[1.0, 2.0], [3.0, 4.0]], [[1.0, 0.0], [0.0, 1.0]])
matvec(a, x) -> Vec[float | complex]
Section titled “matvec(a, x) -> Vec[float | complex]”Strict matrix-vector product over dense real or complex operands; the result dtype follows the operands.
- domain: finite nonempty rank-2 dense real or complex matrix and length-matching rank-1 vector; mixed operands promote the real side exactly; checked finite accumulation under exact work ceilings
- shape: contraction
- returns:
Vec[float | complex] - example:
matvec([[1.0, 0.0], [0.0, 2.0]], [3.0, 4.0])
determinant(matrix) -> float | complex
Section titled “determinant(matrix) -> float | complex”Descriptive alias of det with identical checked pivoting, dtype, and singular-zero semantics.
- domain: alias of det over the same checked finite real or complex square-matrix domain
- shape: reduction
- returns:
float | complex - example:
determinant([[1.0, 2.0], [3.0, 4.0]])
inverse(matrix) -> Matrix[float | complex]
Section titled “inverse(matrix) -> Matrix[float | complex]”Descriptive alias of inv with identical conditioning and reconstruction gates.
- domain: alias of inv over the same checked finite real or complex non-singular square-matrix domain
- shape: decomposition
- returns:
Matrix[float | complex] - example:
inverse([[4.0, 7.0], [2.0, 6.0]])
linalg.solve(matrix, rhs) -> Vec[float | complex]
Section titled “linalg.solve(matrix, rhs) -> Vec[float | complex]”Qualified alias of solve with identical pivoting, conditioning, and residual gates.
- domain: alias of solve over the same checked finite real or complex square system
- shape: contraction
- returns:
Vec[float | complex] - example:
linalg.solve([[2.0, 0.0], [0.0, 4.0]], [2.0, 8.0])
transpose(matrix) -> Matrix
Section titled “transpose(matrix) -> Matrix”Transpose a bounded dense real matrix; rank-one vectors retain their one-dimensional representation.
- domain: finite dense real matrix or vector under the bounded matrix-element ceiling
- shape: decomposition
- returns:
Matrix - example:
transpose([[1.0, 2.0], [3.0, 4.0]])
adjoint(matrix) -> Matrix
Section titled “adjoint(matrix) -> Matrix”Conjugate-transpose spelling for the bounded real lane; complex adjoints remain explicitly unsupported.
- domain: finite dense real matrix or vector; on this bounded real lane the adjoint equals the transpose
- shape: decomposition
- returns:
Matrix - example:
adjoint([[1.0, 2.0], [3.0, 4.0]])
norm(values, p?) -> float
Section titled “norm(values, p?) -> float”Function spelling of the checked equation vector norm; omitted p selects the Euclidean norm.
- domain: finite non-empty dense real vector and optional finite p norm supported by the equation norm kernel
- shape: reduction
- returns:
float - example:
norm([3.0, 4.0])
inner(left, right) -> float
Section titled “inner(left, right) -> float”Function spelling of the bounded dense-real inner product.
- domain: equal-length finite dense real vectors under the bounded vector-element ceiling
- shape: reduction
- returns:
float - example:
inner([1.0, 2.0], [3.0, 4.0])
outer(left, right) -> Matrix
Section titled “outer(left, right) -> Matrix”Bounded dense-real outer product.
- domain: finite dense real vectors whose output shape and multiplication work fit the matrix ceilings
- shape: constructor
- returns:
Matrix - example:
outer([1.0, 2.0], [3.0, 4.0])
kron(left, right) -> Matrix
Section titled “kron(left, right) -> Matrix”Function spelling of the bounded dense-real Kronecker product.
- domain: finite dense real matrices whose Kronecker shape and multiplication work fit the matrix ceilings
- shape: constructor
- returns:
Matrix - example:
kron([[1.0, 2.0]], [[3.0], [4.0]])
hadamard(left, right) -> Matrix
Section titled “hadamard(left, right) -> Matrix”Function spelling of the bounded dense-real elementwise matrix product.
- domain: equal-shape finite dense real matrices under the bounded matrix-element ceiling
- shape: elementwise (binary broadcast)
- returns:
Matrix - example:
hadamard([[1.0, 2.0]], [[3.0, 4.0]])
sparse_linalg
Section titled “sparse_linalg”sparse(rows, cols, row_indices, col_indices, values) -> SparseMatrix
Section titled “sparse(rows, cols, row_indices, col_indices, values) -> SparseMatrix”Validated CSR construction from COO triplets; duplicates are a typed ShapeError, never silently summed. Exits equations as a tagged inspectable record.
- domain: COO triplets over a nonempty shape: in-bounds indices, finite f64 values, no duplicate coordinates, and exact shape/nnz ceilings; canonicalized to sorted CSR
- shape: constructor
- returns:
SparseMatrix - example:
sparse(2, 2, [0, 1], [0, 1], [1.0, 2.0])
sparse.matmul(matrix, operand) -> SparseMatrix | Vec | Matrix
Section titled “sparse.matmul(matrix, operand) -> SparseMatrix | Vec | Matrix”Checked sparse or sparse-dense product; sparse right operands preserve CSR storage.
- domain: CSR times CSR, a dense real vector, or a dense real matrix under exact work, fill-in, and result-size ceilings; sparse products preserve canonical CSR
- shape: contraction
- returns:
SparseMatrix | Vec | Matrix - example:
sparse.matmul(sparse(2, 2, [0, 1], [0, 1], [1.0, 2.0]), [3.0, 4.0])
sparse.solve(matrix, rhs) -> Vec
Section titled “sparse.solve(matrix, rhs) -> Vec”Solve sparse A x = b through bounded sparse LU without densification.
- domain: square CSR system solved through pivoted sparse LU under explicit work and factor fill-in ceilings, with finite arithmetic and a backward-residual gate
- shape: contraction
- returns:
Vec - example:
sparse.solve(sparse(2, 2, [0, 1], [0, 1], [2.0, 4.0]), [2.0, 8.0])
sparse.transpose(matrix) -> SparseMatrix
Section titled “sparse.transpose(matrix) -> SparseMatrix”Transpose a sparse matrix while preserving canonical CSR storage.
- domain: canonical CSR matrix under the public shape and nnz ceilings
- shape: decomposition
- returns:
SparseMatrix - example:
sparse.transpose(sparse(2, 3, [0, 1], [1, 2], [1.0, 2.0]))
sparse.lstsq(matrix, rhs) -> Vec
Section titled “sparse.lstsq(matrix, rhs) -> Vec”Bounded sparse normal-equation least squares with typed rank-deficiency.
- domain: finite real CSR matrix and length-matching dense real right-hand side; normal equations, products, and solve remain sparse under work/fill ceilings
- shape: contraction
- returns:
Vec - example:
sparse.lstsq(sparse(3, 2, [0, 1, 2], [0, 1, 1], [1.0, 1.0, 1.0]), [1.0, 2.0, 2.0])
sparse.lu(matrix) -> tuple[SparseMatrix, SparseMatrix, list[int]]
Section titled “sparse.lu(matrix) -> tuple[SparseMatrix, SparseMatrix, list[int]]”Pivoted sparse LU returning canonical CSR L and U plus the row permutation.
- domain: square finite real CSR matrix under explicit pivot-search, elimination-work, and factor-fill ceilings
- shape: decomposition
- returns:
tuple[SparseMatrix, SparseMatrix, list[int]] - example:
sparse.lu(sparse(2, 2, [0, 0, 1], [0, 1, 1], [2.0, 1.0, 3.0]))
sparse.eigs(matrix) -> tuple[float, Vec, float, int, bool]
Section titled “sparse.eigs(matrix) -> tuple[float, Vec, float, int, bool]”Dominant-magnitude sparse eigenpair with explicit residual, iteration count, and convergence flag.
- domain: square finite real CSR matrix; bounded power iteration (1000 iterations, 1e-10 residual tolerance)
- shape: decomposition
- returns:
tuple[float, Vec, float, int, bool] - example:
sparse.eigs(sparse(2, 2, [0, 1], [0, 1], [3.0, 1.0]))
equation
Section titled “equation”jvp(target, tangent) -> float | Vec
Section titled “jvp(target, tangent) -> float | Vec”Forward-mode Jacobian-vector product without materializing the Jacobian; variables are ordered lexicographically.
- domain: scalar or flat vector target over >=1 sorted free real scalar variable; one-dimensional finite real tangent of exactly matching length (bounded forward work)
- shape: differential
- returns:
float | Vec - example:
jvp([x^2, x * y], [1.0, -0.5])
vjp(target, cotangent) -> float | Vec
Section titled “vjp(target, cotangent) -> float | Vec”Vector-Jacobian product. The bounded reference lane contracts the exact forward-dual Jacobian and does not allocate an unbounded reverse tape.
- domain: scalar or flat-vector result over a user function’s first real scalar/flat-vector argument, or sorted free real scalar variables; finite one-dimensional cotangent with exactly one lane per result (bounded dual-Jacobian contraction)
- shape: differential
- returns:
float | Vec - example:
vjp([x^2, x * y], [0.5, -1.0])
wirtinger(target) -> Vec[float | complex]
Section titled “wirtinger(target) -> Vec[float | complex]”Returns complex [∂f/∂z, ∂f/∂z̄]; a zero second lane is the explicit holomorphic criterion.
- domain: two real outputs [u,v] over exactly two real coordinates [x,y], interpreted as f(x+iy)=u+iv; finite differentiable path
- shape: differential
- returns:
Vec[float | complex] - example:
wirtinger([x^2 - y^2, 2*x*y])
jacobian(target) -> Matrix
Section titled “jacobian(target) -> Matrix”Jacobian matrix ∂f_i/∂x_j via forward-mode dual numbers.
- domain: vector-valued expression over free scalar variables (bounded seed/work)
- shape: differential
- returns:
Matrix - example:
jacobian([x^2, x * y])
hessian(target) -> Matrix
Section titled “hessian(target) -> Matrix”Hessian matrix via central differences of the exact dual gradient.
- domain: scalar expression with >= 1 free variable (bounded cubic work)
- shape: differential
- returns:
Matrix - example:
hessian(x^2 + y^2)