Cylindrical algebraic decomposition
A CylindricalAlgebraicDecomposition partitions into finitely many cells
on each of which every input polynomial has constant sign, with an exact sample
point in each cell. It is built over a list of polynomials
in a declared variable order. By default it uses the Brown projection — a
smaller, faster operator than the complete Lazard projection — and verifies its
result is well-oriented, falling back to the complete Lazard projection on
any failure, so the output is always a correct sign-invariant CAD, never an
orientation decline. It raises only when an input lies outside or
when the exact arithmetic cannot co-reside a sample point's coordinates in one
extension.
Declaring equational constraints (indices into the polynomial list, via the
constructor's equational_constraints argument) selects the
equational-constraint CAD instead: a smaller decomposition that is sign-invariant
for the non-constraint polynomials on the constraint variety (where every
declared constraint is zero), the lever that makes constrained queries tractable.
The accessors below index the full-dimensional cells — the cells that
actually partition — by an ordinal 0 .. cell_count. Every sign is decided
exactly by the real-algebraic-number layer; the float sample points are a
numeric view, never a decision.
Construction#
new#
Construct the CAD of the polynomials in the given variable order ;
projection eliminates first). With an empty equational_constraints list this
is the full sign-invariant CAD (Brown fast path with Lazard fallback); listing
indices into polynomials selects the equational-constraint CAD on the variety
where those polynomials vanish. Raises when any polynomial is outside
or the decomposition cannot be formed. Notes: the WASM
signature is new cylindrical_algebraic_decomposition(polynomials: ExpressionLike[], variables: string[], equational_constraints?: number[]).
new constructor
new Context(): ContextConstruct the CAD of the polynomials in the given variable order ; projection eliminates first).
Accessors#
cell_count#
Not exposed by the WASM / JavaScript bindings. Available as CylindricalAlgebraicDecomposition.cell_count in Python, UniffiCylindricalAlgebraicDecomposition.cellCount in Kotlin, UniffiCylindricalAlgebraicDecomposition.cellCount in Swift, api::CylindricalAlgebraicDecomposition::cell_count in Rust.
The number of full-dimensional cells partitioning .
cell_sample_point#
Not exposed by the WASM / JavaScript bindings. Available as CylindricalAlgebraicDecomposition.cell_sample_point in Python, UniffiCylindricalAlgebraicDecomposition.cellSamplePoint in Kotlin, UniffiCylindricalAlgebraicDecomposition.cellSamplePoint in Swift, api::CylindricalAlgebraicDecomposition::cell_sample_point in Rust.
The coordinates of the full cell's sample point as floats — a numeric view via the multi-precision evaluator, not a decision.
cell_sign_vector#
Not exposed by the WASM / JavaScript bindings. Available as CylindricalAlgebraicDecomposition.cell_sign_vector in Python, UniffiCylindricalAlgebraicDecomposition.cellSignVector in Kotlin, UniffiCylindricalAlgebraicDecomposition.cellSignVector in Swift, api::CylindricalAlgebraicDecomposition::cell_sign_vector in Rust.
The exact sign (, , or ) of each input polynomial on the full cell, in input order.
cell_kind#
Not exposed by the WASM / JavaScript bindings. Available as CylindricalAlgebraicDecomposition.cell_kind in Python, UniffiCylindricalAlgebraicDecomposition.cellKind in Kotlin, UniffiCylindricalAlgebraicDecomposition.cellKind in Swift, api::CylindricalAlgebraicDecomposition::cell_kind in Rust.
"section" or "sector" — whether the cell is a root section or an open
interval in its top variable.
cell_dimension#
Not exposed by the WASM / JavaScript bindings. Available as CylindricalAlgebraicDecomposition.cell_dimension in Python, UniffiCylindricalAlgebraicDecomposition.cellDimension in Kotlin, UniffiCylindricalAlgebraicDecomposition.cellDimension in Swift, api::CylindricalAlgebraicDecomposition::cell_dimension in Rust.
The geometric dimension of the full cell as a subset of (the number of sector coordinates along its cylindrical stack).
projection_operator_used#
Not exposed by the WASM / JavaScript bindings. Available as CylindricalAlgebraicDecomposition.projection_operator_used in Python, UniffiCylindricalAlgebraicDecomposition.projectionOperatorUsed in Kotlin, UniffiCylindricalAlgebraicDecomposition.projectionOperatorUsed in Swift, api::CylindricalAlgebraicDecomposition::projection_operator_used in Rust.
The projection operator the decomposition was built with:
"brown" for the well-oriented fast path, "lazard" when the well-orientedness
guard forced the complete fallback, "equational_constraint" for an
equational-constraint CAD.
Example#
This family is not part of the recommended JavaScript facade in this release. Call it through the generated symi.raw layer, whose entries are listed with their wasm-bindgen signatures above, and read Migration for the ownership rules that apply there.
Additional API#
SymiFacade#
Type
interface SymiFacadePublic type placement for SymiFacade.
createFacade#
Default context
function createFacade(rawModule: unknown): SymiFacadePublic function placement for createFacade.
CylindricalAlgebraicDecomposition#
Raw WebAssembly: CylindricalAlgebraicDecomposition constructor
new CylindricalAlgebraicDecomposition(
expressions: Expression[],
variables: string[],
equational_constraints?: Uint32Array | null,
)Construct the CAD of the polynomials in the given variable order ; projection eliminates first).
CylindricalAlgebraicDecomposition.cellCount#
Raw WebAssembly: CylindricalAlgebraicDecomposition method
cellCount(): numberThe number of full-dimensional cells partitioning .
CylindricalAlgebraicDecomposition.cellDimension#
Raw WebAssembly: CylindricalAlgebraicDecomposition method
cellDimension(index: number): numberThe geometric dimension of the full cell as a subset of (the number of sector coordinates along its cylindrical stack).
CylindricalAlgebraicDecomposition.cellKind#
Raw WebAssembly: CylindricalAlgebraicDecomposition method
cellKind(index: number): string"section" or "sector" — whether the cell is a root section or an open interval in its top variable.
CylindricalAlgebraicDecomposition.cellSamplePoint#
Raw WebAssembly: CylindricalAlgebraicDecomposition method
cellSamplePoint(index: number): Float64ArrayThe coordinates of the full cell's sample point as floats — a numeric view via the multi-precision evaluator, not a decision.
CylindricalAlgebraicDecomposition.cellSignVector#
Raw WebAssembly: CylindricalAlgebraicDecomposition method
cellSignVector(index: number): Int32ArrayThe exact sign (, , or ) of each input polynomial on the full cell, in input order.
CylindricalAlgebraicDecomposition.projectionOperatorUsed#
Raw WebAssembly: CylindricalAlgebraicDecomposition method
projectionOperatorUsed(): stringThe projection operator the decomposition was built with: "brown" for the well-oriented fast path, "lazard" when the well-orientedness guard forced the complete fallback, "equational_constraint" for an equational-constraint CAD.