Top
Back: D.2.2.14 sort
Forward: D.2.2.16 watchdog
FastBack: D. SINGULAR libraries
FastForward: E. Release Notes
Up: D.2.2 general_lib
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. 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);
→ x2+xy+y2+xz+yz+z2
sum(pv,2..5);
→ x2+y2+xz+yz
matrix M[2][3] = 1,x,2,y,3,z;
intvec w=2,4,6;
sum(M,w);
→ x+y+z
intvec iv = 1,2,3,4,5,6,7,8,9;
sum(iv,2..4);
→ 9

Top Back: D.2.2.14 sort Forward: D.2.2.16 watchdog FastBack: D. SINGULAR libraries FastForward: E. Release Notes Up: D.2.2 general_lib Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.