Documentation moved.
This entry is documented with its primary interface. Open the documentation →
Function
src/index.ts:1076nerdamer.product
nerdamer.product(expr: Expression, index: Expression, lower: Expression, upper: Expression): ExpressionComputes a finite product: product(expr, k, a, b) = Π_{k=a}^{b} expr.
- If bounds are integers and the number of terms ≤ Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION,
evaluates by multiplying each term.
- If lower > upper, returns 1 (empty product).
- If expr does not depend on the index variable, simplifies to expr^(b − a + 1).
- Otherwise returns a symbolic product(expr, k, a, b) node.
Parameters
| Name | Type | Description |
|---|---|---|
expr | Expression | The expression to be multiplied. |
index | Expression | The index variable (must be a plain symbol). |
lower | Expression | The lower bound (integer required for evaluation). |
upper | Expression | The upper bound (integer required for evaluation). |
Returns
Expression — The product result or a symbolic product node.
Examples
// Π_{k=1}^{5} k = 120 (same as 5!)
product('k', 'k', 1, 5).text() // "120"