Home Online Manual
Top
Back: sets_lib
Forward: union
FastBack:
FastForward:
Up: sets_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.14.8.1 set

Procedure from library sets.lib (see sets_lib).

Usage:
set(l) or *=l (short form of * = set(l)); l list

Return:
Set, the set createt from the entered list

Example:
 
LIB "sets.lib";
//example for set
Set S0a = list(list(1,2,3),list(list(1,2)),list(10,11));
Set S0b = list(list(10,11),list(list(1,2)));
S0b<S0a;
==> 1
S0a<S0b;
==> 0
S0a==S0a;
==> 1
S0a==S0b;
==> 0
list L = 1,1,2,3;
Set S1 = L;
S1;
==> {3; 2; 1}
==> Set with 3 elements
==> 
ring R1;
ring R2 = 0,(x,y),dp;
Set S2 = list(R1,R1,R2);
S2;
==> {(QQ),(x,y),(dp(2),C); (ZZ/32003),(x,y,z),(dp(3),C)}
==> Set with 2 elements
==> 
ideal I1 = x+y;
ideal I2 = y^2;
ideal I3 = x+y, (x+y)^3;
Set S3 = list(I1,I2,I3);
S3;
==> {y2; x+y}
==> Set with 2 elements
==> 
isEqual(I1,I3);
==> 1
isEqual(I1,I2);
==> 0
module M1 = x*gen(1), y*gen(1);
module M2 = y^2*gen(2);
module M3 = (x+y)*gen(1), (x-y)*gen(1);
Set S4 = list(M1,M2,M3);
S4;
==> {y2*gen(2); x*gen(1),y*gen(1)}
==> Set with 2 elements
==> 
intmat m1[2][3]= 1,2,3,4,5,6;
intmat m2[2][3]= 1,2,3,4,5,7;
Set S5 = list(m1,m2,m1);
S5;
==> {1,2,3,4,5,7 ; 1,2,3,4,5,6 }
==> Set with 2 elements
==> 
bigintmat b1[2][3]= 1,2,3,4,5,6;
bigintmat b2[2][3]= 1,2,3,4,5,7;
Set S6 = list(b1,b2,b1);
S6;
==> {[ [ 1, 2, 3 ], [ 4, 5, 7 ] ] ; [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] }
==> Set with 2 elements
==> 
resolution r1 = res(maxideal(3),0);
resolution r2 = res(maxideal(4),0);
Set S7 = list(r1,r1,r2);
size(S7);
==> 2