


![[top]](top.gif)
Synopsis:
sum(v,f) -- yields the sum of the expressions obtained by applying f to each of the elements of the list or sequence v.
i1 : sum(1 .. 10, i -> i^2) |
See also:
Code:
-- ../../../Macaulay2/m2/lists.m2:59-65
sum(ZZ,Function) := (n,f) -> (
s := 0;
g := x -> (
s = f x;
g = x -> s = s + f x);
scan(n,x -> g x);
s);



![[top]](top.gif)