CoeffObject
Stores coefficients indexed by the power or multidegree collected from an expression.
Expression.coeffs and Polynomial.coeffs use string keys. A
univariate coefficient uses a key such as "2"; multivariate collection uses a
comma-separated degree tuple such as "1,0", in the same order as
CoeffObject.variables.
The object is mutable. The constructor retains the supplied variables array, and
the public coeffs record exposes the stored expression references directly.
Methods such as CoeffObject.toArray are intended for univariate numeric power
keys; a multidegree key cannot be represented by that dense array form.
Members
add(key: string, value: Expression): voidMethodAdds an expression to the coefficient stored at a degree key.
A new key retains value by reference. An existing key is replaced with the
expression returned by symbolic addition.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | Power or comma-separated multidegree key. |
value | Expression | Coefficient contribution to accumulate. |
Returns
void
coeffs: { … }PropertyMutable coefficient expressions keyed by power or comma-separated multidegree.
CoeffObject(variables: string[]): CoeffObjectConstructorCreates an empty coefficient collection for the requested variable order.
Parameters
| Name | Type | Description |
|---|---|---|
variables | string[] | Variables used to interpret coefficient degree keys. The array is retained by reference. |
Returns
each(fn: (e: Expression, p: string): void): CoeffObjectMethodVisits each stored coefficient and its degree key.
Parameters
| Name | Type | Description |
|---|---|---|
fn | (e: Expression, p: string): void | Callback receiving the stored expression reference and key. |
Returns
CoeffObject — This coefficient object for chaining.
getPower(p: string | number): ExpressionMethodReturns the stored coefficient for a power or multidegree key.
Parameters
| Name | Type | Description |
|---|---|---|
p | string | number | Key to look up. |
Returns
Expression — The internal expression reference, or undefined when the key is absent.
hasPower(p: string | number): booleanMethodTests whether a power or multidegree key is present, including an explicit zero.
Parameters
| Name | Type | Description |
|---|---|---|
p | string | number | Key to test. |
Returns
boolean
max(): numberMethodReturns the greatest numeric power key, or NaN when any key is non-numeric.
Returns
number
text(formatted: boolean): stringMethodFormats the sparse coefficient record for inspection.
Parameters
| Name | Type | Description |
|---|---|---|
formatted | boolean | Add line breaks and indentation between entries. |
Returns
string
toArray(): Expression[]MethodConverts univariate coefficients to a dense array indexed by power.
Missing powers are filled with new zero expressions. With asNumber: true, each
coefficient is converted using JavaScript numeric conversion, which may lose exact
precision. The method does not remove or copy coefficients already stored here.
NaNError Thrown when a key, such as a multidegree tuple, cannot be interpreted as a numeric univariate power.
Parameters
| Name | Type | Description |
|---|---|---|
asNumber | false | — |
Returns
toExpression(): ExpressionMethodReconstructs the stored coefficients as a native symbolic expression.
Returns
toParsableString(): stringMethodBuilds parser text representing the stored coefficient terms.
Each degree key is interpreted using the configured variable order, including
comma-separated multidegrees such as "2,1" for x^2*y.
Returns
string
toPolynomial(): PolynomialMethodReconstructs the coefficients as a Polynomial without reparsing ordinary terms. Coefficients that contain one of the configured polynomial variables are passed through the normal constructor so overlapping coefficient and monomial powers are canonicalized.
Returns
Polynomial — A new polynomial with independent terms and a synchronized expression.
toString(): stringMethodNo description is available yet.
Returns
string
toVector(): VectorMethodConverts univariate coefficients to a dense Vector ordered by ascending power. Missing powers are represented by zero expressions.
Returns
variables: string[]PropertyVariables whose order defines the degree keys in coeffs.
