[top][index]
search for:

sum({...},{...},Function) -- sum results of applying a function pairwise

Synopsis:

  • Function: sum -- compute the sum
  • Input:
  • an instance of class List.
  • an instance of class List.
  • an instance of class Function.
  • sum(v,w,f) -- yields the sum of the results obtained by applying f to each of the pairs (i,j) of elements from the lists or sequences v and w, which should be of the same length.

    i1 : R = ZZ[x,y,z];
    i2 : sum({2,3,4},{x,y,z},(i,j)->j^i)

          4    3    2
    o2 = z  + y  + x

    o2 : R

    See also:

  • sum -- compute the sum
  • Code:

         -- ../../../Macaulay2/m2/lists.m2:70
         sum(List, List, Function) := (v,w,f) -> sum(apply(v,w,identity),f)

    [top][index]
    search for: