prod

prod(a, b, c, ...)

prod(A)

Try it yourself:


prod(): Product of Collection Values

prod() multiplies all values in a collection. For [2, 3, 4], the result is 24. It is useful for compound factors, scaling chains, and probability products.

Zeros and precision

Any zero input makes the product zero. Large products can overflow and small fractional products can underflow, so log-space calculations with log() may be better for long sequences. Use multiply() for a fixed pair and sum() for aggregation by addition.

Confirm collection shape with size() and handle empty inputs deliberately; a mathematical empty product convention may differ from an application’s expected value.

Try Prod in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions