ApasScript.

Array Reductions

sum

The sum of a list of numbers, given either as separate arguments or as a single bound array. Over quantities (quantity(3, "N") and the like) the answer keeps the unit when all share one, else it is in coherent SI; a plain number among quantities is a dimension error. Over an index, sum(term, k, a, b) adds the term for k from a to b, exactly: sum(k^2, k, 1, 10) is 385, sum(1/k, k, 1, 50) a 23-digit over 22-digit fraction; a total past 400 digits is refused and fsum(term, k, a, b) named, which adds in doubles. A condition as the term counts the k that meet it: sum(isPrime(k), k, 1, 100) is 25, and the index may stand inside any function, sum(isPrime(quotient(10^k - 1, 9)), k, 2, 25) is 3. A letter as the upper bound gives the closed form in it, as sumClosed: sum(k^3, k, 1, n) is 1/4*n^2 + 1/2*n^3 + 1/4*n^4.

product

The product of a list of numbers, given either as separate arguments or as a single bound array. A product of exact numbers works while the answer has at most 2600 digits (the bottom of a fraction counts twice); decimals have no such limit. Over quantities (quantity(3, "N") and the like) the answer keeps the unit when all share one, else it is in coherent SI; a plain number among quantities is a dimension error.

mean

The arithmetic mean of a list of numbers, given either as separate arguments or as a single bound array. Over quantities (quantity(3, "N") and the like) the answer keeps the unit when all share one, else it is in coherent SI; a plain number among quantities is a dimension error.

min

The smallest value in a list of numbers, given either as separate arguments or as a single bound array. Over quantities (quantity(3, "N") and the like) the answer keeps the unit when all share one, else it is in coherent SI; a plain number among quantities is a dimension error.

max

The largest value in a list of numbers, given either as separate arguments or as a single bound array. Over quantities (quantity(3, "N") and the like) the answer keeps the unit when all share one, else it is in coherent SI; a plain number among quantities is a dimension error.

length

The number of elements in a bound array.