Skip to content
Symi Docs
WASM / JavaScript

Signatures in the WASM / JavaScript view are TypeScript. Where the JavaScript facade wraps an operation its form is listed first; the other calling forms are the raw wasm-bindgen exports.

On this page

Algebraic transforms

Directed algebraic rewrites change the form of an expression while preserving its value on the documented domain. Each operation applies one named transformation rather than searching, so the result shape is predictable. For the search-based ladder see general simplification.

expand#

Raw WebAssembly: Default context

expand(input_expression: Expression): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.expand

expand(input_expression: Expression): Expression

Raw WebAssembly: Expression method: Expression.expand

expand(): Expression

Expand products, integer powers, and supported algebraic forms.

partial_fractions#

Raw WebAssembly: Default context

partialFractions(
    input_expression: Expression,
    variable: string,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.partialFractions

partialFractions(
    input_expression: Expression,
    variable: string,
): Expression

Raw WebAssembly: Expression method: Expression.partialFractions

partialFractions(variable: string): Expression

Decompose a rational expression into polynomial and proper-fraction terms over the named variable.

For factorization, cancellation, collection, and radical operations, use general simplification.

Algebraic form changes#

factor#

Raw WebAssembly: Default context

factor(
    input_expression: Expression,
    gaussian?: boolean | null,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.factor

factor(
    input_expression: Expression,
    gaussian?: boolean | null,
): Expression

Raw WebAssembly: Expression method: Expression.factor

factor(gaussian?: boolean | null): Expression

Polynomial factorization over the rationals (full multivariate). With gaussian=True, factor a univariate polynomial over the Gaussian integers Z[i]\mathbb{Z}[i]; this form requires exactly one free variable and raises otherwise.

collect#

Raw WebAssembly: Default context

collect(input_expression: Expression, generator: Expression): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.collect

collect(input_expression: Expression, generator: Expression): Expression

Raw WebAssembly: Expression method: Expression.collect

collect(generator: Expression): Expression

Regroup the additive terms of expression by the numeric (integer or rational) powers of a single generator, which may be a variable or an arbitrary subexpression, writing the result as a sum of generator^k * coefficient(k) terms without expanding the coefficients. For example, collecting a*x^2 + b*x^2 + a*x - b*x + c by x yields x^2*(a + b) + x*(a - b) + c. The rewrite is exact and equality-preserving; a numeric-literal generator, or a generator that appears with only a single power, returns the input unchanged.

complete_the_square#

Raw WebAssembly: Default context

completeTheSquare(
    input_expression: Expression,
    variable: Expression,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.completeTheSquare

completeTheSquare(
    input_expression: Expression,
    variable: Expression,
): Expression

Raw WebAssembly: Expression method: Expression.completeTheSquare

completeTheSquare(variable: Expression): Expression

Rewrite an expression that is quadratic in variable into the exact vertex form a*(variable - h)^2 + k, with h = -b/(2*a) and k = c - b^2/(4*a) built from the degree-2, degree-1 and degree-0 coefficients a, b, c of the expression collected in variable. For example, 2*x^2 - 4*x + 7 becomes 2*(x - 1)^2 + 5. The coefficients may contain other symbols freely, so the multivariate case is the per-variable quadratic slice: x^2 + 2*x*y + 3 becomes (x + y)^2 - y^2 + 3 in x. The rewrite is exact and equality-preserving, and the square is never expanded.

The input is returned unchanged whenever the rewrite does not apply: when variable is not a symbol (a kernel generator such as sin(x) is not supported in this release); when the expression is not a quadratic polynomial slice in variable — its collected powers of variable must be exactly {2}, {2, 0}, {2, 1} or {2, 1, 0} and every coefficient must be free of variable, so x^3 + x, x^(1/2) + x, x + 1 and sin(x)*x^2 + x all decline; when b = 0 and the expression is therefore already in vertex form (3*x^2 + 5); and when the leading coefficient a is not provably nonzero. A numeric a always qualifies, while a symbolic a qualifies only when the assumption context proves it nonzero — dividing by a possibly-zero leading coefficient would make the emitted form invalid on the a = 0 locus, so a*x^2 + x declines for an unrestricted a and completes when a is assumed positive.

factor_common_terms#

Raw WebAssembly: Default context

factorCommonTerms(input_expression: Expression): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.factorCommonTerms

factorCommonTerms(input_expression: Expression): Expression

Raw WebAssembly: Expression method: Expression.factorCommonTerms

factorCommonTerms(): Expression

Pull the greatest common monomial and exact rational content out of the terms of a general — not necessarily polynomial — sum, producing a single product of a common factor and a reduced sum, without invoking full polynomial factorization. For example, 6*x*y + 9*x^2*sin(z) becomes 3*x*(2*y + 3*x*sin(z)). The numeric content is negative exactly when every term is negative (-2*x - 4*y pulls -2, while 2*x - 4*y and x^3 - 3*x pull positive content), a kernel with numeric exponents is extracted at its minimum exponent only when that minimum is positive (x + 1/x is left for cancel/together), and a kernel with a symbolic exponent is extracted whole only when the exponent is structurally identical in every term (a*x^n + b*x^n becomes x^n*(a + b)). The rewrite is exact and equality-preserving; when no nontrivial common factor exists, or the input is not a sum, the input is returned unchanged. The reduced sum is never factored further — that is factor's job.

rationalize_denominator#

Raw WebAssembly: Default context

rationalizeDenominator(input_expression: Expression): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.rationalizeDenominator

rationalizeDenominator(input_expression: Expression): Expression

Raw WebAssembly: Expression method: Expression.rationalizeDenominator

rationalizeDenominator(): Expression

Rationalize a radical denominator through exact multiquadratic conjugation or extended-Euclidean inversion in one rational n-th-root extension. For example, 1 / (sqrt(3) - sqrt(2)) becomes sqrt(3) + sqrt(2), and 1 / (1 + 2^(1/3)) becomes (1 - 2^(1/3) + 2^(2/3))/3. The operation is directed and returns its input unchanged when the denominator is outside its bounded supported radical class or the exact remultiplication check fails.

collect_radicals#

Raw WebAssembly: Default context

collectRadicals(input_expression: Expression): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.collectRadicals

collectRadicals(input_expression: Expression): Expression

Raw WebAssembly: Expression method: Expression.collectRadicals

collectRadicals(): Expression

Collect like numeric radical kernels in a top-level sum. For example, a*sqrt(2) + b*sqrt(2) + 3 becomes (a + b)*sqrt(2) + 3. At most eight distinct kernels are considered; inputs beyond that bound return unchanged.

denest_radicals#

Raw WebAssembly: Default context

denestRadicals(input_expression: Expression): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.denestRadicals

denestRadicals(input_expression: Expression): Expression

Raw WebAssembly: Expression method: Expression.denestRadicals

denestRadicals(): Expression

Denest the bounded depth-two real-radical subset bottom-up: rational quadratic surds, up to three inner quadratic surds, and cbrt(a + b*sqrt(c)) when its exact resolvent has a rational root. For example, sqrt(3 + 2*sqrt(2)) becomes 1 + sqrt(2) and cbrt(2 + sqrt(5)) becomes (1 + sqrt(5))/2. A form outside this decidable subset, such as sqrt(1 + sqrt(2)), is returned unchanged. Every candidate is verified by exact repowering and principal-real-sign selection.

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.

Symi documentation · WASM / JavaScript