[top][index]
search for:

product(ZZ,Function) -- product of consecutive values of a function

Synopsis:

  • Function: product
  • Input:
  • an instance of class ZZ.
  • an instance of class Function.
  • product(n,f) -- compute the product f(0) * f(1) * ... * f(n-1).

    i1 : product(5, i -> 2*i+1)

    o1 = 945

    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: