sum package:numeric-prelude
Sum up all elements of a list. An empty list yields zero.
This function is inappropriate for number types like Peano. Maybe we
should make
sum a method of Additive. This would also make
lengthLeft and
lengthRight superfluous.
Abstraction of normed vector spaces
Sum up all elements of a non-empty list. This avoids including a zero
which is useful for types where no universal zero is available. ToDo:
Should have NonEmpty type.
\(QC.NonEmpty ns) -> A.sum ns == (A.sum1 ns :: Integer)
Sum the operands in an order, such that the dependencies are
minimized. Does this have a measurably effect on speed?
Requires associativity.
\ns -> A.sum ns == (A.sumNestedAssociative ns :: Integer)
Make sure that the last entries in the list are equally often part of
an addition. Maybe this can reduce rounding errors. The list that sum2
computes is a breadth-first-flattened binary tree.
Requires associativity and commutativity.
\ns -> A.sum ns == (A.sumNestedCommutative ns :: Integer)
For a multi-set of numbers, we describe a sequence of the sums of
powers of the numbers in the set. These can be easily converted to
polynomials and back. Thus they provide an easy way for computations
on the roots of a polynomial.
help showing series summands