SolutionSet
A finite set of solution descriptors with solver-specific metadata.
SolutionSet inherits the finite-set storage semantics of ValuesSet: accepted
descriptors are unique by symbolic equality, insertion order has no mathematical meaning,
and values exposed through elements are copies rather than mutable references into
the set. A descriptor normally represents one solution, but a descriptor containing the
reserved _n index represents a parameterized family where _n ranges over the integers.
The special all descriptor represents every value of the solved variable. Consequently,
count reports the number of stored descriptors, not the cardinality of the
mathematical solution set.
solutionsType records solver provenance: whether accepted descriptors came from
numerical strategies, symbolic/exact strategies, or both. It is not inferred from the
printed shape of a descriptor, so a symbolic strategy may produce a value such as 1.
The orthogonal solutionForm property is derived from representation and distinguishes
finite results, _n-indexed parametric families, and the all result.
The class narrows membership to Expression values and keeps rejected singular
candidates and numerical root metadata alongside the accepted solutions.
Excluded values are enforced solver state, not merely advisory metadata. Once a value is excluded,
adding the same value does not reintroduce it; excluding an already accepted value removes
it from the solution set. copy preserves accepted values, exclusions, raw roots,
partial-result state, solution type, and the unresolved expression when one is present.
Members
__get__(indices: number[]): ParserEntityMethodReads an element for parser indexing.
A RangeError if the index is outside the current set size.
Parameters
| Name | Type | Description |
|---|---|---|
indices | number[] | — |
Returns
__set__(indices: number[], value: ParserEntity): voidMethodReplaces a parser-indexed solution while preserving Expression-only membership and uniqueness.
Parameters
| Name | Type | Description |
|---|---|---|
indices | number[] | — |
value | ParserEntity | — |
Returns
void
[iterator](): Iterator<Expression>MethodIterates over independent Expression copies of the accepted solutions.
Returns
Iterator<Expression>
abs(): ValuesSetMethodNo description is available yet.
Returns
add(x: Expression): SolutionSetMethodAdds an accepted solution unless it is already present or explicitly excluded.
Parameters
| Name | Type | Description |
|---|---|---|
x | Expression | — |
Returns
addMany(x: Iterable<Expression>): SolutionSetMethodAdds accepted solutions while preserving uniqueness and exclusions. The iterable is validated before the set is changed, so invalid input cannot leave a partially updated result.
Parameters
| Name | Type | Description |
|---|---|---|
x | Iterable<Expression> | — |
Returns
addRawRoot(root: Root): SolutionSetMethodStores numerical root-refinement metadata independently of the caller's object.
Parameters
| Name | Type | Description |
|---|---|---|
root | Root | — |
Returns
addSolution(solution: Expression, forFunction: Expression, variable: string): SolutionSetMethodVerifies a candidate against the source expression before admitting it to the set. Parameterized candidates that cannot yet be closed numerically are preserved. Closed residuals must evaluate nearly to zero. Candidates that encounter exact division by zero are recorded as exclusions instead.
Parameters
| Name | Type | Description |
|---|---|---|
solution | Expression | — |
forFunction | Expression | — |
variable | string | — |
Returns
addSolutions(arr: Expression[] | SolutionSet, forFunction: Expression, variable: string): SolutionSetMethodVerifies and adds every candidate in an array or another SolutionSet.
When the source is a SolutionSet, its numerical/symbolic provenance is retained if
at least one source descriptor survives verification. Context-specific metadata such as
exclusions, raw roots, partial state, and unresolved expressions is not transferred;
use append when the complete solver result should be merged without revalidation.
Parameters
| Name | Type | Description |
|---|---|---|
arr | Expression[] | SolutionSet | — |
forFunction | Expression | — |
variable | string | — |
Returns
addValidatedNumericalSolutions(values: Iterable<Expression>): SolutionSetMethodAdds a batch of numerical solutions that has already been validated against its source polynomial. Incoming values are deduplicated by their exact numeric components before storage so a numerical root batch does not require pairwise symbolic equality checks.
Parameters
| Name | Type | Description |
|---|---|---|
values | Iterable<Expression> | — |
Returns
append(s: SolutionSet): SolutionSetMethodAppends another solution result while preserving set and solver metadata.
Exclusions are merged before accepted values so an excluded candidate cannot be
reintroduced. Raw numerical-root records are copied. partial is combined with logical
OR and differing defined solution types become mixed. If this set has no unsolved
expression, the appended set's unresolved expression is copied; when both sets already
carry different unresolved expressions, the receiver's value is retained because the
current data model can represent only one such expression.
Parameters
| Name | Type | Description |
|---|---|---|
s | SolutionSet | — |
Returns
appendValidatedNumerical(s: SolutionSet): SolutionSetMethodAppends numerical solutions that were already validated by a numerical solver. This follows the same metadata and exclusion handling as append, but avoids repeating symbolic membership checks for a batch that has already been numerically validated and deduplicated.
Parameters
| Name | Type | Description |
|---|---|---|
s | SolutionSet | — |
Returns
at(i: number): Expression | undefinedMethodReturns an independent Expression copy at the requested insertion-order index.
Parameters
| Name | Type | Description |
|---|---|---|
i | number | — |
Returns
Expression | undefined
buildFunction(argsArray?: string[]): (...args: number[]): numberMethodCompiles this value to a native JavaScript-number function when the parsed result
is an Expression.
Structured parser results expose this method so values returned by nerdamer(...)
have one consistent TypeScript surface, but they cannot be compiled as scalar
functions and throw core!UnexpectedDataType when called.
Parameters
| Name | Type | Description |
|---|---|---|
argsArray | string[] | Optional variable names in positional call order. |
Returns
(...args: number[]): number — A JavaScript-number function compiled from the scalar expression.
clear(): thisMethodRemoves accepted solutions and all solver state so the instance can be reused.
Returns
this
SolutionSet(values?: Iterable<Expression, any, any>): SolutionSetConstructorNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
values | Iterable<Expression, any, any> | — |
Returns
copy(): SolutionSetMethodReturns an independent copy including exclusions and raw-root metadata.
Returns
count(): numberMethodReturns the current number of set members.
Returns
number
dataType: "SOL"PropertyNo description is available yet.
delete(x: ParserEntity): booleanMethodRemoves the member semantically equal to x, if one is present.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
boolean
diff(variable?: ExpressionInput, n?: number | Expression): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
n | number | Expression | — |
Returns
this
Returns a new set containing members of this set that are absent from other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
dimensions(): number[]MethodReturns the one-dimensional storage size used by parser indexing.
Returns
number[]
dimensionsMatch(x: ParserEntity): xMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
x
div(_x: NerdamerInput): ValuesSetMethodRejects binary division because finite sets do not define elementwise quotients.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
each(callback: (e: Expression, i?: string | number, j?: string | number): void | Expression): thisMethodVisits or maps accepted solutions in insertion order.
Returning an Expression replaces the current solution while preserving uniqueness and
exclusions. Returning void leaves the current solution unchanged, which allows the
same method to be used for straightforward inspection without a dummy return e.
Parameters
| Name | Type | Description |
|---|---|---|
callback | (e: Expression, i?: string | number, j?: string | number): void | Expression | — |
Returns
this
elements(): Expression[]APIReturns deep-copied accepted solution descriptors in deterministic insertion order.
Returns
eq(other: ParserEntity): booleanMethodTests set equality by membership, independent of insertion order.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
evaluate(values?: ParserValuesObject): SolutionSetMethodEvaluates every member and returns a new set, collapsing equal results.
Parameters
| Name | Type | Description |
|---|---|---|
values | ParserValuesObject | — |
Returns
exclude(set: ValuesSet | SolutionSet): SolutionSetMethodAdds exclusions and removes any matching values that were already accepted.
Parameters
| Name | Type | Description |
|---|---|---|
set | ValuesSet | SolutionSet | — |
Returns
expand(): SolutionSetMethodExpands every member and returns a new set, collapsing equal results.
Returns
factor(): thisMethodNo description is available yet.
Returns
this
forEach(callback: (e: Expression, index: number): void): voidMethodVisits independent Expression copies without changing this solution set.
Parameters
| Name | Type | Description |
|---|---|---|
callback | (e: Expression, index: number): void | — |
Returns
void
getExcluded(): ValuesSetMethodReturns an independent copy of the currently excluded values.
Returns
getRawRoots(): Root[]MethodReturns independent copies of the stored numerical root-refinement records.
Returns
Root[]
gt(other: ParserEntity): booleanMethodReturns the proper-superset relation for compatibility with parser comparison syntax. Prefer isProperSupersetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
gte(other: ParserEntity): booleanMethodReturns the superset relation for compatibility with parser comparison syntax. Prefer isSupersetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
has(x: ParserEntity): booleanMethodTests whether a semantically equal member is present.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
boolean
integrate(variable?: ExpressionInput): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
Returns
this
Returns a new set containing only members present in both sets.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
isDisjointFrom(other: ValuesSet): booleanMethodReturns true when this set has no member in common with other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isEnumerable: booleanPropertyNo description is available yet.
isProperSubsetOf(other: ValuesSet): booleanMethodReturns true when this set is a strict subset of other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isProperSupersetOf(other: ValuesSet): booleanMethodReturns true when this set is a strict superset of other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isSolutionSet(obj: unknown): objMethodTests whether a value is specifically a solver SolutionSet.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | — |
Returns
obj
isSubsetOf(other: ValuesSet): booleanMethodReturns true when every member of this set is present in other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isSupersetOf(other: ValuesSet): booleanMethodReturns true when every member of other is present in this set.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isValuesSet(obj: unknown): objMethodTests whether a value is a ValuesSet or a specialized ValuesSet subtype such as
SolutionSet.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | — |
Returns
obj
lt(other: ParserEntity): booleanMethodReturns the proper-subset relation for compatibility with parser comparison syntax. Prefer isProperSubsetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
lte(other: ParserEntity): booleanMethodReturns the subset relation for compatibility with parser comparison syntax. Prefer isSubsetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
minus(_x: NerdamerInput): ValuesSetMethodRejects binary subtraction because finite sets do not define elementwise subtraction.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
numeric(precision?: ExpressionInput): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
precision | ExpressionInput | — |
Returns
this
partial: booleanPropertyNo description is available yet.
plus(_x: NerdamerInput): ValuesSetMethodBinary addition is not defined for finite sets. Use union for set union.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
pow(_x: NerdamerInput): ValuesSetMethodRejects binary exponentiation because finite sets do not define elementwise powers.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
precision: numberPropertyNo description is available yet.
simplify(): thisMethodNo description is available yet.
Returns
this
solutionForm(): SolutionFormAPIClassifies the mathematical result represented by the stored descriptors.
Arbitrary symbolic parameters do not make a result parametric in this sense. The
parametric form is reserved for solver-generated families that contain _n, where
_n represents an integer index. The special all descriptor takes precedence if
present.
Returns
solutionsType: SolutionsTypePropertySolver provenance for the currently accepted descriptors.
sort(compareFn?: (a: ParserEntity, b: ParserEntity): number): thisMethodSorts the deterministic iteration order without changing mathematical membership. A custom comparator receives copies so it cannot mutate stored members as a side effect.
Parameters
| Name | Type | Description |
|---|---|---|
compareFn | (a: ParserEntity, b: ParserEntity): number | — |
Returns
this
subst(value: ExpressionInput, withValue: ExpressionInput): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
value | ExpressionInput | — |
withValue | ExpressionInput | — |
Returns
this
Returns a new set containing members present in exactly one of the two sets.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
text(): stringMethodNo description is available yet.
Returns
string
times(_x: NerdamerInput): ValuesSetMethodRejects binary multiplication because finite sets do not define elementwise products.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
toArray(): Expression[]MethodReturns deep-copied accepted solutions as a plain array.
Returns
toString(): stringMethodNo description is available yet.
Returns
string
Returns a new set containing members present in either set.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
unsolved: ExpressionPropertyNo description is available yet.
