AngouriMath

Navigation

MonomialProduct


← Back to list of classes

Description

Summary

A product whose body is a monomial in the index, written in closed form:
product(k, k, 1, n) is factorial(n).

Remarks

The sibling of PolynomialSummation and a narrower thing than it, because a
product has no linearity to take apart: a sum of two terms is the sum of their sums, and a
product of two terms is not the product of their products in any way that helps. What is
left is the body that is a single term — c * k^p — over which the product
separates into a power of the constant and a power of the factorial.
The condition is the same one, for the same reason. An empty range multiplies to
1, so product(k, k, 1, n) is 1 at every n < 1, while
factorial(n) is not — it is undefined at the negative integers, being the gamma
function's poles. Answering the one with the other unconditionally would turn a value into
an undefinedness, which is the failure the contract's O4 is about. The identity holds
where to >= from - 1, and that is what is attached.
A positive lower bound where the index is in the body, and that one cannot go in the
condition. product(k, k, a, b) is b! / (a-1)! only where a >= 1; below
that the range runs through zero and the product is 0, while (a-1)! is
undefined. But a < 1 does not mean the range is empty, so it cannot share a
branch with the empty-range case — a piecewise saying "identity otherwise" would be wrong
there. So it is decided before anything is built, and a lower bound that is not a concrete
integer of at least one is declined instead. A constant body has no such restriction,
there being no factorial in its answer.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online