Skip to content

Product ​

The product of all elements in the collection.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaProduct (mathematics)MathWorldProductWikidataQ901718Britannicatopic/product-mathematicsFungrimProduct✓Fungrim entry33f13a✓Wolfram LanguageProduct!
Product(collection)the product of all elements in the collection.
Product(body, Tuple(index, lo, hi))a symbolic product over a range, closed-form whenever body is a power of the index (a factorial power) or a power WITH the index in the exponent (folds to a single power via a closed-form sum of the exponent); nested Tuple clauses reduce inner-first, so an inner limit depending on the outer index still closes. With hi = PositiveInfinity and body a ratio of polynomials in the index of equal degree and leading coefficient, closes via a Gamma-function product over the roots whenever those roots are exact (rational, Gaussian, or a quadratic surd) and the series converges; declines otherwise.
Product(body, Tuple(index))an index with neither bound stays unevaluated (an indefinite product is defined only up to a constant), where compute-engine read it as a degenerate range.
Typed signatures
TypePackageApplies
(any, tuple*) -> numberanalyticreplaces compute-enginealways
(any, tuple*) -> numbercombinatoricsreplaces evaluationalways
(any, tuple*) -> numbercompute-enginealways
(any, tuple*) -> numberevaluationreplaces compute-enginealways

Domain: Collections

Details
  • The empty product is 1 by convention, matching Factorial(0)Factorial(0). See Factorial.
  • The product of 11 through nn is n!n!: Product(Range(1,n))=Factorial(n)Product(Range(1, n)) = Factorial(n).
  • Applies Times\mathrm{Times} across the list's elements (the product of a list).
  • Forces evaluation of a lazy collection like Range, which otherwise stays unevaluated on its own.
  • A symbolic bound closes in two general shapes: ∏im=(∏i)m\prod i^m = (\prod i)^m for mm free of the index (a factorial power), and ∏cf(i)=c∑f(i)\prod c^{f(i)} = c^{\sum f(i)} for cc free of the index, the sum found by Faulhaber's formula for any polynomial ff. A product with more than one Tuple clause reduces inner-first, so a triangular product (an inner limit depending on the outer index) closes too, once the inner reduction leaves a shape the outer sum recognises.
  • An infinite product ∏k=k0∞P(k)/Q(k)\prod_{k=k_0}^{\infty} P(k)/Q(k), for PP and QQ polynomials of equal degree and equal leading coefficient, factors both over C\mathbb{C} and rewrites the ratio as a Gamma-function product via the Pochhammer identity ∏k=k0N(k−a)=Γ(N+1−a)/Γ(k0−a)\prod_{k=k_0}^{N}(k-a) = \Gamma(N+1-a)/\Gamma(k_0-a); the series converges exactly when the roots' sums agree, which cancels the N→∞N \to \infty tail. Each factor then closes either straight to a factorial (a real integer root) or, paired with its negation, via Gamma recursion and the reflection formula Γ(z)Γ(1−z)=π/sin⁡(πz)\Gamma(z)\Gamma(1-z) = \pi/\sin(\pi z). Roots come from Factor's own linear and irreducible-quadratic pieces (rational, Gaussian, or quadratic-surd only); anything past that -- an unresolved root, a pole, or an unpaired leftover -- leaves the product unevaluated rather than guess.

Examples

Basic #
live ↗
In∏[1,2,3,4]\prod\bigl\lbrack1, 2, 3, 4\bigr\rbrackOut2424

The empty product is 1 by convention, matching Factorial of 0

live ↗
In∏[]\prod\bigl\lbrack\bigr\rbrackOut11

∏i=16i2=(6!)2\prod_{i=1}^{6} i^2 = (6!)^2

live ↗
In∏i=16i2\prod_{i=1}^6i^2Out518 400518\,400

A symbolic upper limit: ∏i=1ni2=(n!)2\prod_{i=1}^{n} i^2 = (n!)^2

live ↗
In∏i=1ni2\prod_{i=1}^{n}i^2Out(n!)2(n!)^2

(6!)2=7202(6!)^2 = 720^2

live ↗
In∏k=16k2\prod_{k=1}^6k^2Out518 400518\,400

A symbolic upper limit gives a closed form, (n!)2(n!)^2

live ↗
In∏k=1nk2\prod_{k=1}^{n}k^2Out(n!)2(n!)^2

An infinite product evaluated exactly: ∏k≥2(1−k−4)=sinh⁡π/(4π)\prod_{k\ge2}(1-k^{-4}) = \sinh\pi/(4\pi)

live ↗
In∏k=2∞(1−1k4)\prod_{k=2}^{∞}(1-\frac{1}{k^4})Outsinh⁡(π)4π\frac{\sinh(π)}{4π}

A double product with a dependent inner range collapses to one power of 22

live ↗
In∏k=1,j=1p,k2j+k\prod_{k=1, j=1}^{p, k}2^{j+k}Out212p×(p+1)22^{\frac{1}{2}p×(p+1)^2}
Scope #

A symbolic upper limit: ∏k=1nk=n!\prod_{k=1}^{n} k = n!. See Factorial

live ↗
In∏k=1nk\prod_{k=1}^{n}kOutn!n!

Exponents add: ∏k=1nxk=xn(n+1)/2\prod_{k=1}^{n} x^k = x^{n(n+1)/2}

live ↗
In∏k=1nxk\prod_{k=1}^{n}x^{k}Outxn×(n+1)2x^{\frac{n×(n+1)}{2}}

A telescoping product: ∏k=1nk+1k=n+1\prod_{k=1}^{n} \frac{k+1}{k} = n+1

live ↗
In∏k=1nk+1k\prod_{k=1}^{n}\frac{k+1}{k}Outn+1n+1

An undefined function, expanded term by term

live ↗
In∏i=14f(i)\prod_{i=1}^4f(i)Outf(1)f(2)f(3)f(4)f(1)f(2)f(3)f(4)

A step of 2 takes every other index

live ↗
In∏i=14f(i)\prod_{i=1}^4f(i)Outf(1)f(3)f(1)f(3)

Over an explicit list of values

live ↗
In∏i∈[a,b,c]f(i)\prod_{i∈\bigl\lbrack a, b, c\bigr\rbrack}f(i)Outf(a)f(b)f(c)f(a)f(b)f(c)

A polynomial with roots 1, 2 and 3

live ↗
In∏k=13(x−k)\prod_{k=1}^3(x-k)Out(x−3)(x−2)(x−1)(x-3)(x-2)(x-1)

A double product over a 3×33 \times 3 grid

live ↗
In∏i=1,j=13,3(i+j)\prod_{i=1, j=1}^{3, 3}(i+j)Out172 800172\,800

An inner limit that depends on the outer index, a triangular product

live ↗
In∏i=1,j=13,i(i+j)\prod_{i=1, j=1}^{3, i}(i+j)Out2 8802\,880

A symbolic triangular product: ∏i=1p∏j=1i2i+j=2p(p+1)2/2\prod_{i=1}^{p}\prod_{j=1}^{i} 2^{i+j} = 2^{p(p+1)^2/2}

live ↗
In∏i=1,j=1p,i2i+j\prod_{i=1, j=1}^{p, i}2^{i+j}Out212p×(p+1)22^{\frac{1}{2}p×(p+1)^2}

An infinite product with a closed form: ∏k=1∞(1+1/k2)=sinh⁡ππ\prod_{k=1}^{\infty} (1 + 1/k^2) = \frac{\sinh \pi}{\pi}

live ↗
In∏k=1∞(1+1k2)\prod_{k=1}^{∞}(1+\frac{1}{k^2})Outsinh⁡(π)π\frac{\sinh(π)}{π}

An infinite telescoping product: ∏k=2∞(1−1/k2)=12\prod_{k=2}^{\infty} (1 - 1/k^2) = \frac{1}{2}

live ↗
In∏k=2∞(1−1k2)\prod_{k=2}^{∞}(1-\frac{1}{k^2})Out12\frac{1}{2}

A quartic infinite product, via a Gamma product over a conjugate pair of Gaussian-integer roots ±i\pm i alongside the real roots ±1\pm 1: ∏i=2∞(1−1/i4)=sinh⁡π4π\prod_{i=2}^{\infty} (1 - 1/i^4) = \frac{\sinh \pi}{4\pi}

live ↗
In∏i=2∞(1−1i4)\prod_{i=2}^{∞}(1-\frac{1}{i^4})Outsinh⁡(π)4π\frac{\sinh(π)}{4π}

Exact rationals in a collection

live ↗
In∏[12,23,34]\prod\bigl\lbrack\frac{1}{2}, \frac{2}{3}, \frac{3}{4}\bigr\rbrackOut14\frac{1}{4}

Symbolic elements

live ↗
In∏[a,b,c]\prod\bigl\lbrack a, b, c\bigr\rbrackOutabcabc
live ↗
In∏knak\prod_{k}^{n}a^{k}Outan×(n+1)2a^{\frac{n×(n+1)}{2}}
live ↗
In∏j,km,jak\prod_{j, k}^{m, j}a^{k}Outa16m×(m+1)(m+2)a^{\frac{1}{6}m×(m+1)(m+2)}

Without bounds the nested product has no value and stays unevaluated

live ↗
In∏k,jjk\prod_{k, j}jkOut∏k∏jjk\prod_{k}\prod_{j}jk

The unbounded inner product blocks evaluation; only nesting is made explicit

live ↗
In∏k=1,jnjk\prod_{k=1, j}^{n}jkOut∏k=1n∏jjk\prod_{k=1}^{n}\prod_{j}jk
live ↗
In∏k(3q2k+5)\prod_{k}(3q^{2k}+5)Out∏k(3q2k+5)\prod_{k}(3q^{2k}+5)
live ↗
In∏kq8(k+1)+11q8k+11\prod_{k}\frac{q^{8(k+1)}+11}{q^{8k}+11}Out∏kq8(k+1)+11q8k+11\prod_{k}\frac{q^{8(k+1)}+11}{q^{8k}+11}
Applications #

Range stays lazy on its own, but Product forces it to compute 6!6!

live ↗
In∏(1..6)\prod(1..6)Out720720
Properties #

The product of 11 through nn is n!n!. See Factorial

live ↗
In∏[1,2,3,4]=4!\prod\bigl\lbrack1, 2, 3, 4\bigr\rbrack=4!OutTrue\mathrm{True}
Neat examples #

The Wallis product, via the same Gamma-product method: ∏k=1∞4k24k2−1=π2\prod_{k=1}^{\infty} \frac{4k^2}{4k^2-1} = \frac{\pi}{2}

live ↗
In∏k=1∞4k24k2−1\prod_{k=1}^{∞}\frac{4k^2}{4k^2-1}Outπ2\frac{π}{2}

Roots need not pair off as ±r\pm r -- 00 and −3-3 each close on their own, straight to a factorial: ∏n=1∞n(n+3)(n+1)(n+2)=13\prod_{n=1}^{\infty} \frac{n(n+3)}{(n+1)(n+2)} = \frac{1}{3}

live ↗
In∏n=1∞n×(n+3)(n+1)(n+2)\prod_{n=1}^{∞}\frac{n×(n+3)}{(n+1)(n+2)}Out13\frac{1}{3}
About
Examples33
Checked againstWolfram Language 28 agree4 differSymPy 15 agreemathlib4 2 agreeSageMath 5 agree1 differ2 unevaluated4 error
CrosswalkWikipediaMathWorldWikidataBritannicaFungrimFungrim entryWolfram LanguageSageMathSymPy

Implementation

mappedsagepackages/oracle/src/mappings.ts
mappedsympypackages/oracle/src/mappings.ts
mappedmathlib4packages/oracle/src/mappings.ts

As Sum; an empty range is 1, as ours.

See also: Length