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

Deferred forms

Deferred forms preserve an operation symbolically until its variables, bounds, or assumptions are sufficiently known. Use execute or the corresponding eager operation when you want evaluation.

Unevaluated form constructors#

integral#

Raw WebAssembly: Default context

integral(
    integrand: Expression,
    variable: string,
    lower?: Expression | null,
    upper?: Expression | null,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.integral

integral(
    integrand: Expression,
    variable: string,
    lower?: Expression | null,
    upper?: Expression | null,
): Expression

Build an unevaluated integral node (indefinite when bounds are omitted). Use integrate/integrate_definite for eager evaluation, or execute on the node. A definite integral node has a numerical value only on explicit request, through integrate_definite_numeric or evaluate_numeric.

derivative_unevaluated#

Raw WebAssembly: Default context

derivativeUnevaluated(
    input_expression: Expression,
    variable: string,
    order?: number | null,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.derivativeUnevaluated

derivativeUnevaluated(
    input_expression: Expression,
    variable: string,
    order?: number | null,
): Expression

Raw WebAssembly: Expression method: Expression.derivativeUnevaluated

derivativeUnevaluated(
    variable: string,
    order?: number | null,
): Expression

Constructs an unevaluated derivative node of an arbitrary expression, the name stating the deferral outright. The variable may be a name or a same-context symbol expression. Nothing is differentiated here: use execute on the node, or differentiate — spelled diff on a Python expression — to differentiate now.

derivative#

Raw WebAssembly: Default context

derivative(
    input_expression: Expression,
    variable: string,
    order?: number | null,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.derivative

derivative(
    input_expression: Expression,
    variable: string,
    order?: number | null,
): Expression

Expression method: Expression.derivative

derivative(variable: VariableLike, order?: number): Expression

Raw WebAssembly: Expression method: Expression.derivative

derivative(variable: string, order?: number | null): Expression

The same deferred constructor as derivative_unevaluated, under its short spelling. Nothing is differentiated here: use execute on the node, or differentiate to differentiate now.

This is not the derivative of a named unknown function. An equation built from this placeholder is not recognised by the differential-equation classifiers, which read the structural derivative built by UndefinedFunction.derivative.

summation#

Raw WebAssembly: Default context

summation(
    summand: Expression,
    index: string,
    lower: Expression,
    upper: Expression,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.summation

summation(
    summand: Expression,
    index: string,
    lower: Expression,
    upper: Expression,
): Expression

Build a summation node ∑\sum. execute evaluates it when a closed form or finite expansion exists. For the indefinite anti-difference see summation_indefinite on the calculus page. Definite hypergeometric sums are closed by Zeilberger creative telescoping: a defining recurrence is produced and verified, then closed to a hypergeometric form when one exists (e.g. ∑k=0nkC(n,k)=n2n−1\sum_{k=0}^{n} k C(n,k) = n 2^{n-1}. When no hypergeometric closed form exists (Apéry-type sums such as the central Delannoy numbers ∑kC(n,k)C(n+k,k)\sum_k C(n,k) C(n+k,k)), execute returns the verified defining recurrence as a recurrence_equation node rather than declining. Every result is symbolically verified before return, so a sum outside the closed scope stays an unevaluated summation placeholder rather than a guess. Its numerical value is produced only on explicit request, through summation_numeric or evaluate_numeric.

Bounds. The summation range no longer has to be 0..n. Bounds may be any integer-affine form in the parameters (∑k=02n\sum_{k=0}^{2n}) or a min/max of such forms (∑k=−min⁡(a,b,c)min⁡(a,b,c)\sum_{k=-\min(a,b,c)}^{\min(a,b,c)}). They are admitted by proof: the term's own zero extension — a binomial coefficient vanishes outside 0≤bottom⁡≤top⁡0 \le \operatorname{bottom} \le \operatorname{top} — gives an interval outside which the summand is provably zero, and the declared bounds are accepted only when they are at least that wide. A declared range that clips the support is refused rather than answered.

Parameters. Any number of parameters is admitted. One carries the recurrence and the rest ride along symbolically, so ∑k=0rC(m,r−k)C(n,k)=C(m+n,r)\sum_{k=0}^{r} C(m,r-k) C(n,k) = C(m+n,r) is closed with m and n intact.

Domain. Results involving binomial coefficients and factorials are proved on the non-negative-integer domain, under the combinatorial convention that binomial(n, k) is zero outside 0≤k≤n0 \le k \le n. They are not claimed as unrestricted Gamma-analytic identities, and the integrality and non-negativity each result depends on are recorded during normalization rather than assumed silently.

Alternating squared binomial rows. ∑k=0n(−1)kC(n,k)2\sum_{k=0}^{n} (-1)^k C(n,k)^2 is closed as the coefficient of xnx^n in (1−x)n(1+x)n=(1−x2)n(1-x)^n (1+x)^n = (1-x^2)^n: it is 0 for odd n and (−1)n/2C(n,n/2)(-1)^{n/2} C(n, n/2) for even n, so ∑k=020(−1)kC(20,k)2=184756\sum_{k=0}^{20} (-1)^k C(20,k)^2 = 184756. A constant factor and an integer offset in the sign's exponent pass through. A literal row supplies its own parity; a symbolic row is closed only when the assumption context proves it a non-negative integer and decides whether it is even or odd, and is otherwise left to the general recurrence machinery.

Logarithmic and polylogarithmic series. An infinite sum ∑k=L∞c ∏ibi±k+ai/ks\sum_{k=L}^{\infty} c\, \prod_i b_i^{\pm k + a_i} / k^s with exact rational bases, integer offsets, and a positive integer order s is the polylogarithm Li⁡s(w)\operatorname{Li}_s(w) at w=∏ibi±1w = \prod_i b_i^{\pm 1} less its exact prefix below L. It is evaluated wherever the defining series converges: absolutely for ∣w∣<1|w| < 1, and on ∣w∣=1|w| = 1 for s>1s > 1. At w=−1w = -1 and s=1s = 1 the series converges only conditionally, by the alternating-series test, and its sum is the boundary value Li⁡1(−1)=−log⁡2\operatorname{Li}_1(-1) = -\log 2 by Abel's theorem, so ∑k≥1(−1)k+1/k=log⁡2\sum_{k\geq 1} (-1)^{k+1}/k = \log 2. A conditionally convergent series is never split term by term, because rearranging it can change its sum.

Finite trigonometric progressions. execute closes finite linear combinations of sin(phase + stride*index) and cos(phase + stride*index) when the coefficients, phase, and stride are index-free and the bounds prove a finite nonnegative integer count. The result is a piecewise centered trigonometric form: the branch exp(i*stride) = 1 evaluates the constant progression directly, and its complement uses the finite Fourier quotient. This branch ledger preserves the value at removable singularities instead of silently dividing by sin(stride/2). An unconstrained symbolic range, nonlinear index phase, or branch budget overflow leaves the summation unevaluated.

Resource behaviour. A search that reaches a resource ceiling before its derived mathematical bound preserves the unevaluated summation node. That outcome is a statement about the search, never a claim that no closed form or recurrence exists; the same placeholder is also what an out-of-scope summand produces, so the placeholder should never be read as a negative result.

C-finite summands. A summand built from C-finite sequences — sequences satisfying a homogeneous linear recurrence with constant coefficients, of which fibonacci_number is the built-in this release registers — is not hypergeometric and is closed by a separate route. The admitted class is the finite state algebra generated by fixed non-negative shifts and affine subsequences of those sequences, closed under rational scaling, addition, finite products, and fixed non-negative integer powers, so ∑k=1nF(k)2=F(n)F(n+1)\sum_{k=1}^{n} F(k)^2 = F(n) F(n+1) and ∑k=0nF(k)=F(n+2)−1\sum_{k=0}^{n} F(k) = F(n+2) - 1 are both in scope. The anti-difference is constructed by solving one exact linear system in that algebra, not guessed and tested. A separate route recognizes the binomial transform ∑k=0nC(n,k)g(k)\sum_{k=0}^{n} C(n,k) g(k) for an admitted g, giving ∑k=0nC(n,k)F(k)=F(2n)\sum_{k=0}^{n} C(n,k) F(k) = F(2n).

Floor-bounded ranges. An upper bound of the form floor⁡((an+b)/m)\operatorname{floor}((a n + b)/m) with exact integers a, b and positive m is admitted. It is normalized by Euclidean division on the parameter into a complete, disjoint ledger of m residue strata, on each of which the bound is an ordinary affine expression; empty strata are recorded explicitly rather than inherited from a combinatorial convention. On top of that, affine binomial diagonals ∑k=0floor⁡((n+b)/(c+1))binomial⁡(n+b−ck,k)\sum_{k=0}^{\operatorname{floor}((n+b)/(c+1))} \operatorname{binomial}(n+b-c k, k) are closed by a structural Pascal decomposition whose moving boundary terms are each proved zero, giving ∑k=0floor⁡(n/2)binomial⁡(n−k,k)=fibonacci_number⁡(n+1)\sum_{k=0}^{\operatorname{floor}(n/2)} \operatorname{binomial}(n-k, k) = \operatorname{fibonacci\_number}(n+1).

Verification. Every C-finite and floor-bounded result carries two independent exact checks before it is returned: the construction identity is replayed (the forward difference in the state algebra, the transformed state against directly accumulated exact sums, or the Pascal decomposition against its residue ledger and boundary terms), and the returned expression is then proved equal to the derived recurrence's unique solution on a complete initial window. A presentation such as fibonacci_number(2n) is admitted only after that uniqueness argument closes — never by matching a name. When a recurrence is found but no expression in the language represents its solution, the sum stays an unevaluated summation node.

Domain. These identities are proved on the non-negative-integer stratum and record that assumption; a parameter the assumption context proves negative declines instead. Zero extension of a binomial is used only where the built-in's own semantics prove it — both arguments non-negative with the bottom above the top — and never for a negative top argument, where the built-in is undefined.

product#

Raw WebAssembly: Default context

product(
    multiplicand: Expression,
    index: string,
    lower: Expression,
    upper: Expression,
): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.product

product(
    multiplicand: Expression,
    index: string,
    lower: Expression,
    upper: Expression,
): Expression

Definite indexed product ∏index=loweruppermultiplicand\prod_{\mathit{index}=\mathit{lower}}^{\mathit{upper}} \mathit{multiplicand}, a first-class indexed_product binder (rendered \prod in LaTeX). The result is the closed form produced by the product engine. A range the assumption context proves reversed is the empty product 1. Otherwise the engine tries, in order:

  • Rational anti-quotients. Factorial and Pochhammer recognition (∏k=1nk=n!\prod_{k=1}^{n} k = n!); telescoping and rational products via Gamma quotients (∏k=1nk/(k+1)=1/(n+1)\prod_{k=1}^{n} k/(k+1) = 1/(n+1)); and exact shift-orbit reduction over the rationals and the Gaussian rationals, which discovers an anti-quotient whenever numerator and denominator factors are integer shifts of one another (∏k=2∞(k3−1)/(k3+1)=2/3\prod_{k=2}^{\infty}(k^3-1)/(k^3+1) = 2/3, ∏k=0∞(k(k+1)+1+i)/(k(k+1)+1−i)=−1\prod_{k=0}^{\infty}(k(k+1)+1+i)/(k(k+1)+1-i) = -1).
  • Balanced rational infinite products. With upper = infinity and an exact finite integer lower bound, a shift-free rational residual that splits into affine factors with equal factor counts and equal shift sums converges, and its value is the Gamma quotient of Euler's finite definition (∏k=1∞(1−1/(4k2))=2/π\prod_{k=1}^{\infty}(1 - 1/(4k^2)) = 2/\pi, Wallis =π/2= \pi/2). Unequal counts, unequal shift sums, a surviving constant content, a factor that vanishes on the range, or a pole on the range are not closed by this route; the telescoped partial product below still decides the ones whose partial products provably tend to zero.
  • Periodic interlacing. A bounded period generated by an exact root of unity (currently ±1\pm 1 and ±i\pm i) splits the range into complete residue blocks which are routed through the rational machinery (∏k=1∞(1+(−1)k+1/(2k−1))=2\prod_{k=1}^{\infty}(1 + (-1)^{k+1}/(2k-1)) = \sqrt{2}). Every terminal prefix of a block must separately be proved to tend to one, so a regrouping that converges while the ordered product oscillates is declined.
  • Finite Gamma grids. A gamma multiplicand whose argument is affine in the index over an exact concrete integer range is materialised and normalised by Gamma recurrence, Euler reflection, and the Gauss multiplication formula (∏k=18Γ(k/3)=6403 π3/6561\prod_{k=1}^{8}\Gamma(k/3) = 640\sqrt{3}\,\pi^3/6561). A symbolically complete Gauss grid, whose cardinality is proved equal to the grid denominator, is closed by the multiplication formula without materialising any factor.
  • Parametric root-of-unity products. The homogeneous quadratic family ∏k=1n−1(a2−2abcos⁡(kπ/n)+b2)\prod_{k=1}^{n-1}(a^2 - 2ab\cos(k\pi/n) + b^2) is the complete factorisation of a2n−b2na^{2n} - b^{2n} over the 2n2n-th roots of unity with +1+1 and −1-1 removed. The result is the total piecewise ((a2n−b2n)/(a2−b2) if a2≠b2; n (a2)n−1 if a2=b2)\bigl((a^{2n}-b^{2n})/(a^2-b^2)\ \text{if}\ a^2 \neq b^2;\ n\,(a^2)^{n-1}\ \text{if}\ a^2 = b^2\bigr), because the published quotient is 0/00/0 on the second stratum.

Every result is symbolically grounded in the multiplicative discrete Newton–Leibniz identity P(upper+1)/P(lower) and, for an infinite product, in a finite partial-product identity whose step quotient and lower endpoint are verified exactly before its limit is taken.

The value of an infinite product is the limit of its partial products. When the telescoped partial product P(m+1)/P(lower) is proved to tend to exactly zero, the product is 0 (∏k=1∞k/(k+1)=lim⁡m→∞1/(m+1)=0\prod_{k=1}^{\infty} k/(k+1) = \lim_{m\to\infty} 1/(m+1) = 0); in the classical terminology that reserves convergence for a nonzero limit, such a product diverges to zero. Partial products that grow without bound, oscillate, or have an undecided limit leave the product unevaluated.

Domain. The root-of-unity family needs n to be a proved positive integer: the assumption context must say so, and a free symbol is never silently treated as an integer. Cancellation across a shifted factor is performed only after proving that the cancelled factor is nonzero at every integer of the range, so the same formal cancellation is admitted below a pole and refused on it. Anything outside this closed scope — an irreducible higher-degree multiplicand with algebraic roots, a coefficient field beyond Q\mathbb{Q} and Q(i)\mathbb{Q}(i), an unbounded or unproved period, a q-product, or an infinite product whose convergence is not proved — stays an unevaluated indexed_product placeholder rather than a guess.

product_indefinite#

Not exposed by the WASM / JavaScript bindings. Available as Context.product_indefinite in Python, UniffiSession.productIndefinite in Kotlin, UniffiSession.productIndefinite in Swift, api::analysis::Session::product_indefinite in Rust.

Indefinite (anti-quotient) product: the P(k) satisfying P(k+1)/P(k) = multiplicand(k), the multiplicative analogue of summation_indefinite. A rational multiplicand over Q\mathbb{Q} or Q(i)\mathbb{Q}(i) is first put through exact shift-orbit reduction, which returns a purely rational anti-quotient whenever the numerator and denominator factors pair up across integer shifts ((k3−1)/(k3+1)(k^3-1)/(k^3+1) gives (k2−k+1)/(k(k−1))(k^2-k+1)/(k(k-1))); what the reduction leaves behind falls back to the Gamma-quotient anti-quotient. Index-free-base powers close through the summation anti-difference of their exponent. Declines to the unevaluated indexed_product placeholder when no closed form is in scope.

piecewise#

Raw WebAssembly: Default context

piecewise(
    branches: Expression[],
    otherwise?: Expression | null,
): Expression
Calling forms

Explicit context: Context.piecewise

piecewise(branches: Iterable<PiecewiseBranch>): Expression

Raw WebAssembly: Explicit context: Context.piecewise

piecewise(
    branches: Expression[],
    otherwise?: Expression | null,
): Expression

SymiFacade method: SymiFacade.piecewise

piecewise(branches: Iterable<PiecewiseBranch>): Expression

Build a piecewise expression from (value, condition) pairs with first-match semantics; otherwise appends an always-true final branch. Branches whose condition is provably false are dropped at construction; if every condition fails the result is the undefined sentinel. The result keeps the facts its conditions and values were derived under. Values whose facts contradict one another — each valid only where its own condition selects it — still form a piecewise expression, whose facts are then recorded as unknown rather than refused.

Notes: WASM takes a flat interleaved array [value_0, condition_0, value_1, condition_1, ...].

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.

summation_indefinite#

Raw WebAssembly: Default context

summationIndefinite(summand: Expression, index: string): Expression
Calling forms

Raw WebAssembly: Explicit context: Context.summationIndefinite

summationIndefinite(summand: Expression, index: string): Expression

Raw WebAssembly: Expression method: Expression.summationIndefinite

summationIndefinite(index: string): Expression

The anti-difference of summand: a closed form FF with F(index+1)−F(index)=summandF(\mathrm{index}+1) - F(\mathrm{index}) = \mathrm{summand}. It is the discrete counterpart of an indefinite integral, and it sits here beside product_indefinite for the same reason — when no closed form is found, the unevaluated summation is what is returned.

Additional API#

productIndefinite#

Raw WebAssembly: Default context

productIndefinite(multiplicand: Expression, index: string): Expression

Indefinite (anti-quotient) product: the P(k) satisfying P(k+1)/P(k) = multiplicand(k), the multiplicative analogue of summation_indefinite.

Calling forms

Raw WebAssembly: Explicit context: Context.productIndefinite

productIndefinite(multiplicand: Expression, index: string): Expression

Symi documentation · WASM / JavaScript