Home Online Manual
Top
Back: primes
Forward: sort
FastBack:
FastForward:
Up: general_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.3.14 product

Procedure from library general.lib (see general_lib).

Usage:
product(id[,v]); id ideal/vector/module/matrix/intvec/intmat/list, v intvec (default: v=1..number of entries of id)

Assume:
list members can be multiplied.

Return:
The product of all entries of id [with index given by v] of type depending on the entries of id.

Note:
If id is not a list, id is treated as a list of polys resp. integers. A module m is identified with the corresponding matrix M (columns of M generate m).
If v is outside the range of id, we have the empty product and the result will be 1 (of type int).

Example:
 
LIB "general.lib";
ring r= 0,(x,y,z),dp;
ideal m = maxideal(1);
product(m);
==> xyz
product(m[2..3]);
==> yz
matrix M[2][3] = 1,x,2,y,3,z;
product(M);
==> 6xyz
intvec v=2,4,6;
product(M,v);
==> xyz
intvec iv = 1,2,3,4,5,6,7,8,9;
v=1..5,7,9;
product(iv,v);
==> 7560
intmat A[2][3] = 1,1,1,2,2,2;
product(A,3..5);
==> 4