[top][index]
search for:

product({...},Function) -- product of values of a function

Synopsis:

  • Function: product
  • Input:
  • an instance of class List.
  • an instance of class Function.
  • product(v,f) -- yields the product of the expressions obtained by applying f to each of the elements of the list or sequence v.

    i1 : product(1 .. 5, i -> i^2)

    o1 = 14400

    See also:

  • product
  • Code:

         -- ../../../Macaulay2/m2/lists.m2:76-82
         product(ZZ,Function) := (n,f) -> (
              s := 1;
              g := x -> (
                   s = f x; 
                   g = x -> s = s * f x);
              scan(n,x -> g x);
              s);

    [top][index]
    search for: