3.28 math
Every function in this library is available on the math module object. For example, if you used import math as M, you would write M.arg-max to access arg-max below. If you used include, then you can refer to identifiers without writing M. as a prefix.
3.28.1 Arithmetic Functions
Calculates the arithmetic sum of the Numbers in l. If l contains at least one RoughNum, then the output will be a RoughNum.
check: sum([list: ]) is 0 sum([list: 0, 2, 4]) is 6 sum([list: -1, 1, ~2]) is-roughly ~2 end
3.28.2 Minimization & Maximization
Calculates the maximal element of the set of Numbers in l.
check: max([list: ]) raises "Empty List" max([list: 10]) is 10 max([list: 2.1, 2, 4.5, ~1.5, -1, 1]) is-roughly 4.5 end
Calculates the minimal element of the set of Numbers in l.
check: min([list: ]) raises "Empty List" min([list: 2]) is 2 min([list: -1, 0, ~1, 2, 5]) is-roughly -1 end
Calculates the index of the maximal element within l.
check: arg-max([list: ]) raises "Empty List" arg-max([list: 2]) is 0 arg-max([list: -1, 0, ~1, 5, 2]) is 3 end