Top
Back: sort
Forward: watchdog
FastBack: all_lib
FastForward: inout_lib
Up: general_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.2.2.15 sum

Procedure from library general.lib (see general_lib).

Usage:
sum(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 added.

Return:
The sum 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 sum and the result will be 0 (of type int).

Example:
 
LIB "general.lib";
ring r= 0,(x,y,z),dp;
vector pv = [xy,xz,yz,x2,y2,z2];
sum(pv);
sum(pv,2..5);
matrix M[2][3] = 1,x,2,y,3,z;
intvec w=2,4,6;
sum(M,w);
intvec iv = 1,2,3,4,5,6,7,8,9;
sum(iv,2..4);


Top Back: sort Forward: watchdog FastBack: all_lib FastForward: inout_lib Up: general_lib Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 3-0-1, October 2005, generated by texi2html.