[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.1 Functions | ||
5.2 Control structures | ||
5.3 System variables |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section gives a complete reference of all functions, commands and
special variables of the SINGULAR kernel (i.e., all built-in
commands). See section standard_lib, for those
functions from the standard.lib
(this library is automatically
loaded at start-up time) which extend the functionality of the kernel
and are written
in the SINGULAR programming language.
The general syntax of a function is
[target =] function_name (<arguments>);
If no target is specified, the result is printed.
In some cases (e.g., export
, keepring
, kill
,
setring
, type
) the brackets are optional. For the commands
help
, break
, quit
, exit
and LIB
no
brackets are allowed.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
attrib (
name )
Type:
none
Purpose:
displays the attribute list of the object called name.
Example:
ring r=0,(x,y,z),dp; ideal I=std(maxideal(2)); attrib(I); → attr:isSB, type int
Syntax:
attrib (
name ,
string_expression )
Type:
any
Purpose:
returns the value of the attribute string_expression of the
variable name. If the attribute is not defined for this variable,
attrib
returns the empty string.
Example:
ring r=0,(x,y,z),dp; ideal I=std(maxideal(2)); attrib(I,"isSB"); → 1 // although maxideal(2) is a standard basis, // SINGULAR does not know it: attrib(maxideal(2), "isSB"); → 0
Syntax:
attrib (
name,
string_expression,
expression )
Type:
none
Purpose:
sets the attribute string_expression of the variable name to the value expression.
Example:
ring r=0,(x,y,z),dp; ideal I=maxideal(2); // the attribute "isSB" is not set vdim(I); → // ** I is no standardbasis → 4 attrib(I,"isSB",1); // the standard basis attribute is set here vdim(I); → 4
Remark:
An attribute may be described by any string_expression. Some of these are used by the kernel of SINGULAR and referred to as reserved attributes. Non-reserved attributes may be used, however, in procedures and can considerably speed up computations.
Reserved attributes:
(not all are in use at the moment)
isSB
the standard basis property is set by all commands computing a standard
basis like
groebner
, std
, stdhilb
etc.; used by lift
, dim
,
degree
, mult
, hilb
, vdim
, kbase
isHomog
the weight vector for homogeneous or quasihomogeneous ideals/modules
isCI
complete intersection property
isCM
Cohen-Macaulay property
rank
set the rank of a module (see nrows)
withSB
value of type ideal, resp. module, is std
withHilb
value of type intvec is hilb(_,1) (see hilb)
withRes
value of type list is a free resolution
withDim
value of type int is the dimension (see dim)
withMult
value of type int is the multiplicity (see mult)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
bareiss (
module_expression )
bareiss (
matrix_expression )
bareiss (
module_expression,
int_expression,
int_expression )
bareiss (
matrix_expression,
int_expression,
int_expression )
Type:
list of module and intvec
Purpose:
applies the sparse Gauss-Bareiss algorithm (see References, Lee and
Saunders) to a module (or with type conversion to a matrix) with an ’optimal’
pivot strategy. The vectors of the module are the columns of the matrix,
hence elimination takes place w.r.t. rows.
With only one parameter a complete elimination is done.
Result is a list: the first entry is a module with a minimal independent set
of vectors (as a matrix lower triangular),
the second entry an intvec with the permutation of the rows
w.r.t. the original matrix, that is, a k at position l indicates that
row l became row k.
The further parameters control the algorithm. bareiss(M,i,j)
does not consider the last i rows in the elimination procedure and stops
computing when the remaining number of vectors (columns) to reduce is at
most j.
Example:
ring r=0,(x,y,z),(c,dp); module mm; // ** generation of the module mm ** int d=7; int b=2; int db=d-b; int i; for(i=d;i>0;i--){ mm[i]=3*x*gen(i); } for(i=db;i;i--){ mm[i]=mm[i]+7*y*gen(i+b); } for(i=d;i>db;i--){ mm[i]=mm[i]+7*y*gen(i-db); } for(i=d;i>b;i--){ mm[i]=mm[i]+11*z*gen(i-b); } for(i=b;i;i--){ mm[i]=mm[i]+11*z*gen(i+db); } // ** the generating matrix of mm ** print(mm); → 3x, 0, 11z,0, 0, 7y, 0, → 0, 3x, 0, 11z,0, 0, 7y, → 7y, 0, 3x, 0, 11z,0, 0, → 0, 7y, 0, 3x, 0, 11z,0, → 0, 0, 7y, 0, 3x, 0, 11z, → 11z,0, 0, 7y, 0, 3x, 0, → 0, 11z,0, 0, 7y, 0, 3x // complete elimination list ss=bareiss(mm); print(ss[1]); → 7y, 0, 0, 0, 0, 0, 0, → 3x, -33xz, 0, 0, 0, 0, 0, → 11z,-121z2,1331z3,0, 0, 0, 0, → 0, 0, 0, 9317yz3,0, 0, 0, → 0, 21xy, _[5,3],14641z4,-43923xz4,0, 0, → 0, 0, 0, 0, 65219y2z3,_[6,6],0, → 0, 49y2, _[7,3],3993xz3,_[7,5], _[7,6],_[7,7] ss[2]; → 2,7,5,1,4,3,6 // elimination up to 3 vectors ss=bareiss(mm,0,3); print(ss[1]); → 7y, 0, 0, 0, 0, 0, 0, → 3x, -33xz, 0, 0, 0, 0, 0, → 11z,-121z2,1331z3,0, 0, 0, 0, → 0, 0, 0, 9317yz3,0, 0, 0, → 0, 0, 0, 0, 27951xyz3,102487yz4,65219y2z3, → 0, 21xy, _[6,3],14641z4,_[6,5], _[6,6], -43923xz4, → 0, 49y2, _[7,3],3993xz3,_[7,5], _[7,6], _[7,7] ss[2]; → 2,7,5,1,3,4,6 // elimination without the last 3 rows ss=bareiss(mm,3,0); print(ss[1]); → 7y, 0, 0, 0, 0, 0, 0, → 0, 77yz,0, 0, 0, 0, 0, → 0, 0, 231xyz, 0, 0, 0, 0, → 0, 0, 0, 1617xy2z,0, 0, 0, → 11z,21xy,-1331z3,14641z4, _[5,5],_[5,6],_[5,7], → 0, 0, 539y2z, _[6,4], _[6,5],_[6,6],-3773y3z, → 3x, 49y2,-363xz2,3993xz3, _[7,5],_[7,6],_[7,7] ss[2]; → 2,3,4,1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
betti (
list_expression )
betti (
resolution_expression )
betti (
list_expression ,
int_expression )
betti (
resolution_expression ,
int_expression )
Type:
intmat
Purpose:
with 1 argument: computes the graded Betti numbers of a minimal resolution of
The argument is considered to be the result of a res/sres/mres/nres/lres
command. This implies that a zero is only allowed (and counted) as a
generator in the first module.
For the computation betti uses only the initial monomials. This could lead
to confusing results for a non-homogeneous input.
The optional second argument is a switch for the minimization of the Betti numbers. If it is 0 then the Betti numbers correspond exactly to the input - otherwise the command is identical to the one-argument form.
Example:
ring r=32003,(a,b,c,d),dp; ideal j=bc-ad,b3-a2c,c3-bd2,ac2-b2d; list T=mres(j,0); // 0 forces a full resolution // a minimal set of generators for j: print(T[1]); → bc-ad, → c3-bd2, → ac2-b2d, → b3-a2c // second syzygy module of r/j which is the first // syzygy module of j (minimal generating set): print(T[2]); → bd,c2,ac,b2, → -a,-b,0, 0, → c, d, -b,-a, → 0, 0, -d,-c // the second syzygy module (minimal generating set): print(T[3]); → -b, → a, → -c, → d print(T[4]); → 0 betti(T); → 1,0,0,0, → 0,1,0,0, → 0,3,4,1 // most useful for reading off the graded Betti numbers: print(betti(T),"betti"); → 0 1 2 3 → ------------------------------ → 0: 1 - - - → 1: - 1 - - → 2: - 3 4 1 → ------------------------------ → total: 1 4 4 1
Hence
T[1]
(which is j) has 4
generators (one in degree 2 and three in degree 3),
T[2]
has 4 generators (all in degree 4),
T[3]
has
1 generator in degree 5,
where the generators are the columns of the displayed matrix and degrees are assigned such that the corresponding maps have degree 0:
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
char (
ring_name )
Type:
int
Purpose:
returns the characteristic of the coefficient field of a ring.
Example:
ring r=32003,(x,y),dp; char(r); → 32003 ring s=0,(x,y),dp; char(s); → 0 ring ra=(7,a),(x,y),dp; minpoly=a^3+a+1; char(ra); → 7 ring rp=(49,a),(x,y),dp; char(rp); → 7 ring rr=real,x,dp; char(rr); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
char_series (
ideal_expression )
Type:
matrix
Purpose:
the rows of the matrix represent the irreducible characteristic series of the
ideal with respect to the current ordering of variables.
One application is the decomposition of the zero-set.
Example:
ring r=32003,(x,y,z),dp; print(char_series(ideal(xyz,xz,y))); → y,z, → x,y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
charstr (
ring_name )
Type:
string
Purpose:
returns the description of the coefficient field of a ring.
Example:
ring r=32003,(x,y),dp; charstr(r); → 32003 ring s=0,(x,y),dp; charstr(s); → 0 ring ra=(7,a),(x,y),dp; minpoly=a^3+a+1; charstr(ra); → 7,a ring rp=(49,a),(x,y),dp; charstr(rp); → 49,a ring rr=real,x,dp; charstr(rr); → real
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
cleardenom (
poly_expression )
cleardenom (
vector_expression )
Type:
same as the input type
Purpose:
multiplies a polynomial, resp. vector, by a suitable constant to cancel all denominators from its coefficients and then divide it by its content.
Example:
ring r=0,(x,y,z),dp; poly f=(3x+6y)^5; f/5; → 243/5x5+486x4y+1944x3y2+3888x2y3+3888xy4+7776/5y5 cleardenom(f/5); → x5+10x4y+40x3y2+80x2y3+80xy4+32y5
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
close (
link_expression )
Type:
none
Purpose:
closes a link.
Example:
link l="MPtcp:launch"; open(l); // start SINGULAR "server" on localhost in batchmode close(l); // shut down SINGULAR server
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
coef (
poly_expression,
product_of_ringvars )
Type:
matrix
Syntax:
coef (
vector_expression,
product_of_ringvars,
matrix_name,
matrix_name )
Type:
none
Purpose:
determines the monomials in f divisible by one of the ring variables of m (where f is the first argument and m the second argument) and the coefficients of these monomials as polynomials in the remaining variables.
First case: returns a 2 x n matrix M, n being the number of the determined monomials. The first row consists of these monomials, the second row of the corresponding coefficients of the monomials in f. Thus, f = M[1,1]*M[2,1]+...+M[1,n]*M[2,n].
Second case: the second matrix (i.e., the 4th argument) contains the monomials, the first matrix (i.e., the 3rd argument) the corresponding coefficients of the monomials in the vector.
Note:
coef considers only monomials which really occur in f (i.e., which are not 0), while coeffs (see coeffs) returns the coefficient 0 at the appropriate place if a monomial is not present.
Example:
ring r=32003,(x,y,z),dp; poly f=x5+5x4y+10x2y3+y5; matrix m=coef(f,y); print(m); → y5,y3, y, 1, → 1, 10x2,5x4,x5 f=x20+xyz+xy+x2y+z3; print(coef(f,xy)); → x20,x2y,xy, 1, → 1, 1, z+1,z3 vector v=[f,zy+77+xy]; print(v); → [x20+x2y+xyz+z3+xy,xy+yz+77] matrix mc; matrix mm; coef(v,y,mc,mm); print(mc); → x2+xz+x,x20+z3, → x+z, 77 print(mm); → y,1, → y,1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
coeffs (
poly_expression ,
ring_variable )
coeffs (
ideal_expression,
ring_variable )
coeffs (
vector_expression,
ring_variable )
coeffs (
module_expression,
ring_variable )
coeffs (
poly_expression,
ring_variable,
matrix_name )
coeffs (
ideal_expression,
ring_variable,
matrix_name )
coeffs (
vector_expression,
ring_variable,
matrix_name )
coeffs (
module_expression,
ring_variable,
matrix_name )
Type:
matrix
Purpose:
develops each polynomial of the first argument, say J, as a univariate polynomial in the given ring_variable, say z, and returns the coefficients as a k x d matrix M, where:
d-1 = maximum z-degree of all occurring polynomials k = 1 if J is a polynomial, k = number of generators if J is an ideal.
If J is a vector or a module this procedure is repeated for each
component and the resulting matrices are appended.
Note:
coeffs
returns the coefficient 0 at the appropriate place if a monomial
is not present, while coef
considers only monomials which really occur
in the given expression.
If
then the j-th generator of an ideal J is equal to
Example:
ring r; poly f=(x+y)^3; matrix M=coeffs(f,y); print(M); → x3, → 3x2, → 3x, → 1 ideal i=f,xyz+z10y4; print(coeffs(i,y)); → x3, 0, → 3x2,xz, → 3x, 0, → 1, 0, → 0, z10
Syntax:
coeffs (
ideal_expression,
ideal_expression )
coeffs (
module_expression,
module_expression )
coeffs (
ideal_expression,
ideal_expression,
product_of_ringvars )
coeffs (
module_expression,
module_expression,
product_of_ringvars )
Type:
matrix
Purpose:
let the first argument be M,
the second argument be K (a set of monomials, resp. vectors with monomial
entries, in the variables appearing in P),
the third argument be the product P of variables to consider (if this
argument is not given, then the product of all ring variables is taken
as default argument).
M is supposed to consist of elements of (resp. have entries in)
a finitely generated module
over a ring in the variables not appearing in P. K should contain the
generators of M over this smaller ring.
Then coeffs(M,K,P)
returns a matrix A of coefficients with K*A=M
such that the entries of A do not contain any variable from P.
If K does not contain all generators that are necessary to express
M, then K*A=M’ where M’ is the part of M that can be expressed.
Example:
ring r=32003,(x,y,z),dp; ideal M=x2z+y3,xy; print(coeffs(M,ideal(x2,xy,y2),xy)); → z,0, → 0,1, → 0,0 print(coeffs(M,ideal(x2,xy,y2))); → 0,0, → 0,1, → 0,0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
contract (
ideal_expression,
ideal_expression )
Type:
matrix
Purpose:
contracts each of the n elements of the second ideal J
by each of the m elements of the first ideal I,
producing a m x n matrix.
Contraction is defined on monomials by:
where A and B are the multiexponents of the ring variables represented by
contract
is extended bilinearly to all polynomials.
Example:
ring r=0,(a,b,c,d),dp; ideal I=a2,a2+bc,abc; ideal J=a2-bc,abcd; print(contract(I,J)); → 1,0, → 0,ad, → 0,d
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
dbprint (
int_expression,
expression_list )
Type:
none
Purpose:
applies the print command to each expression in the expression_list if
int_expression is positive.
dbprint
may also be used in procedures
in order to print results subject to certain
conditions.
Syntax:
dbprint (
expression )
Type:
none
Purpose:
The print command is applied to the expression
if printlevel>=voice
.
Note:
See section Guidelines for writing a library, for an example how this is used for displaying comments while procedures are executed.
Example:
int debug=0; intvec i=1,2,3; dbprint(debug,i); debug=1; dbprint(debug,i); → 1,2,3 voice; → 1 printlevel; → 0 dbprint(i);
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
defined (
name )
Type:
int
Purpose:
returns a value <>0 (TRUE) if there is a user-defined object with this name,
and 0 (FALSE) otherwise.
A non-zero return value is the level where the object is defined (level
1 denotes the top level, level 2 the level of a first procedure, level 3
the level of a procedure called by a first procedure, etc.). For ring
variables, -1 is returned.
Note:
A local object m
may be identified by if
(defined(m)==voice)
.
Example:
ring r=(0,t),(x,y),dp; matrix m[5][6]=x,y,1,2,0,x+y; defined(mm); → 0 defined(r) and defined(m); → 1 defined(m)==voice; // m is defined in the current level → 1 defined(x); → -1 defined(z); → 0 defined(t); → -1 defined(42); → -1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
deg (
poly_expression )
deg (
vector_expression )
deg (
poly_expression ,
intvec_expression )
deg (
vector_expression ,
intvec_expression )
Type:
int
Purpose:
returns the maximal (weighted) degree of
the terms of a polynomial or a vector;
deg(0) is -1.
The optional second argument gives the weight vector,
the default weights of the base ring will be used otherwise.
Example:
ring r=0,(x,y,z),lp; deg(0); → -1 deg(x3+y4+xyz3); → 5 ring rr=7,(x,y),wp(2,3); poly f=x2+y3; deg(f); → 9 ring R=7,(x,y),ws(2,3); poly f=x2+y3; deg(f); → 9 vector v=[x2,y]; deg(v); → 4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
degree (
ideal_expression )
degree (
module_expression )
Type:
int
Purpose:
computes the (weighted) degree of the projective variety, respectively sheaf over the projective variety, defined by the ideal, respectively module, generated by the leading monomials of the input. This is equal to the (weighted) degree of the projective variety, respectively sheaf over the projective variety, defined by the ideal, respectively module, if the input is a standard basis with respect to a (weighted) degree ordering.
Example:
ring r3=32003,(x,y,z,h),dp; int a,b,c,t=11,10,3,1; poly f=x^a+y^b+z^(3*c)+x^(c+2)*y^(c-1)+x^(c-1)*y^(c-1)*z3 +x^(c-2)*y^c*(y2+t*x)^2; ideal i=jacob(f); i=homog(i,h); ideal i0=std(i); degree(i0); → 720
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
delete (
list_expression,
int_expression )
Type:
list
Purpose:
deletes the element with the given index from a list (the input is not changed).
Example:
list l="a","b","c"; list l1=delete(l,2);l1; → [1]: → a → [2]: → c l; → [1]: → a → [2]: → b → [3]: → c
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
det (
intmat_expression )
det (
matrix_expression )
det (
module_expression )
Type:
int, resp. poly
Purpose:
returns the determinant of a square matrix. A module is considered as a matrix. The applied algorithms depend on type of input. If the input is a module or matrix with symbolic entries the Bareiss algorithm is used. In the other cases the chinese remainder algorithm is used. For large sparse problems the input as a module has advantages.
Example:
ring r=7,(x,y),wp(2,3); matrix m[3][3]=1,2,3,4,5,6,7,8,x; det(m); → -3x-1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
diff (
poly_expression,
ring_variable )
diff (
vector_expression,
ring_variable )
diff (
ideal_expression,
ring_variable )
diff (
module_expression,
ring_variable )
diff (
matrix_expression,
ring_variable )
Type:
the same as the type of the first argument
Syntax:
diff (
ideal_expression,
ideal_expression )
Type:
matrix
Purpose:
computes the partial derivative of a polynomial object by a ring variable
(first forms)
respectively differentiates each polynomial (1..n) of the second ideal
by the differential operator corresponding to each polynomial (1..m) in the first
ideal, producing an m x n matrix.
Example:
ring r=0,(x,y,z),dp; poly f=2x3y+3z5; diff(f,x); → 6x2y vector v=[f,y2+z]; diff(v,z); → 15z4*gen(1)+gen(2) ideal j=x2-yz,xyz; ideal i=x2,x2+yz,xyz; // corresponds to differential operators // d2/dx2, d2/dx2+d2/dydz, d3/dxdydz: print(diff(i,j)); → 2,0, → 1,x, → 0,1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
dim (
ideal_expression )
dim (
module_expression )
Type:
int
Purpose:
computes the dimension of the ideal, resp. module, generated by the leading monomials of the given generators of the ideal, resp. module. This is also the dimension of the ideal if it is represented by a standard basis.
Note:
The dimension of an ideal I means
the Krull dimension of the basering modulo I.
The dimension of a
module is the dimension of its annihilator ideal.
Example:
ring r=32003,(x,y,z),dp; ideal I=x2-y,x3; dim(std(I)); → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
division (
ideal_expression,
ideal_expression )
division (
module_expression,
module_expression )
division (
ideal_expression,
ideal_expression,
int_expression )
division (
module_expression,
module_expression,
int_expression )
division (
ideal_expression,
ideal_expression,
int_expression,
intvec_expression )
division (
module_expression,
module_expression,
int_expression,
intvec_expression )
Type:
list
Purpose:
division
computes a division with remainder.
For two ideals resp. modules M
(first argument) and N
(second argument), it returns a list T,R,U
where T
is a matrix, R
is an ideal resp. a module, and U
is a diagonal matrix of units such that matrix(M)*U=matrix(N)*T+matrix(R)
is a standard representation for the normal form R
of M
with respect to a standard basis of N
.
division
uses different algorithms depending on whether N
is represented by a standard basis.
For a polynomial basering, the matrix U
is the identity matrix.
A matrix T
as above is also computed by lift
.
For additional arguments n
(third argument) and w
(fourth argument), division
returns a list T,R
as above such that matrix(M)=matrix(N)*T+matrix(R)
is a standard representation for the normal form R
of M
with respect to N
up to weighted degree n
with respect to the weight vector w
.
The weighted degree of T
and R
respect to w
is at most n
.
If the weight vector w
is not given, division
uses the standard weight vector w=1,...,1
.
Example:
ring R=0,(x,y),ds; poly f=x5+x2y2+y5; division(f,jacob(f)); → [1]: → _[1,1]=1/5x → _[2,1]=3/10y → [2]: → _[1]=-1/2y5 → [3]: → _[1,1]=1 division(f^2,jacob(f)); → [1]: → _[1,1]=1/20x6-9/80xy5-5/16x7y+5/8x2y6 → _[2,1]=1/8x2y3+1/5x5y+1/20y6-3/4x3y4-5/4x6y2-5/16xy7 → [2]: → _[1]=0 → [3]: → _[1,1]=1/4-25/16xy division(ideal(f^2),jacob(f),10); → // ** _ is no standardbasis → [1]: → _[1,1]=-75/8y9 → _[2,1]=1/2x2y3+x5y-1/4y6-3/2x3y4+15/4xy7+375/16x2y8 → [2]: → _[1]=x10+9/4y10
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
dump (
link_expression )
Type:
none
Purpose:
dumps (i.e., writes in one "message" or "block") the state of the SINGULAR
session (i.e., all defined variables and their values) to the specified
link (which must be either an ASCII or MP link) such that a
getdump
can retrieve it later on.
Example:
ring r; // write the whole session to the file dump.ascii // in ASCII format dump(":w dump.ascii"); kill r; // kill the basering // reread the session from the file // redefining everything which was not explicitly killed before getdump("dump.ascii"); → // ** redefining stdfglm ** → // ** redefining stdhilb ** → // ** redefining groebner ** → // ** redefining res ** → // ** redefining quot ** → // ** redefining quot1 ** → // ** redefining quotient0 ** → // ** redefining quotient1 ** → // ** redefining quotient2 ** → // ** redefining quotient3 ** → // ** redefining quotient5 ** → // ** redefining quotient4 ** → // ** redefining intersect1 ** → // ** redefining sprintf ** → // ** redefining printf ** → // ** redefining fprintf ** r; → // characteristic : 32003 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C
Restrictions:
For ASCII links, integer matrices contained in lists are dumped as integer list elements (and not as integer matrices), and lists of lists are dumped as one flatted list. Furthermore, links themselves are not dumped.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
eliminate (
ideal_expression,
product_of_ring_variables)
eliminate (
module_expression,
product_of_ring_variables)
eliminate (
ideal_expression,
product_of_ring_variables,
intvec_hilb )
eliminate (
module_expression,
product_of_ring_variables,
intvec_hilb )
Type:
the same as the type of the first argument
Purpose:
eliminates variables occurring as factors of the second argument from an
ideal, resp. module, by intersecting it with the subring not containing
these variables.
eliminate
does not need a special ordering nor a standard basis as input.
Note:
Since elimination is expensive, for homogeneous input it might be useful
first to compute the Hilbert function of the ideal (first
argument) with a fast ordering (e.g., dp
). Then make use of it to speed
up the computation: a Hilbert-driven elimination uses the intvec
provided as the third argument.
Example:
ring r=32003,(x,y,z),dp; ideal i=x2,xy,y5; eliminate(i,x); → _[1]=y5 ring R=0,(x,y,t,s,z),dp; ideal i=x-t,y-t2,z-t3,s-x+y3; eliminate(i,ts); → _[1]=y2-xz → _[2]=xy-z → _[3]=x2-y intvec v=hilb(std(i),1); eliminate(i,ts,v); → _[1]=y2-xz → _[2]=xy-z → _[3]=x2-y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
eval (
expression )
Type:
none
Purpose:
evaluates (quoted) expressions. Within a quoted expression, the
quote can be "undone" by an eval
(i.e., each eval "undoes" the
effect of exactly one quote). Used only when receiving a quoted expression
from an MPfile link,
with quote
and write
to
prevent local evaluations when writing to an MPtcp link.
Example:
link l="MPfile:w example.mp"; ring r=0,(x,y,z),ds; ideal i=maxideal(3); ideal j=x7,x2,z; // compute i+j before writing, but not std // this writes 'std(ideal(x3,...,z))' write (l, quote(std(eval(i+j)))); option(prot); close(l); // now read it in again and evaluate // read(l) forces to compute 'std(ideal(x3,...,z))' read(l); close(l);
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
ERROR (
string_expression )
Type:
none
Purpose:
Immediately interrupts the current computation, returns to the
top-level, and displays the argument string_expression
as error
message.
Note:
This should be used as an emergency, resp. failure, exit within procedures.
Example:
int i=1; proc myError() {ERROR("Need to leave now");i=2;} myError(); → ? Need to leave now → ? error occurred in line 2: `ERROR("Need to leave now");i=2;` → ? leaving ::myError → skipping text from `;` error at token `)` i; → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
example
topic ;
Purpose:
computes an example for topic
. Examples are available for all
SINGULAR kernel and library functions. Where available (e.g.,
within Emacs), use <TAB>
completion for a list of all available
example topic
s.
Example:
example prime; example intvec_declarations;
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
execute (
string_expression )
Type:
none
Purpose:
executes a string containing a sequence of SINGULAR commands.
Note:
The command return
cannot appear in the string.
execute
should be avoided in procedures
whenever possible, since it may give rise to name conflicts. Moreover,
such procedures cannot be precompiled (a feature which SINGULAR will
provide in the future).
Example:
ring r=32003,(x,y,z),dp; ideal i=x+y,z3+22y; write(":w save_i",i); ring r0=0,(x,y,z),Dp; string s="ideal k="+read("save_i")+";"; s; → ideal k=x+y,z3+22y → ; execute(s); // define the ideal k k; → k[1]=x+y → k[2]=z3+22y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
exit;
Purpose:
exits (quits) SINGULAR, works also from inside a procedure or from an interrupt.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
extgcd (
int_expression,
int_expression )
extgcd (
poly_expression,
poly_expression )
Type:
list of 3 objects of the same type as the type of the arguments
Purpose:
computes extended gcd: the first element is the greatest common divisor
of the two arguments,
the second and third are factors such that if list L=extgcd(a,b);
then L[1]=a*L[2]+b*L[3].
Note:
Polynomials must be univariate to apply extgcd
.
Example:
extgcd(24,10); → [1]: → 2 → [2]: → -2 → [3]: → 5 ring r=0,(x,y),lp; extgcd(x4-x6,(x2+x5)*(x2+x3)); → [1]: → 2x5+2x4 → [2]: → x2+x+1 → [3]: → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
facstd (
ideal_expression )
facstd (
ideal_expression,
ideal_expression )
Type:
list of ideals
Purpose:
returns a list of ideals computed by the factorizing Groebner basis algorithm.
The intersection of these ideals has the same zero-set as the input,
i.e., the radical of the intersection coincides with the radical of the input
ideal.
In many (but not all!) cases this is already a decomposition of the radical
of the ideal. (Note however, that, in general, no inclusion between the
input and output ideals holds.)
The second, optional argument gives a list of polynomials which define
non-zero constraints. Hence, the intersection of the output ideals
has a zero-set which is the (closure of the) complement of the zero-set
of the second argument in the zero-set of the first argument.
Note:
Not implemented for baserings over real ground fields, galois fields and over algebraic extensions over the rational numbers (that is, only implemented for ground fields for which factorize is implemented).
Example:
ring r=32003,(x,y,z),(c,dp); ideal I=xyz,x2z; facstd(I); → [1]: → _[1]=z → [2]: → _[1]=x facstd(I,x); → [1]: → _[1]=z
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
factorize (
poly_expression )
factorize (
poly_expression, 0 )
factorize (
poly_expression, 2 )
Type:
list of ideal and intvec
Syntax:
factorize (
poly_expression, 1 )
Type:
ideal
Purpose:
computes the irreducible factors (as an ideal) of the polynomial together with or without the multiplicities (as an intvec) depending on the second argument:
0: returns factors and multiplicities, first factor is a constant. May also be written with only one argument. 1: returns non-constant factors (no multiplicities). 2: returns non-constant factors and multiplicities.
Note:
Not implemented for the coefficient fields real and finite fields of
type (p^n,a)
.
Example:
ring r=32003,(x,y,z),dp; factorize(9*(x-1)^2*(y+z)); → [1]: → _[1]=9 → _[2]=y+z → _[3]=x-1 → [2]: → 1,1,2 factorize(9*(x-1)^2*(y+z),1); → _[1]=y+z → _[2]=x-1 factorize(9*(x-1)^2*(y+z),2); → [1]: → _[1]=y+z → _[2]=x-1 → [2]: → 1,2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
fetch (
ring_name,
name )
Type:
number, poly, vector, ideal, module, matrix or list (the same type as the second argument)
Purpose:
maps objects between rings.
fetch
is the identity map between rings and qrings,
the i-th variable of the source ring is mapped to the i-th
variable of the basering. The coefficient fields must be compatible.
(See map for a description of possible mapping between
different ground fields).
fetch
offers a convenient way to change
variable names or orderings, or to map objects from a ring to a quotient
ring of that ring or vice versa.
Note:
Compared with imap
, fetch
uses the position of the ring
variables, not their names.
Example:
ring r=0,(x,y,z),dp; ideal i=maxideal(2); ideal j=std(i); poly f=x+y2+z3; vector v=[f,1]; qring q=j; poly f=fetch(r,f); f; → z3+y2+x vector v=fetch(r,v); v; → z3*gen(1)+y2*gen(1)+x*gen(1)+gen(2) ideal i=fetch(r,i); i; → i[1]=z2 → i[2]=yz → i[3]=y2 → i[4]=xz → i[5]=xy → i[6]=x2 ring rr=0,(a,b,c),lp; poly f=fetch(q,f); f; → a+b2+c3 vector v=fetch(r,v); v; → a*gen(1)+b2*gen(1)+c3*gen(1)+gen(2) ideal k=fetch(q,i); k; → k[1]=c2 → k[2]=bc → k[3]=b2 → k[4]=ac → k[5]=ab → k[6]=a2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
fglm (
ring_name,
ideal_name )
Type:
ideal
Purpose:
computes for the given ideal in the given ring
a reduced Groebner basis in the current ring, by applying the so-called FGLM
(Faugere, Gianni, Lazard, Mora) algorithm.
The main application is to compute a lexicographical Groebner basis
from a reduced Groebner basis with respect to a degree ordering. This
can be much faster than computing a lexicographical Groebner basis
directly.
Note:
The ideal must be zero-dimensional and given as a reduced Groebner
basis in the given ring.
The only permissible differences between the given ring and the current ring
are the monomial ordering and a permutation of the variables,
resp. parameters.
Example:
ring r=0,(x,y,z),dp; ideal i=y3+x2, x2y+x2, x3-x2, z4-x2-y; option(redSB); // force the computation of a reduced SB i=std(i); vdim(i); → 28 ring s=0,(z,x,y),lp; ideal j=fglm(r,i); j; → j[1]=y4+y3 → j[2]=xy3-y3 → j[3]=x2+y3 → j[4]=z4+y3-y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
fglmquot (
ideal_expression,
poly_expression )
Type:
ideal
Purpose:
computes a reduced Groebner basis of the ideal quotient I:p
of
a zero-dimensional ideal I
and a polynomial p
using
FGLM-techniques.
Note:
The ideal must be zero-dimensional and given as a reduced Groebner basis in the given ring. The poly must be reduced with respect to the ideal.
Example:
ring r=0,(x,y,z),lp; ideal i=y3+x2,x2y+x2,x3-x2,z4-x2-y; option(redSB); // force the computation of a reduced SB i=std(i); poly p=reduce(x+yz2+z10,i); ideal j=fglmquot(i,p); j; → j[1]=z12 → j[2]=yz4-z8 → j[3]=y2+y-z8-z4 → j[4]=x+y-z10-z6-z4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
< "
filename"
Type:
none
Purpose:
input comes from the file filename. Shorthand for
execute(read(filename))
.
Example:
< "example"; //read in the file example and execute it
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
find (
string_expression,
substring_expression )
find (
string_expression,
substring_expression,
int_expression )
Type:
int
Purpose:
returns the first position of the substring
in the string or 0 (if not found),
starts the search at the position given in the 3rd argument.
Example:
find("Aac","a"); → 2 find("abab","a"+"b"); → 1 find("abab","a"+"b",2); → 3 find("abab","ab",3); → 3 find("0123","abcd"); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
finduni (
ideal_expression )
Type:
ideal
Purpose:
returns an ideal which is contained in the ideal_expression such that the i-th
generator is a univariate polynomial in the i-th ring variable.
The polynomials have minimal degree w.r.t. this property.
Note:
The ideal must be zero-dimensional and given as a reduced Groebner basis in the current ring.
Example:
ring r=0,(x,y,z), dp; ideal i=y3+x2,x2y+x2,z4-x2-y; option(redSB); // force computation of reduced basis i=std(i); ideal k=finduni(i); print(k); → x4-x2, → y4+y3, → z12
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
fprintf (
link_expression,
string_expression [,
any_expressions] )
none
fprintf(l,fmt,...);
performs output formatting.
The second argument is a format control string. Additional
arguments may be required, depending on the content of the
control string. A series of output characters is generated as
directed by the control string; these characters are
written to the link l.
The control string fmt
is simply text to be copied, except
that the string may contain conversion specifications.
Do help print;
for a listing of valid conversion
specifications. As an addition to the conversions of print
,
the %n
and %2
conversion specification does not
consume an additional argument, but simply generates a newline
character.
If one of the additional arguments is a list, then it should be
enclosed once more into a list()
command, since passing
a list as an argument flattens the list by one level.
Example:
ring r=0,(x,y,z),dp; module m=[1,y],[0,x+z]; intmat M=betti(mres(m,0)); list l=r,m,M; link li=""; // link to stdout fprintf(li,"s:%s,l:%l",1,2); → s:1,l:int(2) fprintf(li,"s:%s",l); → s:(0),(x,y,z),(dp(3),C) fprintf(li,"s:%s",list(l)); → s:(0),(x,y,z),(dp(3),C),y*gen(2)+gen(1),x*gen(2)+z*gen(2),1,1 fprintf(li,"2l:%2l",list(l)); → 2l:list("(0),(x,y,z),(dp(3),C)", → module(y*gen(2)+gen(1), → x*gen(2)+z*gen(2)), → intmat(intvec(1,1 ),1,2)) → fprintf(li,"%p",list(l)); → [1]: → // characteristic : 0 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C → [2]: → _[1]=y*gen(2)+gen(1) → _[2]=x*gen(2)+z*gen(2) → [3]: → 1,1 → fprintf(li,"%;",list(l)); → [1]: → // characteristic : 0 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C → [2]: → _[1]=y*gen(2)+gen(1) → _[2]=x*gen(2)+z*gen(2) → [3]: → 1,1 → fprintf(li,"%b",M); → 0 1 → ------------------ → 0: 1 1 → ------------------ → total: 1 1 →
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
freemodule (
int_expression )
Type:
module
Purpose:
creates the free module of rank n generated by
gen(1)
, …, gen(n)
.
Example:
ring r=32003,(x,y),(c,dp); freemodule(3); → _[1]=[1] → _[2]=[0,1] → _[3]=[0,0,1] matrix m=freemodule(3); // generates the 3x3 unit matrix print(m); → 1,0,0, → 0,1,0, → 0,0,1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
gcd (
int_expression,
int_expression )
gcd (
number_expression,
number_expression )
gcd (
poly_expression,
poly_expression )
Type:
the same as the type of the arguments
Purpose:
computes the greatest common divisor.
Note:
Not implemented for the coefficient fields real and finite fields of
type (p^n,a)
.
The gcd of two numbers is their gcd as integer numbers or polynomials,
otherwise it is not defined.
Example:
gcd(2,3); → 1 ring r=0,(x,y,z),lp; gcd(3x2*(x+y),9x*(y2-x2)); → x2+xy gcd(number(6472674604870),number(878646537247372)); → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
gen (
int_expression )
Type:
vector
Purpose:
returns the i-th free generator of a free module.
Example:
ring r=32003,(x,y,z),(c,dp); gen(3); → [0,0,1] vector v=gen(5); poly f=xyz; v=v+f*gen(4); v; → [0,0,0,xyz,1] ring rr=32003,(x,y,z),dp; fetch(r,v); → xyz*gen(4)+gen(5)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
getdump (
link_expression )
Type:
none
Purpose:
reads the content of the entire file, resp. link, and restores all variables
from it. For ASCII links, getdump
is equivalent to an
execute(read(
link ))
command. For MP links,
getdump
should only be used on data which were previously
dump
’ed.
Example:
int i=3; dump(":w example.txt"); kill i; option(noredefine); getdump("example.txt"); i; → 3
Restrictions:
getdump
is not supported for DBM links, or for a link connecting
to stdin
(standard input).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
groebner (
ideal_expression )
groebner (
module_expression )
groebner (
ideal_expression,
int_expression )
groebner (
module_expression,
int_expression )
type of the first argument
computes the standard basis of the first argument I
(ideal or module), by a heuristically chosen method: if the
ordering of the current ring is a local ordering, or if it is a
non-block ordering and the current ring has no parameters, then
std(I)
is returned. Otherwise, I
is mapped into a
ring with no parameters and ordering dp, where its Hilbert series
is computed. This is followed by a Hilbert-series based std
computation in the original ring.
If a 2nd argument wait
is given, then the computation proceeds
at most wait
seconds. That is, if no result could be computed in
wait
seconds, then the computation is interrupted, 0 is returned,
a warning message is displayed, and the global variable
groebner_error
is defined.
Example:
ring r=0,(a,b,c,d),lp; option(prot); ideal i=a+b+c+d,ab+ad+bc+cd,abc+abd+acd+bcd,abcd-1; // cyclic 4 groebner(i); → std in (0),(a,b,c,d,@t),(dp,C) → [63:1]1(3)s2(2)s3s4-s5ss6-s7-- → product criterion:8 chain criterion:5 → std with hilb in (0),(a,b,c,d,@t),(lp(4),C) → [63:1]1(3)s2(2)s3s4-s5ss6shhhh8shh → product criterion:9 chain criterion:8 → hilbert series criterion:6 → dehomogenization → imap to original ring → simplification → _[1]=c2d6-c2d2-d4+1 → _[2]=c3d2+c2d3-c-d → _[3]=bd4-b+d5-d → _[4]=bc-bd5+c2d4+cd-d6-d2 → _[5]=b2+2bd+d2 → _[6]=a+b+c+d ring rp=(0,a,b),(c,d), lp; ideal i=imap(r,i); ideal j=groebner(i); → std in 0,(c,d,a,b,@t),(dp,C) → [63:1]1(3)s2(2)s3s4-s5ss6-s7-- → product criterion:8 chain criterion:5 → std with hilb in (0),(c,d,a,b,@t),(lp(2),C, dp(3)) → [63:3]1(3)s2(2)s3s4-s5ss6shhhh8shh → product criterion:9 chain criterion:8 → hilbert series criterion:6 → dehomogenization → imap to original ring → simplification option(noprot); j; simplify(j,1); std(i); → j[1]=(a3b2+a2b3-a-b) → _[1]=1 → _[1]=1 if (system("with","MP")) {groebner(i,0);} → // ** groebner did not finish → _[1]=0 defined(groebner_error); → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
help;
help
topic ;
Type:
none
Purpose:
displays online help information for topic
using the currently
set help browser. If no topic
is given, the title page of the
manual is displayed.
Note:
?
may be used instead of help
.
topic
can be an index entry of the SINGULAR manual or the
name of a (loaded) procedure which has a help section.
topic
may contain wildcard characters (i.e.,
*
characters).
topic
cannot be found (or
uniquely matched) a warning is displayed and no help information is
provided.
topic
is the name of a (loaded) procedure whose help
section has changed w.r.t. the help available in the manual then,
instead of displaying the respective help section of the manual in the
help browser, the "newer" help section of the procedure is simply
printed to the terminal.
--browser=<browser>
(see section Command line options), or with the command system("--browser",
"<browser>")
. Use the command system("browsers");
for a list of
all available browsers. See section The online help system, for more details
about help browsers.
Example:
help; // display title page of manual help ring; // display help for 'ring' ?ringe; // equivalent to 'help ringe;' → // ** No help for topic 'ringe' (not even for '*ringe*') → // ** Try '?;' for general help → // ** or '?Index;' for all available help topics ?ring*; → // ** No unique help for 'ring*' → // ** Try one of → ?Rings and orderings; ?Rings and standard bases; ?ring; → ?ring declarations; ?ring operations; ?ring related functions; → ?ring.lib; ?ring_lib; ?ringtensor; ?ringweights; help Rings and orderings; help standard.lib; // displays help for library 'standard.lib'
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
highcorner (
ideal_expression )
highcorner (
module_expression )
Type:
poly, resp. vector
Purpose:
returns the smallest monomial not contained in
the ideal, resp. module, generated by the initial terms of the given
generators. If the generators are a standard basis,
this is also the smallest monomial not contained in the ideal, resp. module.
If the ideal, resp. module, is not zero-dimensional, 0 is returned.
Note:
Let the ideal I be given by a standard basis. Then
highcorner(I)
returns 0 iff dim(I)>0
or dim(I)=-1
.
Otherwise it returns the smallest monomial m not in I which has the following
properties (with
the variables of the basering):
Example:
ring r=0,(x,y),ds; ideal i=x3,x2y,y3; highcorner(std(i)); → xy2 highcorner(std(ideal(1))); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
hilb (
ideal_expression )
hilb (
module_expression )
hilb (
ideal_expression,
int_expression )
hilb (
module_expression,
int_expression )
hilb (
ideal_expression,
int_expression ,
intvec_expression )
hilb (
module_expression,
int_expression ,
intvec_expression )
Type:
none (if called with one argument)
intvec (if called with two or three arguments)
Purpose:
computes the (weighted) Hilbert series of the ideal, resp. module,
defined by the leading terms of the generators of the given ideal, resp. module.
If hilb
is called with one argument, then the 1st and 2nd Hilbert series
together with some additional information are displayed.
If hilb
is called with two arguments, then the n-th Hilbert series is returned
as an intvec, where n=1,2 is the second argument.
If a weight vector w is a given as 3rd argument, then the Hilbert series is computed
w.r.t. these weights w (by default all weights are set to 1).
Caution:
The last entry of the returned intvec is not part of the actual Hilbert series, but is used in the Hilbert driven standard basis computation (see stdhilb).
Note:
If the input is homogeneous w.r.t. the weights and a standard basis, the result is
the (weighted) Hilbert series of the original ideal, resp. module.
Example:
ring R=32003,(x,y,z),dp; ideal i=x2,y2,z2; ideal s=std(i); hilb(s); → // 1 t^0 → // -3 t^2 → // 3 t^4 → // -1 t^6 → → // 1 t^0 → // 3 t^1 → // 3 t^2 → // 1 t^3 → // dimension (affine) = 0 → // degree = 8 hilb(s,1); → 1,0,-3,0,3,0,-1,0 hilb(s,2); → 1,3,3,1,0 intvec w=2,2,2; hilb(s,1,w); → 1,0,0,0,-3,0,0,0,3,0,0,0,-1,0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
homog (
ideal_expression )
homog (
module_expression )
Type:
int
Purpose:
tests for homogeneity: returns 1 for homogeneous input, 0 otherwise.
Syntax:
homog (
polynomial_expression,
ring_variable )
homog (
vector_expression,
ring_variable )
homog (
ideal_expression,
ring_variable )
homog (
module_expression,
ring_variable )
Type:
same as first argument
Purpose:
homogenizes polynomials, vectors, ideals, or modules by multiplying each monomial with a suitable power of the given ring variable (which must have weight 1).
Example:
ring r=32003,(x,y,z),ds; poly s1=x3y2+x5y+3y9; poly s2=x2y2z2+3z8; poly s3=5x4y2+4xy5+2x2y2z3+y7+11x10; ideal i=s1,s2,s3; homog(s2,z); → x2y2z4+3z8 homog(i,z); → _[1]=3y9+x5yz3+x3y2z4 → _[2]=x2y2z4+3z8 → _[3]=11x10+y7z3+5x4y2z4+4xy5z4+2x2y2z6 homog(i); → 0 homog(homog(i,z)); → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
hres (
ideal_expression,
int_expression )
Type:
resolution
Purpose:
computes a free resolution of an ideal using the Hilbert-driven algorithm.
More precisely, let R be the basering and I be the given ideal.
Then hres
computes a minimal free resolution of R/I
If the int_expression k is not zero then the computation stops after
k steps and returns a list of modules
list L=hres(I,0);
returns a list L of n modules (where n is the
number of variables of the basering) such that
in the above notation.
Note:
The ideal_expression has to be homogeneous.
Accessing single elements of a resolution may require that some partial
computations have to be finished and may therefore take some time.
Example:
ring r=0,(x,y,z),dp; ideal I=xz,yz,x3-y3; def L=hres(I,0); print(betti(L),"betti"); → 0 1 2 → ------------------------ → 0: 1 - - → 1: - 2 1 → 2: - 1 1 → ------------------------ → total: 1 3 2 L[2]; // the first syzygy module of r/I → _[1]=-x*gen(1)+y*gen(2) → _[2]=-x2*gen(2)+y2*gen(1)+z*gen(3)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
imap (
ring_name,
name )
Type:
number, poly, vector, ideal, module, matrix or list (the same type as the second argument)
Purpose:
identity map on common subrings. imap
is the map between rings
and qrings with compatible ground fields which is the identity on
variables and parameters of the same name and 0 otherwise.
(See map for a description of possible mapping between
different ground fields).
Useful for mapping from a homogenized ring to the original ring or
for mappings from/to rings with/without parameters. Compared with
fetch
, imap
uses the names of variables and parameters.
Unlike map
and fetch
imap
can map parameters to variables.
Example:
ring r=0,(x,y,z,a,b,c),dp; ideal i=xy2z3a4b5+1,homog(xy2z3a4b5+1,c); i; → i[1]=xy2z3a4b5+1 → i[2]=xy2z3a4b5+c15 ring r1=0,(a,b,x,y,z),lp; ideal j=imap(r,i); j; → j[1]=a4b5xy2z3+1 → j[2]=a4b5xy2z3 ring r2=(0,a,b),(x,y,z),ls; ideal j=imap(r,i); j; → j[1]=1+(a4b5)*xy2z3 → j[2]=(a4b5)*xy2z3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
impart (
number_expression )
Type:
number
Purpose:
returns the imaginary part of a number in a complex ground field,
returns 0 otherwise.
Example:
ring r=(complex,i),x,dp; impart(1+2*i); → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
indepSet (
ideal_expression )
Type:
intvec
Purpose:
computes a maximal set U of independent variables of the ideal given by
a standard basis. If v
is the result then v[i]
is 1 if and
only if the i-th variable of the ring, x(i)
, is an independent
variable. Hence, the set U consisting of all variables x(i)
with
v[i]=1
is a maximal independent set.
Note:
U is a set of independent variables for I if and only if i.e., eliminating the remaining variables gives (0). U is maximal if dim(I)=#U.
Syntax:
indepSet (
ideal_expression, int_expression )
Type:
list
Purpose:
computes a list of all maximal independent sets of the leading ideal (if the flag is 0), resp. of all those sets of independent variables of the leading ideal which cannot be enlarged.
Example:
ring r=32003,(x,y,u,v,w),dp; ideal I=xyw,yvw,uyw,xv; attrib(I,"isSB",1); indepSet(I); → 1,1,1,0,0 eliminate(I,vw); → _[1]=0 indepSet(I,0); → [1]: → 1,1,1,0,0 → [2]: → 0,1,1,1,0 → [3]: → 1,0,1,0,1 → [4]: → 0,0,1,1,1 indepSet(I,1); → [1]: → 1,1,1,0,0 → [2]: → 0,1,1,1,0 → [3]: → 1,0,1,0,1 → [4]: → 0,0,1,1,1 → [5]: → 0,1,0,0,1 eliminate(I,xuv); → _[1]=0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
insert (
list_expression,
expression )
insert (
list_expression,
expression,
int_expression )
Type:
list
Purpose:
inserts a new element (expression) into a list at the beginning, or (if called with 3 arguments) after the given position (the input is not changed).
Example:
list L=1,2; insert(L,4,2); → [1]: → 1 → [2]: → 2 → [3]: → 4 insert(L,4); → [1]: → 4 → [2]: → 1 → [3]: → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
interred (
ideal_expression )
interred (
module_expression )
Type:
the same as the input type
Purpose:
interreduces a set of polynomials/vectors.
Example:
ring r=0,(x,y,z),dp; ideal i=x2+z,z,2z; interred(i); → _[1]=z → _[2]=x2 ring R=0,(x,y,z),ds; ideal i=zx+y3,z+y3,z+xy; interred(i); → _[1]=z+xy → _[2]=xy-y3 → _[3]=x2y-y3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
intersect (
expression_list of ideal_expression )
intersect (
expression_list of module_expression )
Type:
ideal, resp. module
Purpose:
computes the intersection of ideals, resp. modules.
Note:
If the option returnSB
is enabled then the result is a standard basis.
Example:
ring R=0,(x,y),dp; ideal i=x; ideal j=y; intersect(i,j); → _[1]=xy ring r=181,(x,y,z),(c,ls); ideal id1=maxideal(3); ideal id2=x2+xyz,y2-z3y,z3+y5xz; ideal id3=intersect(id1,id2,ideal(x,y)); id3; → id3[1]=yz3+xy6z → id3[2]=yz4-y2z → id3[3]=y2z3-y3 → id3[4]=xz3+x2y5z → id3[5]=xyz2+x2z → id3[6]=xyz3-xy2 → id3[7]=xy2z+x2y → id3[8]=x2yz+x3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
jacob (
poly_expression )
jacob (
ideal_expression )
Type:
ideal, if the input is a polynomial
matrix, if the input is an ideal
Purpose:
computes the Jacobi ideal, resp. Jacobi matrix, generated by all partial derivatives of the input.
Example:
ring R; poly f=x2+y3+z5; jacob(f); → _[1]=2x → _[2]=3y2 → _[3]=5z4 ideal i=jacob(f); print(jacob(i)); → 2,0, 0, → 0,6y,0, → 0,0, 20z3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
jet (
poly_expression,
int_expression )
jet (
vector_expression,
int_expression )
jet (
ideal_expression,
int_expression )
jet (
module_expression,
int_expression )
jet (
poly_expression,
int_expression,
intvec_expression )
jet (
vector_expression,
int_expression,
intvec_expression )
jet (
ideal_expression,
int_expression,
intvec_expression )
jet (
module_expression,
int_expression,
intvec_expression )
jet (
poly_expression,
int_expression,
poly_expression )
jet (
vector_expression,
int_expression,
poly_expression )
jet (
ideal_expression,
int_expression,
matrix_expression )
jet (
module_expression,
int_expression,
matrix_expression )
Type:
the same as the type of the first argument
Purpose:
deletes from the first argument all terms of degree bigger than the second argument.
If a third argument w
of type intvec is given, the degree is replaced by the weighted degree defined by w
.
If a third argument u
of type poly or matrix is given, the first argument p
is replaced by p/u
.
Example:
ring r=32003,(x,y,z),(c,dp); jet(1+x+x2+x3+x4,3); → x3+x2+x+1 poly f=1+x+x2+xz+y2+x3+y3+x2y2+z4; jet(f,3); → x3+y3+x2+y2+xz+x+1 intvec iv=2,1,1; jet(f,3,iv); → y3+y2+xz+x+1 // the part of f with (total) degree >3: f-jet(f,3); → x2y2+z4 // the homogeneous part of f of degree 2: jet(f,2)-jet(f,1); → x2+y2+xz // the part of maximal degree: jet(f,deg(f))-jet(f,deg(f)-1); → x2y2+z4 // the absolute term of f: jet(f,0); → 1 // now for other types: ideal i=f,x,f*f; jet(i,2); → _[1]=x2+y2+xz+x+1 → _[2]=x → _[3]=3x2+2y2+2xz+2x+1 vector v=[f,1,x]; jet(v,1); → [x+1,1,x] jet(v,0); → [1,1] v=[f,1,0]; module m=v,v,[1,x2,z3,0,1]; jet(m,2); → _[1]=[x2+y2+xz+x+1,1] → _[2]=[x2+y2+xz+x+1,1] → _[3]=[1,x2,0,0,1]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
kbase (
ideal_expression )
kbase (
module_expression )
kbase (
ideal_expression,
int_expression)
kbase (
module_expression,
int_expression)
Type:
the same as the input type of the first argument
Purpose:
with one argument:
computes a vector space basis (consisting of monomials)
of the quotient ring by the ideal,
resp. of a free module by the module, in case it is finite dimensional
and if the input is a standard basis with respect to the ring ordering.
If the input is not a standard basis, the leading terms of the input are
used and the result may have no meaning.
With two arguments: computes the part of a vector space basis of the
respective quotient with degree of the monomials equal to the
second argument. Here, the quotient does not need to be finite dimensional.
Example:
ring r=32003,(x,y,z),ds; ideal i=x2,y2,z; kbase(std(i)); → _[1]=xy → _[2]=y → _[3]=x → _[4]=1 i=x2,y3,xyz; // quotient not finite dimensional kbase(std(i),2); → _[1]=z2 → _[2]=yz → _[3]=xz → _[4]=y2 → _[5]=xy
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
kill (
name )
kill (
list_of_names )
Type:
none
Purpose:
deletes objects.
Example:
int i=3; ring r=0,x,dp; poly p; listvar(); → // r [0] *ring → // p [0] poly → // i [0] int 3 → // LIB [0] string standard.lib kill(i,r); // the variable `i` does not exist any more i; → ? `i` is undefined → ? error occurred in line 7: ` i;` listvar(); → // LIB [0] string standard.lib
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
killattrib (
name,
string_expression )
Type:
none
Purpose:
deletes the attribute given as the second argument.
Example:
ring r=32003,(x,y),lp; ideal i=maxideal(1); attrib(i,"isSB",1); attrib(i); → attr:isSB, type int killattrib(i,"isSB"); attrib(i); → no attributes
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
koszul (
int_expression,
int_expression )
koszul (
int_expression,
ideal_expression )
koszul (
int_expression,
int_expression,
ideal_expression )
Type:
matrix
Purpose:
koszul(d,n)
computes a matrix of the Koszul relations of degree d of
the first n ring variables.
koszul(d,id)
computes a matrix of the Koszul relations of degree d of
the generators of the ideal id
.
koszul(d,n,id)
computes a matrix of the Koszul relations of degree d of
the first n generators of the ideal id
.
Note:
koszul(1,id),koszul(2,id),...
form a complex, that is, the product
of the matrices koszul(i,id)
and koszul(i+1,id)
equals zero.
Example:
ring r=32003,(x,y,z),dp; print(koszul(2,3)); → -y,-z,0, → x, 0, -z, → 0, x, y ideal I=xz2+yz2+z3,xyz+y2z+yz2,xy2+y3+y2z; print(koszul(1,I)); → xz2+yz2+z3,xyz+y2z+yz2,xy2+y3+y2z print(koszul(2,I)); → -xyz-y2z-yz2,-xy2-y3-y2z,0, → xz2+yz2+z3, 0, -xy2-y3-y2z, → 0, xz2+yz2+z3, xyz+y2z+yz2 print(koszul(2,I)*koszul(3,I)); → 0, → 0, → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
laguerre (
poly_expression,
int_expression,
int_expression )
Type:
list
Purpose:
computes all complex roots of a univariate polynomial using Laguerre’s algorithm. The second argument defines the precision of the fractional part if the ground field is the field of rational numbers, otherwise it will be ignored. The third argument (can be 0, 1 or 2) gives the number of extra runs for Laguerre’s algorithm (with corrupted roots), leading to better results.
Note:
If the ground field is the field of complex numbers, the elements of the list are of type number, otherwise of type string.
Example:
ring rs1=0,(x,y),lp; poly f=15x5+x3+x2-10; laguerre(f,10,2); → [1]: → (0.2930464644-I*0.9003002396) → [2]: → (0.2930464644+I*0.9003002396) → [3]: → (-0.7392783383-I*0.5355190078) → [4]: → (-0.7392783383+I*0.5355190078) → [5]: → 0.8924637479
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
lead (
poly_expression )
lead (
vector_expression )
lead (
ideal_expression )
lead (
module_expression )
Type:
the same as the input type
Purpose:
returns the leading (or initial) term(s) of a polynomial, a vector, resp. of the generators of an ideal or module with respect to the monomial ordering.
Note:
IN
may be used instead of lead
.
Example:
ring r=32003,(x,y,z),(c,ds); poly f=2x2+3y+4z3; vector v=[2x10,f]; ideal i=f,z; module m=v,[0,0,2+x]; lead(f); → 3y lead(v); → [2x10] lead(i); → _[1]=3y → _[2]=z lead(m); → _[1]=[2x10] → _[2]=[0,0,2] lead(0); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
leadcoef (
poly_expression )
leadcoef (
vector_expression )
Type:
number
Purpose:
returns the leading (or initial) coefficient of a polynomial or a vector with respect to the monomial ordering.
Example:
ring r=32003,(x,y,z),(c,ds); poly f=x2+y+z3; vector v=[2*x^10,f]; leadcoef(f); → 1 leadcoef(v); → 2 leadcoef(0); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
leadexp (
poly_expression )
leadexp (
vector_expression )
Type:
intvec
Purpose:
returns the exponent vector of the leading monomial of a polynomial or a vector. In the case of a vector the last component is the index in the vector.
Example:
ring r=32003,(x,y,z),(c,ds); poly f=x2+y+z3; vector v=[2*x^10,f]; leadexp(f); → 0,1,0 leadexp(v); → 10,0,0,1 leadexp(0); → 0,0,0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
leadmonom (
poly_expression )
leadmonom (
vector_expression )
Type:
the same as the input type
Purpose:
returns the leading monomial of a polynomial or a vector as a polynomial or vector whose coefficient is one.
Example:
ring r=32003,(x,y,z),(c,ds); poly f=2x2+3y+4z3; vector v=[2x10,f]; leadmonom(f); → y leadmonom(v); → [x10] leadmonom(0); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
LIB
string_expression;
Type:
none
Purpose:
reads a library of procedures from a file. If the given filename does
not start with . or / and cannot be located in the current
directory, each directory contained in the library
SearchPath
is searched for file of this name.
See section Loading of a library, for more info on SearchPath
.
Note on standard.lib:
Unless SINGULAR is started with the --no-stdlib
option, the
library standard.lib
is automatically loaded at start-up time.
Syntax:
LIB;
Type:
string
Purpose:
shows all loaded libraries written in Singular.
Example:
option(loadLib); // show loading of libraries LIB; // standard.lib is loaded → standard.lib // the names of the procedures of inout.lib LIB "inout.lib"; // are now known to Singular → // ** loaded inout.lib (1.21.2.5,2002/06/12) LIB; → standard.lib,inout.lib
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
lift (
ideal_expression,
subideal_expression )
lift (
module_expression,
submodule_expression )
lift (
ideal_expression,
subideal_expression,
matrix_name )
lift (
module_expression,
submodule_expression,
matrix_name )
Type:
matrix
Purpose:
computes the transformation matrix which expresses the generators of a
submodule in terms of the generators of a module. Uses different
algorithms for modules which are, resp. are not, represented by a
standard basis.
More precisely, if m
is the
module (or ideal), sm
the submodule (or ideal),
and T
the transformation matrix returned by
lift, then matrix(sm)*U = matrix(m)*T
and module(sm*U) = module(matrix(m)*T)
(resp. ideal(sm*U) = ideal(matrix(m)*T)
),
where U
is a diagonal matrix of units.
U
is always the unity matrix if the basering is a polynomial ring
(not power series ring). U
is stored in the optional third argument.
Note:
Gives a warning if sm
is not a submodule.
Example:
ring r=32003,(x,y,z),(dp,C); ideal m=3x2+yz,7y6+2x2y+5xz; poly f=y7+x3+xyz+z2; ideal i=jacob(f); matrix T=lift(i,m); matrix(m)-matrix(i)*T; → _[1,1]=0 → _[1,2]=0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
liftstd (
ideal_expression,
matrix_name )
liftstd (
module_expression,
matrix_name )
Type:
ideal or module
Purpose:
returns a standard basis of an ideal or module and the transformation
matrix from the given ideal, resp. module, to the standard basis.
That is, if m
is the ideal or module, sm
the standard
basis returned by liftstd
, and T
the transformation matrix
then matrix(sm)=matrix(m)*T
and sm=ideal(matrix(m)*T)
,
resp. sm=module(matrix(m)*T)
.
Example:
ring R=0,(x,y,z),dp; poly f=x3+y7+z2+xyz; ideal i=jacob(f); matrix T; ideal sm=liftstd(i,T); sm; → sm[1]=xy+2z → sm[2]=3x2+yz → sm[3]=yz2+3048192z3 → sm[4]=3024xz2-yz2 → sm[5]=y2z-6xz → sm[6]=3097158156288z4+2016z3 → sm[7]=7y6+xz print(T); → 0,1,T[1,3], T[1,4],y, T[1,6],0, → 0,0,-3x+3024z,3x, 0, T[2,6],1, → 1,0,T[3,3], T[3,4],-3x,T[3,6],0 matrix(sm)-matrix(i)*T; → _[1,1]=0 → _[1,2]=0 → _[1,3]=0 → _[1,4]=0 → _[1,5]=0 → _[1,6]=0 → _[1,7]=0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
listvar (
[package] )
listvar (
[package,
] type )
listvar (
[package,
] ring_name )
listvar (
[package,
] name )
listvar (
[package,
] all )
Type:
none
Purpose:
lists all (user-)defined names in the current namespace:
listvar()
: all currently visible names except procedures,
listvar(
type)
: all currently visible names of the given
type,
listvar(
ring_name)
: all names which belong to the given
ring,
listvar(
name)
: the object with the given name,
listvar(all)
: all names except procedures.
The current basering is marked with a *
. The nesting level of
variables in procedures is shown in square brackets.
Example:
proc t1 { } proc t2 { } ring s; poly ss; ring r; poly f=x+y+z; int i=7; ideal I=f,x,y; listvar(all); → // i [0] int 7 → // r [0] *ring → // I [0] ideal, 3 generator(s) → // f [0] poly → // s [0] ring → // ss [0] poly → // LIB [0] string standard.lib listvar(); → // i [0] int 7 → // r [0] *ring → // I [0] ideal, 3 generator(s) → // f [0] poly → // s [0] ring → // LIB [0] string standard.lib listvar(r); → // r [0] *ring → // I [0] ideal, 3 generator(s) → // f [0] poly listvar(t1); → // t1 [0] proc listvar(proc); → // t2 [0] proc → // t1 [0] proc → // fprintf [0] proc from standard.lib → // printf [0] proc from standard.lib → // sprintf [0] proc from standard.lib → // intersect1 [0] proc from standard.lib (static) → // quotient4 [0] proc from standard.lib → // quotient5 [0] proc from standard.lib → // quotient3 [0] proc from standard.lib → // quotient2 [0] proc from standard.lib → // quotient1 [0] proc from standard.lib → // quotient0 [0] proc from standard.lib (static) → // quot1 [0] proc from standard.lib (static) → // quot [0] proc from standard.lib → // res [0] proc from standard.lib → // groebner [0] proc from standard.lib → // stdhilb [0] proc from standard.lib → // stdfglm [0] proc from standard.lib
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
lres (
ideal_expression,
int_expression )
Type:
resolution
Purpose:
computes a free resolution of an ideal using La Scala’s algorithm.
More precisely, let R be the basering and I be the given ideal.
Then lres
computes a minimal free resolution of R/I
If the int_expression k is not zero then the computation stops after
k steps and returns a list of modules
list L=lres(I,0);
returns a list L of n modules (where n is the
number of variables of the basering) such that
in the above notation.
Note:
The ideal_expression has to be homogeneous.
Accessing single elements of a resolution may require that some partial
computations have to be finished and may therefore take some time.
Example:
ring r=0,(x,y,z),dp; ideal I=xz,yz,x3-y3; def L=lres(I,0); print(betti(L),"betti"); → 0 1 2 → ------------------------ → 0: 1 - - → 1: - 2 1 → 2: - 1 1 → ------------------------ → total: 1 3 2 L[2]; // the first syzygy module of r/I → _[1]=-x*gen(1)+y*gen(2) → _[2]=-x2*gen(2)+y2*gen(1)+z*gen(3)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
maxideal (
int_expression )
Type:
ideal
Purpose:
returns the power given by int_expression of the maximal ideal
generated by all ring variables (maxideal(i)=1
for i<=0
).
Example:
ring r=32003,(x,y,z),dp; maxideal(2); → _[1]=z2 → _[2]=yz → _[3]=y2 → _[4]=xz → _[5]=xy → _[6]=x2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
memory (
int_expression )
Type:
int
Purpose:
returns statistics concerning the memory management:
memory(0)
is the number of active (used) bytes,
memory(1)
is the number of bytes allocated from the
operating system,
memory(2)
is the maximal number of bytes ever allocated from the
operating system during the current SINGULAR session.
Note:
To monitor the memory usage during ongoing computations the option
mem
should be set (using the command option(mem);
, see
also option).
Example:
ring r=0,(x(1..500)),dp; poly p=(x(1)+x(500))^50; proc ReportMemoryUsage() { "Memory currently used by SINGULAR :",memory(0),"Byte (", memory(0)/1023, "KByte)" +newline+ "Memory currently allocated from system:",memory(1), "Byte (", memory(1)/1023, "KByte)"; "Maximal memory allocated from system :",memory(2), "Byte (", memory(2)/1023, "KByte)"; } ReportMemoryUsage(); → Memory currently used by SINGULAR : 206940 Byte ( 202 KByte) → Memory currently allocated from system: 669128 Byte ( 654 KByte) → Maximal memory allocated from system : 669128 Byte ( 654 KByte) kill p; ReportMemoryUsage(); // less memory used: p killed → Memory currently used by SINGULAR : 153704 Byte ( 150 KByte) → Memory currently allocated from system: 669128 Byte ( 654 KByte) → Maximal memory allocated from system : 669128 Byte ( 654 KByte) kill r; ReportMemoryUsage(); // even less memory: r killed → Memory currently used by SINGULAR : 143124 Byte ( 139 KByte) → Memory currently allocated from system: 669128 Byte ( 654 KByte) → Maximal memory allocated from system : 669128 Byte ( 654 KByte)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
minbase (
ideal_expression )
minbase (
module_expression )
Type:
the same as the type of the argument
Purpose:
returns a minimal set of generators of an ideal, resp. module, if the input is either homogeneous or if the ordering is local.
Example:
ring r=181,(x,y,z),(c,ls); ideal id2=x2+xyz,y2-z3y,z3+y5xz; ideal id4=maxideal(3)+id2; size(id4); → 13 minbase(id4); → _[1]=x2 → _[2]=xyz+x2 → _[3]=xz2 → _[4]=y2 → _[5]=yz2 → _[6]=z3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
minor (
matrix_expression,
int_expression )
minor (
matrix_expression,
int_expression,
ideal_expression )
Type:
ideal
Purpose:
returns the set of all minors (=subdeterminants) of the given size of a matrix. The optional third argument must be a standard basis. If a third argument is given, the computations will be performed modulo that ideal.
Example:
ring r=0,(x(1..5)),ds; matrix m[2][4]=x(1..4),x(2..5); print(m); → x(1),x(2),x(3),x(4), → x(2),x(3),x(4),x(5) ideal j=minor(m,2); j; → j[1]=-x(4)^2+x(3)*x(5) → j[2]=-x(3)*x(4)+x(2)*x(5) → j[3]=-x(2)*x(4)+x(1)*x(5) → j[4]=x(3)^2-x(2)*x(4) → j[5]=x(2)*x(3)-x(1)*x(4) → j[6]=-x(2)^2+x(1)*x(3) minor(m,2,std(ideal(x(1)))); → _[1]=-x(4)^2+x(3)*x(5) → _[2]=-x(3)*x(4)+x(2)*x(5) → _[3]=-x(2)*x(4) → _[4]=x(3)^2-x(2)*x(4) → _[5]=x(2)*x(3) → _[6]=-x(2)^2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
minres (
list_expression )
Type:
list
Syntax:
minres (
resolution_expression )
Type:
resolution
Purpose:
minimizes a free resolution of an ideal or module given by the list_expression, resp. resolution_expression.
Example:
ring r1=32003,(x,y),dp; ideal i=x5+xy4,x3+x2y+xy2+y3; resolution rs=lres(i,0); rs; → 1 2 1 → r1 <-- r1 <-- r1 → → 0 1 2 → resolution not minimized yet → list(rs); → [1]: → _[1]=x3+x2y+xy2+y3 → _[2]=xy4 → _[3]=y7 → [2]: → _[1]=-y4*gen(1)+x2*gen(2)+xy*gen(2)+y2*gen(2)+gen(3) → _[2]=-y3*gen(2)+x*gen(3) minres(rs); → 1 2 1 → r1 <-- r1 <-- r1 → → 0 1 2 → list(rs); → [1]: → _[1]=x3+x2y+xy2+y3 → _[2]=xy4 → [2]: → _[1]=xy4*gen(1)-x3*gen(2)-x2y*gen(2)-xy2*gen(2)-y3*gen(2)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
modulo (
ideal_expression,
ideal_expression )
modulo (
module_expression,
module_expression )
Type:
module
Purpose:
modulo(h1,h2)
where
are considered as submodules of the same free module
(l=1 for ideals). Let
as columns.
Then
where
modulo(h1,h2)
returns generators of
the kernel of this induced map.
Example:
ring r; ideal h1=x,y,z; ideal h2=x; module m=modulo(h1,h2); print(m); → 1,0, 0,0, → 0,-z,x,0, → 0,y, 0,x
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
monitor (
string_expression )
monitor (
string_expression,
string_expression )
Type:
none
Purpose:
controls the recording of all user input and/or program output into a file.
The second argument describes what to log: "i"
means input,
"o"
means output, "io"
for both.
The default for the second argument is "i"
.
Each monitor
command closes a previous monitor file
and opens the file given by the first string expression.
monitor ("")
turns off recording.
Example:
monitor("doe.tmp","io"); // log input and output to doe.tmp ring r; poly f=x+y+z; int i=7; ideal I=f,x,y; monitor(""); // stop logging
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
mpresmat (
ideal_expression,
int_expression )
Type:
module
Purpose:
computes the multipolynomial resultant matrix of the input system. Uses the sparse resultant matrix method of Gelfand, Kapranov and Zelevinsky (second parameter = 0) or the resultant matrix method of Macaulay (second parameter = 1).
Note:
When using the resultant matrix method of Macaulay the input system must be homogeneous. The number of elements in the input system must be the number of variables in the basering plus one.
Example:
ring rsq=(0,s,t,u),(x,y),lp; ideal i=s+tx+uy,x2+y2-10,x2+xy+2y2-16; module m=mpresmat(i,0); print(m); → -16,0, -10,0, (s),0, 0, 0, 0, 0, → 0, -16,0, -10,(u),(s),0, 0, 0, 0, → 2, 0, 1, 0, 0, (u),0, 0, 0, 0, → 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, → 0, 0, 0, 0, (t),0, -10,(s),0, -16, → 1, 0, 0, 0, 0, (t),0, (u),(s),0, → 0, 1, 0, 0, 0, 0, 1, 0, (u),2, → 1, 0, 1, 0, 0, 0, 0, (t),0, 0, → 0, 1, 0, 1, 0, 0, 0, 0, (t),1, → 0, 0, 0, 0, 0, 0, 1, 0, 0, 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
mres (
ideal_expression,
int_expression )
mres (
module_expression,
int_expression )
Type:
resolution
Purpose:
computes a minimal free resolution of an ideal or module M with the
standard basis method. More precisely, let A=matrix
(M), then mres
computes a free resolution of
where the columns of the matrix
are a minimal set of generators
of M if the basering is local or if M is homogeneous.
If the int expression k is not zero then the computation stops after k steps
and returns a list of modules
mres(M,0)
returns a resolution consisting of at most n+2 modules,
where n is the number of variables of the basering.
Let list L=mres(M,0);
then L[1]
consists of a minimal set of generators of the input, L[2]
consists of a minimal set of generators for the first syzygy module of
L[1]
, etc., until L[p+1]
, such that
but L[p+1]
, the first syzygy module of L[p]
,
is 0 (if the basering is not a qring).
Note:
Accessing single elements of a resolution may require that some partial computations have to be finished and may therefore take some time.
Example:
ring r=31991,(t,x,y,z,w),ls; ideal M=t2x2+tx2y+x2yz,t2y2+ty2z+y2zw, t2z2+tz2w+xz2w,t2w2+txw2+xyw2; resolution L=mres(M,0); L; → 1 4 15 18 7 1 → r <-- r <-- r <-- r <-- r <-- r → → 0 1 2 3 4 5 → // projective dimension of M is 5
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
mstd (
ideal_expression )
mstd (
module_expression )
Type:
list
Purpose:
returns a list whose first entry is a standard basis for the ideal, resp. module. If the monomial ordering is global, then the second entry is both a generating set for the ideal, resp. module, and a subset of the standard basis. If, additionally, the input is homogeneous then the second entry is a minimal generating set for the ideal, resp. module.
Example:
ring r=0,(x,y,z,t),dp; poly f=x3+y4+z6+xyz; ideal j=jacob(f),f; j=homog(j,t);j; → j[1]=3x2+yz → j[2]=4y3+xzt → j[3]=6z5+xyt3 → j[4]=0 → j[5]=z6+y4t2+x3t3+xyzt3 mstd(j); → [1]: → _[1]=3x2+yz → _[2]=4y3+xzt → _[3]=6z5+xyt3 → _[4]=xyzt3 → _[5]=y2z2t3 → _[6]=yz3t4 → _[7]=xz3t4 → _[8]=yz2t7 → _[9]=xz2t7 → _[10]=y2zt7 → _[11]=xy2t7 → [2]: → _[1]=3x2+yz → _[2]=4y3+xzt → _[3]=6z5+xyt3 → _[4]=xyzt3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
mult (
ideal_expression )
mult (
module_expression )
Type:
int
Purpose:
computes the degree of the monomial ideal, resp. module, generated by
the leading monomials of the input.
If the input is a standard basis of a homogeneous ideal
then it returns the degree of this ideal.
If the input is a standard basis of an ideal in a (local)
ring with respect to a local degree ordering
then it returns the multiplicity of the ideal (in the sense of Samuel,
with respect to the maximal ideal).
Example:
ring r=32003,(x,y),ds; poly f=(x3+y5)^2+x2y7; ideal i=std(jacob(f)); mult(i); → 46 mult(std(f)); → 6
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
nameof (
expression )
Type:
string
Purpose:
returns the name of an expression as string.
Example:
int i=9; string s=nameof(i); s; → i nameof(s); → s nameof(i+1); //returns the empty string: → nameof(basering); → basering basering; → ? `basering` is undefined → ? error occurred in line 7: ` basering;` ring r; nameof(basering); → r
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
names ( )
names (
ring_name )
Type:
list of strings
Purpose:
returns the names of all user-defined variables which are ring independent (this includes the names of procedures) or, in the second case, which belong to the given ring.
Example:
int i=9; ring r; poly f; poly g; setring r; names(); → [1]: → r → [2]: → i → [3]: → fprintf → [4]: → printf → [5]: → sprintf → [6]: → intersect1 → [7]: → quotient4 → [8]: → quotient5 → [9]: → quotient3 → [10]: → quotient2 → [11]: → quotient1 → [12]: → quotient0 → [13]: → quot1 → [14]: → quot → [15]: → res → [16]: → groebner → [17]: → stdhilb → [18]: → stdfglm → [19]: → LIB names(r); → [1]: → g → [2]: → f
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
ncols (
matrix_expression )
ncols (
intmat_expression )
ncols (
ideal_expression )
Type:
int
Purpose:
returns the number of columns of a matrix or an intmat or the number of given generators of the ideal, including zeros.
Note:
size(
ideal)
counts the number of generators
which are different from zero. (Use nrows
to get the number of rows
of a given matrix or intmat.)
Example:
ring r; matrix m[5][6]; ncols(m); → 6 ideal i=x,0,y; ncols(i); → 3 size(i); → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
npars (
ring_name )
Type:
int
Purpose:
returns the number of parameters of a ring.
Example:
ring r=(23,t,v),(x,a(1..7)),lp; // the parameters are t,v npars(r); → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
nres (
ideal_expression,
int_expression )
nres (
module_expression,
int_expression )
Type:
resolution
Purpose:
computes a free resolution of an ideal or module M which is minimized from the second module on (by the standard basis method).
More precisely, let
then nres
computes a free resolution of
where the columns of the matrix
are the given set of generators of M.
If the int expression k is not zero then the computation stops after k steps
and returns a list of modules
nres(M,0)
returns a list of n modules where n is the number of
variables of the basering.
Let list L=nres(M,0);
then L[1]=M
is identical to the input,
L[2]
is a minimal set of generators for the first syzygy
module of L[1]
, etc.
in the notations from above).
Example:
ring r=31991,(t,x,y,z,w),ls; ideal M=t2x2+tx2y+x2yz,t2y2+ty2z+y2zw, t2z2+tz2w+xz2w,t2w2+txw2+xyw2; resolution L=nres(M,0); L; → 1 4 15 18 7 1 → r <-- r <-- r <-- r <-- r <-- r → → 0 1 2 3 4 5 → resolution not minimized yet →
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
nrows (
matrix_expression )
nrows (
intmat_expression )
nrows (
intvec_expression )
nrows (
module_expression )
nrows (
vector_expression )
Type:
int
Purpose:
returns the number of rows of a matrix, an intmat or an intvec, resp. the minimal rank of a free module in which the given module or vector lives (the index of the last non-zero component).
Note:
Use ncols
to get the number of columns of a given matrix or intmat.
Example:
ring R; matrix M[2][3]; nrows(M); → 2 nrows(freemodule(4)); → 4 module m=[0,0,1]; nrows(m); → 3 nrows([0,x,0]); → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
nvars (
ring_name )
Type:
int
Purpose:
returns the number of variables of a ring.
Example:
ring r=(23,t,v),(x,a(1..7)),ls; // the variables are x,a(1),...,a(7) nvars(r); → 8
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
open (
link_expression )
Type:
none
Purpose:
opens a link.
Example:
link l="MPtcp:launch"; open(l); // start SINGULAR "server" on localhost in batchmode close(l); // shut down SINGULAR server
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
option ()
Type:
string
Purpose:
lists all defined options.
Syntax:
option (
option_name )
Type:
none
Purpose:
sets an option.
Note:
To disable an option, use the prefix no
.
Syntax:
option ( get )
Type:
intvec
Purpose:
dumps the state of all options to an intvec.
Syntax:
option ( set,
intvec_expression )
Type:
none
Purpose:
restores the state of all options from an intvec (produced by
option(get)
).
Values:
The following options are used to manipulate the behavior of
computations and act like boolean switches. Use the prefix no
to
disable an option. Notice that some options are ring dependent and reset
to their default values on a change of the current basering.
none
turns off all options (including the prompt
option).
returnSB
the functions syz
, intersect
, quotient
,
modulo
return a standard base instead of a generating set if
returnSB
is set. This option should not be used for lift
.
fastHC
tries to the find the highest corner of the staircase (HC) as fast as possible during a standard basis computation (only used for local orderings).
intStrategy
avoids division of coefficients during standard basis computations. This option is ring dependent. By default, it is set for rings with characteristic 0 and not set for all other rings.
oldStd
uses a more lazy approach in std computations, which was used in Singular version before 2-0 (and which may lead to faster or slower computations, depending on the example)
minRes
special (additional) minimizing during computations (res
, mres
),
assumes homogeneous case and degree-compatible ordering.
notRegularity
disables the regularity bound for res
and mres
(see
regularity).
notSugar
disables the sugar strategy during standard basis computation.
notBuckets
disables the bucket representation of polynomials during standard basis computations. This option usually decreases the memory usage but increases the computation time. It should only be set for memory-critical standard basis computations.
prot
shows protocol information indicating the
progress during the following computations:
facstd
,
fglm
,
groebner
,
lres
,
mres
,
minres
,
mstd
,
res
,
sres
,
std
,
stdfglm
,
stdhilb
,
syz
.
See below for more details.
redSB
computes a reduced standard basis in any standard basis computation.
redTail
reduction of the tails of polynomials during standard basis computations. This option is ring dependent. By default, it is set for rings with global degree orderings and not set for all other rings.
redThrough
for inhomogeneous input, polynomial reductions during standard basis computations are never postponed, but always finished through. This option is ring dependent. By default, it is set for rings with global degree orderings and not set for all other rings.
sugarCrit
uses criteria similar to the homogeneous case to keep more useless pairs.
weightM
automatically computes suitable weights for the weighted ecart and the weighted sugar method.
The following options, which also control computations, are special,
since they are not manipulated by the option
command but by a
direct assignment of a value. Reset the option by assigning the value 0;
the command option(none)
will not reset them! If there is a
non-zero value assigned, the command option()
prints the option.
multBound
a multiplicity bound is set (see multBound).
degBound
a degree bound is set (see degBound).
The last set of options controls the output of SINGULAR:
Imap
shows the mapping of variables with the fetch and imap commands.
loadLib
shows loading of libraries (set by default).
debugLib
warns about syntax errors during loading of libraries.
loadProc
shows loading of procedures from libraries.
mem
shows memory usage in square brackets (see memory).
prompt
shows prompt (>
, resp. .
) if ready for input (default).
reading
shows the number of characters read from a file.
redefine
warns about variable redefinitions (set by default).
usage
shows correct usage in error messages (set by default).
Example:
option(prot); option(); → //options: prot redefine usage prompt option(notSugar); option(); → //options: prot notSugar redefine usage prompt option(noprot); option(); → //options: notSugar redefine usage prompt option(none); option(); → //options: none ring r=0,x,dp; degBound=22; option(); → //options: degBound redTail redThrough intStrategy intvec i=option(get); option(none); option(set,i); option(); → //options: degBound redTail redThrough intStrategy
The output reported on option(prot)
has the following meaning:
facstd | F | found a new factor | |
all other characters: like the output of std and reduce | |||
fglm | . | basis monomial found | |
+ | edge monomial found | ||
- | border monomial found | ||
groebner | all characters: like the output of std | ||
lres | . | minimal syzygy found | |
n | slanted degree, i.e., row of Betti matrix | ||
(mn) | calculate in module n | ||
g | pair found giving reductum and syzygy | ||
mres | [d] | computations of the d-th syzygy module | |
all other characters: like the output of std | |||
minres | [d] | minimizing of the d-th syzygy module | |
mstd | all characters: like the output of std | ||
reduce | r | reduced a leading term | |
t | reduced a non-leading term | ||
res | [d] | computations of the d-th syzygy module | |
all other characters: like the output of std | |||
sres | . | syzygy found | |
(n) | n elements remaining | ||
[n] | finished module n | ||
std | [m:n] | internal ring change to poly representation with exponent bound m and n words in exponent vector | |
s | found a new element of the standard basis | ||
- | reduced a pair/S-polynomial to 0 | ||
. | postponed a reduction of a pair/S-polynomial | ||
h | used Hilbert series criterion | ||
H(d) | found a ’highest corner’ of degree d, no need to consider higher degrees | ||
(n) | n critical pairs are still to be reduced | ||
(S:n) | doing complete reduction of n elements | ||
d | the degree of the leading terms is currently d | ||
stdfglm | all characters in first part: like the output of std | ||
all characters in second part: like the output of fglm | |||
stdhilb | all characters: like the output of std | ||
syz | all characters: like the output of std |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
ord (
poly_expression )
ord (
vector_expression )
Type:
int
Purpose:
returns the (weighted) degree of the initial term of a polynomial or a vector; the weights are the weights used for the first block of the ring ordering.
Note:
ord(0)
is -1
.
Example:
ring r=7,(x,y),wp(2,3); ord(0); → -1 poly f=x2+y3; // weight on y is 3 ord(f); → 9 ring R=7,(x,y),ws(2,3); poly f=x2+y3; ord(f); → 4 vector v=[x2,y]; ord(v); → 3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
ordstr (
ring_name )
Type:
string
Purpose:
returns the description of the monomial ordering of the ring.
Example:
ring r=7,(x,y),wp(2,3); ordstr(r); → wp(2,3),C
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
par (
int_expression )
Type:
number
Purpose:
par(n);
returns the n-th parameter of the basering.
Note:
This command should only be used if the basering has at least one parameter.
Example:
ring r=(0,a,b,c),(x,y,z),dp; char(r); // char to get the characteristic → 0 par(2); // par to get the n-th parameter → (b)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
pardeg (
number_expression )
Type:
int
Purpose:
returns the degree of a number considered as a polynomial in the ring parameters.
Example:
ring r=(0,a,b,c),(x,y,z),dp; pardeg(a^2*b); → 3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
parstr (
ring_name )
parstr (
int_expression )
parstr (
ring_name,
int_expression )
Type:
string
Purpose:
returns the list of parameters of the ring as a string
or the name of the n-th parameter where n is given by the int_expression.
If the ring_name is omitted, the basering is used, thus
parstr(n)
is equivalent to parstr(basering,n)
.
Example:
ring r=(7,a,b,c),(x,y),wp(2,3); parstr(r); → a,b,c parstr(2); → b parstr(r,3); → c
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
preimage (
ring_name,
map_name,
ideal_name )
preimage (
ring_name,
ideal_expression,
ideal_name )
Type:
ideal
Purpose:
returns the preimage of an ideal under a given map.
The second argument has to be a map from the basering to the given ring
(or an ideal defining such a map),
and the ideal has to be an ideal in the given ring.
Note:
To compute the kernel of a map, the preimage of zero has to be determined. Hence there is no special command for computing the kernel of a map in SINGULAR.
Example:
ring r1=32003,(x,y,z,w),lp; ring r=32003,(x,y,z),dp; ideal i=x,y,z; ideal i1=x,y; ideal i0=0; map f=r1,i; setring r1; ideal i1=preimage(r,f,i1); i1; → i1[1]=w → i1[2]=y → i1[3]=x // the kernel of f preimage(r,f,i0); → _[1]=w
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
prime (
int_expression )
Type:
int
Purpose:
returns the largest prime less then 32004 smaller or equal to the argument;
returns 2 for all arguments smaller than 3.
Example:
prime(32004); → 32003 prime(0); → 2 prime(-1); → 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
print (
expression )
print (
expression, "betti" )
print (
expression,
format_string )
Type:
none (for the first two calling sequences), resp.
string (for the last calling sequence)
Purpose:
The first form prints the expression to the terminal and has no return
value. Use the format string %p
to print into a string (see
below).
The second form prints the graded Betti numbers from a matrix. See
the description of the format string "betti"
below for more
details.
The last form returns the printed output as a string. The format
string determines which format to use to generate the string.
The following format strings are supported:
"betti"
The Betti numbers are printed in a matrix-like format where the entry is the minimal number of generators in degree syzygy module of
"%s"
returns string(
expression )
"%2s"
similar to "%s"
, except that newlines are inserted after every
comma and at the end
"%l"
similar to "%s"
, except that each object is embraced by its type
such that it can be directly used for "cutting and pasting"
"%2l"
similar to "%l"
, except that newlines are inserted after every
comma and at the end
"%;"
returns the string equivalent to typing expression;
"%t"
returns the string equivalent to typing type expression;
"%p"
returns the string equivalent to typing print(expression);
"%b"
returns the string equivalent to typing print(expression, "betti");
Example:
ring r=0,(x,y,z),dp; module m=[1,y],[0,x+z]; m; → m[1]=y*gen(2)+gen(1) → m[2]=x*gen(2)+z*gen(2) print(m); // the columns generate m → 1,0, → y,x+z string s=print(m,"%s"); s; → y*gen(2)+gen(1),x*gen(2)+z*gen(2) s=print(m,"%2s"); s; → y*gen(2)+gen(1), → x*gen(2)+z*gen(2) → s=print(m,"%l"); s; → module(y*gen(2)+gen(1),x*gen(2)+z*gen(2)) s=print(m,"%;"); s; → m[1]=y*gen(2)+gen(1) → m[2]=x*gen(2)+z*gen(2) → s=print(m,"%t"); s; → // m [0] module, rk 2, 2 generator(s) → m[1]=y*gen(2)+gen(1) → m[2]=x*gen(2)+z*gen(2) s=print(m,"%p"); s; → 1,0, → y,x+z → intmat M=betti(mres(m,0)); print(M,"betti"); → 0 1 → ------------------ → 0: 1 1 → ------------------ → total: 1 1 list l=r,M; s=print(l,"%s"); s; → (0),(x,y,z),(dp(3),C),1,1 s=print(l,"%2s"); s; → (0),(x,y,z),(dp(3),C), → 1,1 → s=print(l,"%l"); s; → list("(0),(x,y,z),(dp(3),C)",intmat(intvec(1,1 ),1,2))
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
printf (
string_expression [,
any_expressions] )
none
printf(fmt,...);
performs output formatting. The first
argument is a format control string. Additional arguments may be
required, depending on the content of the control string. A series
of output characters is generated as directed by the control string;
these characters are displayed (i.e., printed to standard out).
The control string fmt
is simply text to be copied, except
that the string may contain conversion specifications.
Do help print;
for a listing of valid conversion
specifications. As an addition to the conversions of print
,
the %n
and %2
conversion specification does not
consume an additional argument, but simply generates a newline
character.
If one of the additional arguments is a list, then it should be
enclosed once more into a list()
command, since passing a
list as an argument flattens the list by one level.
Example:
ring r=0,(x,y,z),dp; module m=[1,y],[0,x+z]; intmat M=betti(mres(m,0)); list l=r,m,M; printf("s:%s,l:%l",1,2); → s:1,l:int(2) printf("s:%s",l); → s:(0),(x,y,z),(dp(3),C) printf("s:%s",list(l)); → s:(0),(x,y,z),(dp(3),C),y*gen(2)+gen(1),x*gen(2)+z*gen(2),1,1 printf("2l:%2l",list(l)); → 2l:list("(0),(x,y,z),(dp(3),C)", → module(y*gen(2)+gen(1), → x*gen(2)+z*gen(2)), → intmat(intvec(1,1 ),1,2)) → printf("%p",list(l)); → [1]: → // characteristic : 0 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C → [2]: → _[1]=y*gen(2)+gen(1) → _[2]=x*gen(2)+z*gen(2) → [3]: → 1,1 → printf("%;",list(l)); → [1]: → // characteristic : 0 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C → [2]: → _[1]=y*gen(2)+gen(1) → _[2]=x*gen(2)+z*gen(2) → [3]: → 1,1 → printf("%b",M); → 0 1 → ------------------ → 0: 1 1 → ------------------ → total: 1 1 →
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
prune (
module_expression )
Type:
module
Purpose:
returns the module minimally embedded in a free module such that the corresponding factor modules are isomorphic.
Example:
ring r=0,(x,y,z),dp; module m=gen(1),gen(3),[x,y,0,z],[x+y,0,0,0,1]; print(m); → 1,0,x,x+y, → 0,0,y,0, → 0,1,0,0, → 0,0,z,0, → 0,0,0,1 print(prune(m)); → y, → z
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
qhweight (
ideal_expression )
Type:
intvec
Purpose:
computes the weight vector of the variables for a quasihomogeneous ideal. If the input is not weighted homogeneous, an intvec of zeros is returned.
Example:
ring h1=32003,(t,x,y,z),dp; ideal i=x4+y3+z2; qhweight(i); → 0,3,4,6
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
quot (
module_expression,
module_expression )
quot (
module_expression,
module_expression,
int_expression )
quot (
ideal_expression,
ideal_expression )
quot (
ideal_expression,
ideal_expression,
int_expression )
ideal
quot (
module_expression,
ideal_expression )
module
computes the quotient of the 1st and the 2nd argument. If a 3rd argument ’n’ is given the n-th method is used (n=1...5).
Example:
ring r=181,(x,y,z),(c,ls); ideal id1=maxideal(4); ideal id2=x2+xyz,y2-z3y,z3+y5xz; option(prot); ideal id3=quotient(id1,id2); → [1023:1]4(14)s(13)s(12)s(11)s(10)s(9)s(8)s(7)s(6)s(5)s(4)s(3)s(2)sss → product criterion:12 chain criterion:0 → {3}[1023:3]8(2)s(4)s(5)s9s.s.s.s.s.s → product criterion:0 chain criterion:39 id3; → id3[1]=z2 → id3[2]=yz → id3[3]=y2 → id3[4]=xz → id3[5]=xy → id3[6]=x2 ideal id4=quot(id1,id2,1); → [1023:2]4(14)s(13)s(12)s(11)s(10)s(9)s(8)s(7)s(6)s(5)s(4)s(3)s(2)sss → product criterion:0 chain criterion:0 → (S:3)rtrtrt → {1}[1023:3]4(2)s(4)s(5)s5s.s(3)s(2)sss → product criterion:0 chain criterion:39 → {1}[1023:3]4(5)s(4)s(3)s(2)sss → product criterion:0 chain criterion:9 → [255:3]3(11)s(10)sss(9)s(10)s(8)ss(7)s(8)s(6)s(7)s4(5)----- → product criterion:12 chain criterion:9 → {1}[1023:3]4(2)sss → product criterion:0 chain criterion:12 → [255:3]2(8)s(7)s(6)s3(5)ssssss4----- → product criterion:15 chain criterion:3 id4; → id4[1]=z2 → id4[2]=yz → id4[3]=xz → id4[4]=y2 → id4[5]=xy → id4[6]=x2 ideal id5=quot(id1,id2,2); → [1023:2]4(14)s(13)s(12)s(11)s(10)s(9)s(8)s(7)s(6)s(5)s(4)s(3)s(2)sss → product criterion:0 chain criterion:0 → (S:3)rtrtrt → {1}[1023:3]4(2)sss → product criterion:0 chain criterion:12 → {1}[1023:3]4(5)s(4)s(3)s(2)sss → product criterion:0 chain criterion:9 → [255:3]2(8)s(7)s(6)s3(5)s(4)s(3)s(2)sss → product criterion:15 chain criterion:0 id5; → id5[1]=z2 → id5[2]=yz → id5[3]=xz → id5[4]=y2 → id5[5]=xy → id5[6]=x2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
quote (
expression )
Type:
none
Purpose:
prevents expressions from evaluation. Used only in connections with write to
MPfile links, prevents evaluation of an expression before sending it to an other
SINGULAR process.
Within a quoted expression, the
quote can be "undone" by an eval
(i.e., each eval "undoes" the
effect of exactly one quote).
Example:
link l="MPfile:w example.mp"; ring r=0,(x,y,z),ds; ideal i=maxideal(3); ideal j=x7,x2,z; option(prot); // compute i+j before writing, but not std write (l, quote(std(eval(i+j)))); close(l); // now read it in again and evaluate: read(l); → [1023:1]1(12)s2(11)s3(10)--s(7)s(6)-----7- → product criterion:4 chain criterion:0 → _[1]=z → _[2]=x2 → _[3]=xy2 → _[4]=y3 close(l);
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
quotient (
ideal_expression,
ideal_expression )
quotient (
module_expression,
module_expression )
Type:
ideal
Syntax:
quotient (
module_expression,
ideal_expression )
Type:
module
Purpose:
computes the ideal quotient, resp. module quotient. Let R
be the
basering, I,J
ideals and M
a module in
Then
quotient(I,J)
=
quotient(M,J)
=
Example:
ring r=181,(x,y,z),(c,ls); ideal id1=maxideal(3); ideal id2=x2+xyz,y2-z3y,z3+y5xz; ideal id6=quotient(id1,id2); id6; → id6[1]=z → id6[2]=y → id6[3]=x quotient(id2,id1); → _[1]=z2 → _[2]=yz → _[3]=y2 → _[4]=xz → _[5]=xy → _[6]=x2 module m=x*freemodule(3),y*freemodule(2); ideal id3=x,y; quotient(m,id3); → _[1]=[1] → _[2]=[0,1] → _[3]=[0,0,x]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
random (
int_expression,
int_expression )
Type:
int
Purpose:
returns a random integer between the integer given by the first
int_expression and the one given by the second int_expression.
Syntax:
random (
int_expression,
int_expression,
int_expression )
Type:
intmat
Purpose:
returns a random intmat where the size is given by the second (number of rows) and third argument (number of columns). The absolute value of the entries of the matrix is smaller than or equal to the integer given as the first argument.
Note:
The random generator can be set to a start value with
the function system
, resp. by a command line option.
Example:
random(1,1000); → 35 random(1,2,3); → 0,0,0, → 1,1,-1 system("random",210); // start random generator with 210 random(-1000,1000); → 707 random(-1000,1000); → 284 system("random",210); random(-1000,1000); // the same random values again → 707
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
read (
link_expression )
for DBM links:
read (
link_expression )
read (
link_expression,
string_expression )
Type:
any
Purpose:
reads data from a link.
For ASCII links, the content of the entire
file is returned as one string. If the ASCII link is the empty string,
read
reads from standard input.
For MP links, one expression is read
from the link and returned after evaluation.
For MPtcp links the read
command blocks as long as there is no
data to be read from the link. The status
command can be used to
check whether or not there is data to be read.
For DBM links, a read
with one argument returns the value of
the next entry in the data base, and a read
with two arguments
returns the value to the key given as the second argument from the data
base.
Example:
ring r=32003,(x,y,z),dp; ideal i=x+y,z3+22y; // write the ideal i to the file save_i write(":w save_i",i); ring r0=0,(x,y,z),Dp; // create an ideal k equal to the content // of the file save_i string s="ideal k="+read("save_i")+";"; execute(s); k; → k[1]=x+y → k[2]=z3+22y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
reduce (
poly_expression,
ideal_expression )
reduce (
poly_expression,
ideal_expression,
int_expression )
reduce (
poly_expression,
ideal_expression,
poly_expression )
reduce (
vector_expression,
ideal_expression )
reduce (
vector_expression,
ideal_expression,
int_expression )
reduce (
vector_expression,
module_expression )
reduce (
vector_expression,
module_expression,
int_expression )
reduce (
vector_expression,
module_expression,
poly_expression )
reduce (
ideal_expression,
ideal_expression )
reduce (
ideal_expression,
ideal_expression,
int_expression )
reduce (
ideal_expression,
ideal_expression,
matrix_expression )
reduce (
module_expression,
ideal_expression )
reduce (
module_expression,
ideal_expression,
int_expression )
reduce (
module_expression,
module_expression )
reduce (
module_expression,
module_expression,
int_expression )
reduce (
module_expression,
module_expression,
matrix_expression )
Type:
the type of the first argument
Purpose:
reduces a polynomial, vector, ideal or module to its normal form with respect to an ideal or module represented by a standard basis.
Returns 0 if and only if the polynomial (resp. vector, ideal, module)
is an element (resp. subideal, submodule) of the ideal (resp. module).
The result may have no meaning if the second argument is not a standard basis.
The third (optional) argument 1 of type int forces a reduction which considers only the leading term and does no tail reduction.
If a third argument u
of type poly or matrix is given, the first argument p
is replaced by p/u
.
This works only for zero dimensional ideals (resp. modules) in the second argument and gives, even in a local ring, a reduced normal form which is the projection to the quotient by the ideal (resp. module).
Note:
The commands reduce
and NF
are synonymous.
Example:
ring r1 = 0,(z,y,x),ds; poly s1=2x5y+7x2y4+3x2yz3; poly s2=1x2y2z2+3z8; poly s3=4xy5+2x2y2z3+11x10; ideal i=s1,s2,s3; ideal j=std(i); reduce(3z3yx2+7y4x2+yx5+z12y2x2,j); → -yx5+2401/81y14x2+2744/81y11x5+392/27y8x8+224/81y5x11+16/81y2x14 reduce(3z3yx2+7y4x2+yx5+z12y2x2,j,1); → -yx5+z12y2x2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
regularity (
list_expression )
regularity (
resolution_expression )
Type:
int
Purpose:
computes the regularity of a homogeneous ideal, resp. module, from a
minimal resolution given by the list expression.
Note:
If applied to a non minimal resolution only an upper bound is returned.
If the input to the commands res
and mres
is homogeneous
the regularity is computed and used as a degree bound during
the computation unless option(notRegularity);
is given.
Example:
ring rh3=32003,(w,x,y,z),(dp,C); poly f=x11+y10+z9+x5y2+x2y2z3+xy3*(y2+x)^2; ideal j=homog(jacob(f),w); def jr=res(j,0); regularity(jr); → 25 // example for upper bound behavior: list jj=jr; regularity(jj); → 25 jj=nres(j,0); regularity(jj); → 27 jj=minres(jj); regularity(jj); → 25
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
repart (
number_expression )
Type:
number
Purpose:
returns the real part of a number from a complex ground field,
returns its argument otherwise.
Example:
ring r=(complex,i),x,dp; repart(1+2*i); → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
Syntax:
res (
ideal_expression,
int_expression [,
any_expression ])
res (
module_expression,
int_expression [,
any_expression ])
Type:
resolution
Purpose:
computes a (possibly minimal) free resolution of an ideal or module using
a heuristically chosen method.
The second (int) argument (say, k
) specifies the length of
the resolution. If it is not positive then k
is assumed to be the
number of variables of the basering.
If a third argument is given, the returned resolution is minimized.
Depending on the input, the returned resolution is computed using the following methods:
Note:
Accessing single elements of a resolution may require that some partial computations have to be finished and may therefore take some time.
Example:
ring r=0,(x,y,z),dp; ideal i=xz,yz,x3-y3; def l=res(i,0); // homogeneous ideal: uses lres l; → 1 3 2 → r <-- r <-- r → → 0 1 2 → resolution not minimized yet → print(betti(l), "betti"); // input to betti may be of type resolution → 0 1 2 → ------------------------ → 0: 1 - - → 1: - 2 1 → 2: - 1 1 → ------------------------ → total: 1 3 2 l[2]; // element access may take some time → _[1]=-x*gen(1)+y*gen(2) → _[2]=-x2*gen(2)+y2*gen(1)+z*gen(3) i=i,x+1; l=res(i,0); // inhomogeneous ideal: uses mres l; → 1 3 3 1 → r <-- r <-- r <-- r → → 0 1 2 3 → resolution not minimized yet → ring rs=0,(x,y,z),ds; ideal i=imap(r,i); def l=res(i,0); // local ring not minimized: uses sres l; → 1 1 → rs <-- rs → → 0 1 → resolution not minimized yet → res(i,0,0); // local ring and minimized: uses mres → 1 1 → rs <-- rs → → 0 1 →
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
reservedName ()
Type:
none
Syntax:
reservedName (
string_expression )
Type:
int
Purpose:
prints a list of all reserved identifiers (first form) or tests whether the string is a reserved identifier (second form).
Example:
reservedName(); → ... // output skipped reservedName("ring"); → 1 reservedName("xyz"); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
resultant (
poly_expression,
poly_expression,
ring_variable )
Type:
poly
Purpose:
computes the resultant of the first and second argument with respect to the variable given as the third argument.
Example:
ring r=32003,(x,y,z),dp; poly f=3*(x+2)^3+y; poly g=x+y+z; resultant(f,g,x); → 3y3+9y2z+9yz2+3z3-18y2-36yz-18z2+35y+36z-24
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
rvar (
name )
rvar (
poly_expression )
rvar (
string_expression )
Type:
int
Purpose:
returns the number of the variable if the name is a ring variable of the
basering or if the string is the name of a ring variable of the
basering; returns 0 if not. Hence the return value of rvar
can
also be used in a boolean context to check whether the variable exists.
Example:
ring r=29,(x,y,z),lp; rvar(x); → 1 rvar(r); → 0 rvar(y); → 2 rvar(var(3)); → 3 rvar("x"); → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
setring
ring_name
Type:
none
Purpose:
changes the basering to another (already defined) ring.
Example:
ring r1=0,(x,y),lp; // the basering is r1 ring r2=32003,(a(1..8)),ds; // the basering is r2 setring r1; // the basering is again r1 nameof(basering); → r1 listvar(); → // r2 [0] ring → // r1 [0] *ring → // LIB [0] string standard.lib
Use in procedures:
All changes of the basering by a definition of a new ring or a
setring
command in a procedure are local to this procedure. Use
keepring
to move a ring, which is local to a procedure, up by one
nesting level.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
simplex (
matrix_expression,
int_expression,
int_expression,
int_expression,
int_expression,
int_expression)
Type:
list
Purpose:
perform the simplex algorithm for the tableau given by the input, e.g. M,m,n,m1,m2,m3:
first row describing the objective function (maximize problem), the remaining rows describing constraints;
n = number of variables; m = total number of constraints; m1 = number of <=constraints (rows 2 ... m1+1 of M); m2 = number of >=constraints (rows m1+2 ... m1+m2+1 of M); m3 = number of == constraints.
The following assumptions are made:
(real,N)
, N>=4;The output is a list L with
0 = finite solution found; 1 = unbounded; -1 = no solution; -2 = error occured;
L[3][k] = number of variable which corresponds to row k+1 of L[1];
L[4][j] = number of variable which is represented by column j+1 of L[1] ("non-basis variable");
number of constraints (= m);
number of variables (= n).
The solution can be read from the first column of L[1] as is done by the
procedure simplexOut in solve.lib
.
Example:
ring r = (real,10),(x),lp; // consider the max. problem: // // maximize x(1) + x(2) + 3*x(3) - 0.5*x(4) // // with constraints: x(1) + 2*x(3) <= 740 // 2*x(2) - 7*x(4) <= 0 // x(2) - x(3) + 2*x(4) >= 0.5 // x(1) + x(2) + x(3) + x(4) = 9 // matrix sm[5][5]=( 0, 1, 1, 3,-0.5, 740,-1, 0,-2, 0, 0, 0,-2, 0, 7, 0.5, 0,-1, 1,-2, 9,-1,-1,-1,-1); int n = 4; // number of constraints int m = 4; // number of variables int m1= 2; // number of <= constraints int m2= 1; // number of >= constraints int m3= 1; // number of == constraints simplex(sm, n, m, m1, m2, m3); → [1]: → _[1,1]=17.025 → _[1,2]=-0.95 → _[1,3]=-0.05 → _[1,4]=1.95 → _[1,5]=-1.05 → _[2,1]=730.55 → _[2,2]=0.1 → _[2,3]=-0.1 → _[2,4]=-1.1 → _[2,5]=0.9 → _[3,1]=3.325 → _[3,2]=-0.35 → _[3,3]=-0.15 → _[3,4]=0.35 → _[3,5]=0.35 → _[4,1]=0.95 → _[4,2]=-0.1 → _[4,3]=0.1 → _[4,4]=0.1 → _[4,5]=0.1 → _[5,1]=4.725 → _[5,2]=-0.55 → _[5,3]=0.05 → _[5,4]=0.55 → _[5,5]=-0.45 → [2]: → 0 → [3]: → 5,2,4,3 → [4]: → 1,6,8,7 → [5]: → 4 → [6]: → 4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
simplify (
poly_expression,
int_expression )
simplify (
vector_expression,
int_expression )
simplify (
ideal_expression,
int_expression )
simplify (
module_expression,
int_expression )
Type:
the type of the first argument
Purpose:
returns the "simplified" first argument depending on the simplification rule given as the second argument. The simplification rules are the sum of the following functions:
1
normalize (make leading coefficients 1).
2
erase zero generators/columns.
4
keep only the first one of identical generators/columns.
8
keep only the first one of generators/columns which differ only by a factor in the ground field.
16
keep only those generators/columns whose leading monomials differ.
32
keep only those generators/columns whose leading monomials are not divisible by other ones.
Example:
ring r=0,(x,y,z),(c,dp); ideal i=0,2x,2x,4x,3x+y,5x2; simplify(i,1); → _[1]=0 → _[2]=x → _[3]=x → _[4]=x → _[5]=x+1/3y → _[6]=x2 simplify(i,2); → _[1]=2x → _[2]=2x → _[3]=4x → _[4]=3x+y → _[5]=5x2 simplify(i,4); → _[1]=0 → _[2]=2x → _[3]=4x → _[4]=3x+y → _[5]=5x2 simplify(i,8); → _[1]=0 → _[2]=2x → _[3]=3x+y → _[4]=5x2 simplify(i,16); → _[1]=0 → _[2]=2x → _[3]=5x2 simplify(i,32); → _[1]=0 → _[2]=2x simplify(i,32+2+1); → _[1]=x matrix A[2][3]=x,0,2x,y,0,2y; simplify(A,2+8); // by automatic conversion to module → _[1]=[x,y]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
size (
string_expression )
size (
intvec_expression )
size (
intmat_expression )
size (
poly_expression )
size (
vector_expression )
size (
ideal_expression )
size (
module_expression )
size (
matrix_expression )
size (
list_expression )
size (
resolution_expression )
size (
ring_expression )
Type:
int
Purpose:
depends on the type of argument:
returns the number of (non-zero) generators.
returns the length, i.e., the number of characters, entries or elements.
returns the number of monomials.
returns the number of entries (rows*columns).
returns the number of elements in the ground field (for Z/p and algebraic extensions) or -1
Example:
string s="hello"; size(s); → 5 intvec iv=1,2; size(iv); → 2 ring r=0,(x,y,z),lp; poly f=x+y+z; size(f); → 3 vector v=[x+y,0,0,1]; size(v); → 3 ideal i=f,y; size(i); → 2 module m=v,[0,1],[0,0,1],2*v; size(m); → 4 matrix mm[2][2]; size(mm); → 4 ring r1=(2,a),x,dp; minpoly=a4+a+1; size(r1); → 8
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
sortvec (
ideal_expression )
sortvec (
module_expression )
Type:
intvec
Purpose:
Example:
ring r=0,(x,y,z),dp; ideal I=y,z,x,x3,xz; sortvec(I); → 2,1,3,5,4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
sprintf (
string_expression [,
any_expressions
] )
string
sprintf(fmt,...);
performs output formatting. The first
argument is a format control string. Additional arguments may be
required, depending on the content of the control string. A series
of output characters is generated as directed by the control string;
these characters are returned as a string.
The control string fmt
is simply text to be copied,
except that the string may contain conversion specifications.
Do help print;
for a listing of valid conversion
specifications. As an addition to the conversions of print
,
the %n
and %2
conversion specification does not
consume an additional argument, but simply generates a newline
character.
If one of the additional arguments is a list, then it should be
enclosed once more into a list()
command, since passing a list
as an argument flattens the list by one level.
Example:
ring r=0,(x,y,z),dp; module m=[1,y],[0,x+z]; intmat M=betti(mres(m,0)); list l = r, m, M; string s = sprintf("s:%s,%n l:%l", 1, 2); s; → s:1, → l:int(2) s = sprintf("s:%n%s", l); s; → s: → (0),(x,y,z),(dp(3),C) s = sprintf("s:%2%s", list(l)); s; → s: → (0),(x,y,z),(dp(3),C),y*gen(2)+gen(1),x*gen(2)+z*gen(2),1,1 s = sprintf("2l:%n%2l", list(l)); s; → 2l: → list("(0),(x,y,z),(dp(3),C)", → module(y*gen(2)+gen(1), → x*gen(2)+z*gen(2)), → intmat(intvec(1,1 ),1,2)) → s = sprintf("%p", list(l)); s; → [1]: → // characteristic : 0 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C → [2]: → _[1]=y*gen(2)+gen(1) → _[2]=x*gen(2)+z*gen(2) → [3]: → 1,1 → s = sprintf("%;", list(l)); s; → [1]: → // characteristic : 0 → // number of vars : 3 → // block 1 : ordering dp → // : names x y z → // block 2 : ordering C → [2]: → _[1]=y*gen(2)+gen(1) → _[2]=x*gen(2)+z*gen(2) → [3]: → 1,1 → s = sprintf("%b", M); s; → 0 1 → ------------------ → 0: 1 1 → ------------------ → total: 1 1 →
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
sres (
ideal_expression,
int_expression )
sres (
module_expression,
int_expression )
Type:
resolution
Purpose:
computes a free resolution of an ideal or module with Schreyer’s
method. The ideal, resp. module, has to be a standard basis.
More precisely, let M be given by a standard basis and
Then sres
computes a free resolution of
If the int expression k is not zero then the computation stops after k steps
and returns a list of modules (given by standard bases)
sres(M,0)
returns a list of n modules where n is the number of variables of the basering.
Even if sres
does not compute a minimal resolution, the betti
command gives the true betti numbers! In many cases of interest
sres
is much faster than any other known method.
Let list L=sres(M,0);
then L[1]=M
is identical to the input,
L[2]
is a standard basis with respect to the Schreyer ordering of
the first syzygy
module of L[1]
, etc.
in the notations from above.)
Note:
Accessing single elements of a resolution may require that some partial computations have to be finished and may therefore take some time.
Example:
ring r=31991,(t,x,y,z,w),ls; ideal M=t2x2+tx2y+x2yz,t2y2+ty2z+y2zw, t2z2+tz2w+xz2w,t2w2+txw2+xyw2; M=std(M); resolution L=sres(M,0); L; → 1 35 141 209 141 43 4 → r <-- r <-- r <-- r <-- r <-- r <-- r → → 0 1 2 3 4 5 6 → resolution not minimized yet → print(betti(L),"betti"); → 0 1 2 3 4 5 → ------------------------------------------ → 0: 1 - - - - - → 1: - - - - - - → 2: - - - - - - → 3: - 4 - - - - → 4: - - - - - - → 5: - - - - - - → 6: - - 6 - - - → 7: - - 9 16 2 - → 8: - - - 2 5 1 → ------------------------------------------ → total: 1 4 15 18 7 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
status (
link_expression,
string_expression )
Type:
string
Syntax:
status (
link_expression,
string_expression,
string_expression )
status (
link_expression,
string_expression,
string_expression,
int_expression )
Type:
int
Purpose:
returns the status of the link as asked for by the second argument. If
a third argument is given, the result of the comparison to the status
string is returned: (status(l,s1)==s2)
is equivalent to
status(l,s1,s2)
. If a fourth integer argument (say, i
) is
given and if status(l,s1,s2)
yields 0
, then the execution
of the current process is suspended (the process is put to “sleep”)
for approximately i
microseconds, and afterwards the result of another
call to status(l,s1,s2)
is returned. The latter is useful for
“polling” the read
status of MPtcp links such that busy
loops are avoided (see Parallelization with MPtcp links for an
example). Note that on some systems, the minimum time for a process to
be put to sleep is one second.
The following string expressions are allowed:
"name"
the name string given by the definition of the link (usually the filename)
"type"
returns "ASCII"
, "MPfile"
, "MPtcp"
or "DBM"
"open"
returns "yes"
or "no"
"openread"
returns "yes"
or "no"
"openwrite"
returns "yes"
or "no"
"read"
returns "ready"
or "not ready"
"write"
returns "ready"
or "not ready"
"mode"
returns (depending on the type of the link and its status)
"","w","a","r"
or "rw"
Example:
link l=":w example.txt"; status(l,"write"); → not ready open(l); status(l,"write","ready"); → 1 close(l);
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
std (
ideal_expression)
std (
module_expression)
std (
ideal_expression,
intvec_expression )
std (
module_expression,
intvec_expression )
std (
ideal_expression,
intvec_expression,
intvec_expression )
std (
module_expression,
intvec_expression,
intvec_expression )
std (
ideal_expression,
poly_expression )
std (
module_expression,
vector_expression )
Type:
ideal or module
Purpose:
returns a standard basis of an ideal or module with respect to the
monomial ordering of the basering.
A standard basis is a set of generators such that
the leading terms generate the leading ideal, resp. module.
Use an optional
second argument of type intvec as Hilbert series
(result of hilb(i,1)
, see hilb),
if the ideal, resp. module, is homogeneous
(Hilbert driven standard basis computation, stdhilb).
If the ideal is quasihomogeneous with some weights w and if the Hilbert series
is computed w.r.t. to these weights, then use w as third argument.
Use an optional second argument of type poly, resp. vector,
to construct the standard basis from an already computed one (given as the
first argument) and one additional generator (the second argument).
Note:
The
standard basis is computed with a (more or less) straight-forward
implementation of the classical
Buchberger (resp. Mora) algorithm. For global orderings, use the
groebner
command instead (see section groebner), which heuristically
chooses the "best" algorithm to compute a Groebner basis.
To view the progress of long running computations, use
option(prot)
(see option(prot)).
Example:
// local computation ring r=32003,(x,y,z),ds; poly s1=1x2y+151xyz10+169y21; poly s2=1xz14+6x2y4+3z24; poly s3=5y10z10x+2y20z10+y10z20+11x3; ideal i=s1,s2,s3; ideal j=std(i); degree(j); → 0 // Hilbert driven elimination (standard) ring rhom=32003,(x,y,z,h),dp; ideal i=homog(imap(r,i),h); ideal j=std(i); intvec iv=hilb(j,1); ring rlex=32003,(x,y,z,h),lp; ideal i=fetch(rhom,i); ideal j=std(i,iv); j=subst(j,h,1); j[1]; → z64 // Hilbert driven elimination (ideal is quasihomogeneous) intvec w=10,1,1; ring whom=32003,(x,y,z),wp(w); ideal i=fetch(r,i); ideal j=std(i); intvec iw=hilb(j,1,w); ring wlex=32003,(x,y,z),lp; ideal i=fetch(whom,i); ideal j=std(i,iw,w); j[1]; → z64
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
stdfglm (
ideal_expression )
stdfglm (
ideal_expression,
string_expression )
ideal
computes the standard basis of the ideal in the basering
via fglm
(from the ordering given as the second argument
to the ordering of the basering).
If no second argument is given, "dp" is used.
Example:
ring r=0,(x,y,z),lp; ideal i=y3+x2,x2y+x2,x3-x2,z4-x2-y; ideal i1=stdfglm(i); //uses fglm from "dp" to "lp" i1; → i1[1]=z12 → i1[2]=yz4-z8 → i1[3]=y2+y-z8-z4 → i1[4]=xy-xz4-y+z4 → i1[5]=x2+y-z4 ideal i2=stdfglm(i,"Dp"); //uses fglm from "Dp" to "lp" i2; → i2[1]=z12 → i2[2]=yz4-z8 → i2[3]=y2+y-z8-z4 → i2[4]=xy-xz4-y+z4 → i2[5]=x2+y-z4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Procedure from library standard.lib
(see section standard_lib).
stdhilb (
ideal_expression )
stdhilb (
ideal_expression,
intvec_expression )
ideal
computes the standard basis of the homogeneous ideal in the basering,
via a Hilbert driven standard basis computation.
An optional second argument will be used as 1st Hilbert function.
The optional second argument is the first Hilbert series as computed
by hilb
.
Example:
ring r=0,(x,y,z),dp; ideal i=y3+x2,x2y+x2,x3-x2,z4-x2-y; ideal i1=stdhilb(i); i1; → i1[1]=y3+x2 → i1[2]=x2y+x2 → i1[3]=x3-x2 → i1[4]=z4-x2-y // the latter computation is equivalent to: intvec v=hilb(i,1); → // ** i is no standardbasis ideal i2=stdhilb(i,v); i2; → i2[1]=y3+x2 → i2[2]=x2y+x2 → i2[3]=x3-x2 → i2[4]=z4-x2-y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
subst (
poly_expression,
ring_variable,
poly_expression )
subst (
vector_expression,
ring_variable,
poly_expression )
subst (
ideal_expression,
ring_variable,
poly_expression )
subst (
module_expression,
ring_variable,
poly_expression )
Type:
poly, vector, ideal or module (corresponding to the first argument)
Purpose:
substitutes a ring variable by a polynomial.
Example:
ring r=0,(x,y,z),dp; poly f=x2+y2+z2+x+y+z; subst(f,x,3/2); → y2+z2+y+z+15/4 int a=1; subst(f,y,a); → x2+z2+x+z+2 subst(f,y,z); → x2+2z2+x+2z subst(f,y,z+1); → x2+2z2+x+4z+2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
system (
string_expression )
system (
string_expression,
expression )
Type:
depends on the desired function, may be none
Purpose:
interface to internal data and the operating system. The string_expression determines the command to execute. Some commands require an additional argument (second form) where the type of the argument depends on the command. See below for a list of all possible commands.
Note:
Not all functions work on every platform.
Functions:
system("sh"
, string_expression )
shell escape, returns the return code of the shell as int. The string is sent literally to the shell.
system("pid")
returns the process number as int (for creating unique names).
system("uname")
returns a string identifying the architecture for which SINGULAR was compiled.
system("getenv",
string_expression)
returns the value of the shell environment variable given as the second argument. The return type is string.
system("setenv",
string_expression, string_expression)
sets the shell environment variable given as the second argument to the value given as the third argument. Returns the third argument. Might not be available on all platforms.
system("tty")
resets the terminal.
system("version")
returns the version number of SINGULAR as int.
system("contributors")
returns names of people who contributed to the SINGULAR kernel as string.
system("gen")
returns the generating element of the multiplicative group of (Z/p)\{0} (as int) where p is the characteristic of the basering.
system("nblocks")
system("nblocks",
ring_name )
returns the number of blocks of the given ring, or the number of parameters of the current basering, if no second argument is given. The return type is int.
system("Singular")
returns the absolute (path) name of the running SINGULAR as string.
system("
–")
prints the values of all options.
system("
–long_option_name")
returns the value of the (command-line) option long_option_name. The type of the returned value is either string or int. See section Command line options, for more info.
system("
–long_option_name",
expression)
sets the value of the (command-line) option long_option_name to the value given by the expression. Type of the expression must be string, or int. See section Command line options, for more info. Among others, this can be used for setting the seed of the random number generator, the used help browser, the minimal display time, or the timer resolution.
system("browsers");
returns a string about available help browsers. See section The online help system.
Example:
// a listing of the current directory: system("sh","ls"); // execute a shell, return to SINGULAR with exit: system("sh","sh"); string unique_name="/tmp/xx"+string(system("pid")); unique_name; → /tmp/xx4711 system("uname") → ix86-Linux system("getenv","PATH"); → /bin:/usr/bin:/usr/local/bin system("Singular"); → /usr/local/bin/Singular // report value of all options system("--"); → // --batch 0 → // --execute → // --sdb 0 → // --echo 0 → // --help 0 → // --quiet 0 → // --random 937848971 → // --no-tty 0 → // --user-option → // --version 0 → // --allow-net 0 → // --browser → // --emacs 0 → // --no-stdlib 0 → // --no-rc 0 → // --no-warn 0 → // --no-out 0 → // --min-time "0.5" → // --mp-port → // --mp-host → // --ticks-per-sec 1 → // --mp-transp → // --mp-mode // set minimal display time to 0.02 seconds system("--min-time", "0.02"); // set timer resolution to 0.01 seconds system("--ticks-per-sec", 100); // re-seed random number generator system("--random", 12345678); // allow netscape to access HTML pages from the net system("--allow-net", 1); // and set help browser to netscape system("--browser", "netscape");
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
syz (
ideal_expression )
syz (
module_expression )
Type:
module
Purpose:
computes the first syzygy (i.e., the module of relations of the given generators) of the ideal, resp. module.
Example:
ring R=0,(x,y),(c,dp); ideal i=x,y; syz(i); → _[1]=[y,-x]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
trace (
intmat_expression )
trace (
matrix_expression )
Type:
int, if the argument is an intmat, resp.
poly, if the argument is a matrix
Purpose:
returns the trace of an intmat, resp. matrix.
Example:
intmat m[2][2]=1,2,3,4; print(m); → 1 2 → 3 4 trace(m); → 5
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
transpose (
intmat_expression )
transpose (
matrix_expression )
transpose (
module_expression )
Type:
intmat, matrix, or module, corresponding to the argument
Purpose:
transposes a matrix.
Example:
ring R=0,x,dp; matrix m[2][3]=1,2,3,4,5,6; print(m); → 1,2,3, → 4,5,6 print(transpose(m)); → 1,4, → 2,5, → 3,6
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
type
name ;
type (
name );
Type:
none
Purpose:
prints the name, level, type and value of a variable. To display the
value of an expression, it is sufficient to type the expression followed
by ;
.
Example:
int i=3; i; → 3 type(i); → // i [0] int 3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
typeof (
expression )
Type:
string
Purpose:
returns the type of an expression as string.
Returns the type of the first list element if the expression is an expression list.
Possible types are:
"ideal"
,
"int"
,
"intmat"
,
"intvec"
,
"list"
,
"map"
,
"matrix"
,
"module"
,
"number"
,
"none"
,
"poly"
,
"proc"
,
"qring"
,
"resolution"
,
"ring"
,
"string"
,
"vector"
.
For internal use only is the type
"?unknown type?"
.
Example:
int i=9; i; → 9 typeof(_); → int print(i); → 9 typeof(_); → none type i; → // i [0] int 9 typeof(_); → string string s=typeof(i); s; → int typeof(s); → string proc p() { "hello"; return();} p(); → hello typeof(_); → none
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
uressolve (
ideal_expression,
int_expression,
int_expression,
int_expression )
Type:
list
Purpose:
computes all complex roots of a zerodimensional ideal.
Makes either use of the multipolynomial resultant of Macaulay (second argument
= 1), which works only for homogeneous ideals, or uses the sparse resultant
of Gelfand, Kapranov and Zelevinsky (second argument = 0).
The sparse resultant algorithm uses a mixed polyhedral subdivision of the
Minkowsky sum of the Newton polytopes in order to construct the sparse
resultant matrix. Its determinant is a nonzero multiple of the sparse
resultant. The u-resultant of B.L. van der Waerden and Laguerre’s algorithm
are used to determine the complex roots.
The third argument defines the precision of the fractional part if the ground
field is the field of rational numbers, otherwise it will be ignored.
The fourth argument (can be 0, 1 or 2) gives the number of extra runs of
Laguerre’s algorithm (with corrupted roots), leading to better results.
Note:
If the ground field is the field of complex numbers, the elements of the list are of type number, otherwise of type string.
Example:
ring rsc=(real,20,I),(x,y),lp; ideal i=(2+3*I)*x2+(0.35+I*45.0e-2)*y2-8,x2+xy+(42.7)*y2; list l=uressolve(i,0,0,2); l[1]; → [1]: → (-1.315392899374542198+I*0.70468233142752928117) → [2]: → (0.12292646536251281054+I*0.19245727404407015049) subst(subst(i[1],x,l[1][1]),y,l[1][2]); → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
vandermonde (
ideal_expression,
ideal_expression,
int_expression )
Type:
poly
Purpose:
Note:
Example:
ring r=0,(x,y),dp; // determine f with deg(f)=2 and with given values v of f // at 9 points: (2,3)^0=(1,1),...,(2,3)^8=(2^8,3^8) // valuation point: (2,3) ideal p=2,3; ideal v=1,2,3,4,5,6,7,8,9; poly ip=vandermonde(p,v,2); ip[1..5]; // the 5 first terms of ip: → -1/9797760x2y2-595/85536x2y+55/396576xy2+935/384x2-1309/3240xy // compute value of ip at the point 2^8,3^8, result must be 9 subst(subst(ip,x,2^8),y,3^8); → 9
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
var (
int_expression )
Type:
poly
Purpose:
var(n)
returns the n-th ring variable.
Example:
ring r=0,(x,y,z),dp; var(2); → y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
varstr (
ring_name )
varstr (
int_expression )
varstr (
ring_name,
int_expression )
Type:
string
Purpose:
returns the list of the names of the ring variables as a string
or the name of the n-th ring variable, where n is given by the
int_expression.
If the ring name is omitted, the basering is used, thus
varstr(n)
is equivalent to varstr(basering,n)
.
Example:
ring r=0,(x,y,z),dp; varstr(r); → x,y,z varstr(r,1); → x varstr(2); → y
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
vdim (
ideal_expression )
vdim (
module_expression )
Type:
int
Purpose:
computes the vector space dimension of the ring, resp. free module,
modulo the ideal, resp. module,
generated by the initial terms of the given generators.
If the generators form a standard basis,
this is the same as the vector space dimension of the ring, resp.
free module, modulo the ideal, resp. module.
If the ideal, resp. module, is not zero-dimensional, -1 is returned.
Example:
ring r=0,(x,y),ds; ideal i=x2+y2,x2-y2; ideal j=std(i); vdim(j); → 4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
wedge (
matrix_expression,
int_expression )
Type:
matrix
Purpose:
wedge(M,n)
computes the n
-th exterior power of the matrix
M
.
Example:
ring r; matrix m[2][3]=x,y,y,z,z,x; print(m); → x,y,y, → z,z,x print(wedge(m,2)); → xz-yz,-x2+yz,xy-yz
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
weight (
ideal_expression )
weight (
module_expression )
Type:
intvec
Purpose:
computes an "optimal" weight vector for an ideal, resp. module, which may be used as weight vector for the variables in order to speed up the standard basis algorithm. If the input is weighted homogeneous, a weight vector for which the input is weighted homogeneous is found.
Example:
ring h1=32003,(t,x,y,z),dp; ideal i= 9x8+y7t3z4+5x4y2t2+2xy2z3t2, 9y8+7xy6t+2x5y4t2+2x2yz3t2, 9z8+3x2y3z2t4; intvec e=weight(i); e; → 5,7,5,7 ring r=32003,(a,b,c,d),wp(e); map f=h1,a,b,c,d; ideal i0=std(f(i));
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
write (
link_expression,
expression_list )
for DBM links:
write (
link,
string_expression,
string_expression )
write (
link,
string_expression )
Type:
none
Purpose:
writes data to a link.
If the link is of type ASCII
, all expressions are converted to
strings (and separated by a newline character) before they are
written. As a consequence, only such values which can be converted to a
string can be written to an ASCII
link.
For MP links,
ring-dependent expressions are written together with a ring
description. To prevent an evaluation of the expression before it is
written, the quote
command (possibly together with eval
)
can be used. A write
blocks (i.e., does not return to the prompt),
as long as a MPtcp link is not ready for writing.
For DBM links, write
with three arguments inserts the first
string as key and the second string as value into the dbm data
base.
Called with two arguments, it deletes the entry with the key
specified by the string from the data base.
Example:
// write the values of the variables f and i as strings into // the file "outfile" (overwrite it, if it exists) write(":w outfile",f,i); // now append the string "that was f,i" (without the quotes) // at the end of the file "outfile" write(":a outfile","that was f,i"); // alternatively, links could be used: link l=":a outfile"; l; // type : ASCII // mode : a // name : outfile // open : no // read : not ready // write: not ready write(l," that was f,i"); // saving and retrieving data (ASCII format): ring r=32003,(x,y,z),dp; ideal i=x+y,z3+22y; write(":w save_i",i);// this writes x+y,z3+22y to the file save_i ring r=32003,(x,y,z),dp; string s=read("save_i"); //creates the string x+y,z3+22y execute("ideal k="+s+";"); // this defines an ideal k which // is equal to i. // for large objects, the MP format and MPfile links are better: write("MPfile:w save_i.mp",i); def j=read("MPfile:r save_i.mp");
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.2.1 break | ||
5.2.2 breakpoint | ||
5.2.3 continue | ||
5.2.4 else | ||
5.2.5 export | ||
5.2.6 for | ||
5.2.7 if | ||
5.2.8 keepring | ||
5.2.9 quit | ||
5.2.10 return | ||
5.2.11 while | ||
5.2.12 ~ (break point) |
A sequence of commands surrounded by curly brackets ({
and
}
) is a so called block. Blocks are used in SINGULAR in
order to define procedures and to collect commands belonging to
if
, else
, for
and while
statements and to the
example
part in libraries. Even if
the sequence of statements consists of only a single command it has to be
surrounded by curly brackets!
Variables which are defined inside a block
are not local to that block. Note that there is no ending semicolon at
the end of the block.
Example:
if ( i>j ) { // This is the block int temp; temp=i; i=j; j=temp; kill temp; }
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
break;
Purpose:
leaves the innermost for
or while
block.
Example:
while (1) { … if ( … ) { break; // leave the while block } }
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
breakpoint(
proc_name );
breakpoint(
proc_name,
line_no );
Purpose:
sets a breakpoint at the beginning of the specified procedure or
at the given line.
Note: Line number 1 is the first line of a library (for
procedures from libraries), resp. the line with the {
.
A line number of -1 removes all breakpoint from that procedure.
Example:
breakpoint(groebner); → breakpoint 1, at line 163 in groebner breakpoint(groebner, 176); → breakpoint 2, at line 176 in groebner breakpoint(groebner, -1); → breakpoints in groebner deleted(0x6)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
continue;
Purpose:
skips the rest of the innermost for
or while
loop und jumps
to the beginning of the block. This command is only valid inside a
for
or a while
construction.
Note:
Unlike the C-construct it does not execute the increment statement.
The command continue
is mainly for internal use.
Example:
for (int i = 1 ; i<=10; i=i+1) { … if (i==3) { i=8;continue; } // skip the rest if i is 3 and // continue with the next i: 8 i; } → 1 → 2 → 8 → 9 → 10
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
if (
boolean_expression )
true_block else
false_block
Purpose:
executes false_block if the boolean_expression of the if
statement
is false. This command is only valid in combination with an if
command.
Example:
int i=3; if (i > 5) { "i is bigger than 5"; } else { "i is smaller than 6"; } → i is smaller than 6
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
export
name ;
export
list_of_names ;
Purpose:
converts a local variable of a procedure to a global one.
Note:
Objects defined in a ring are not automatically exported
when exporting the ring (use keepring
instead).
Example:
proc p1 { int i,j; export(i); intmat m; listvar(); export(m); } p1(); → // m [1] intmat 1 x 1 → // j [1] int 0 → // i [0] int 0 listvar(); → // m [0] intmat 1 x 1 → // i [0] int 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
for (
init_command;
boolean_expression;
iterate_commands)
block
Purpose:
repetitive, conditional execution of a command block.
The command init_command is executed first. Then boolean_expression is
evaluated. If its value is TRUE the block is executed, otherwise the
for
statement is complete. After each execution of the block, the
command iterate_command is executed and boolean_expression is
evaluated. This is repeated until boolean_expression evaluates to FALSE.
The command break;
leaves the innermost for
construct.
Example:
// sum of 1 to 10: int s=0; for (int i=1; i<=10; i=i+1) { s=s+i; } s; → 55
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
if (
boolean_expression )
true_block
if (
boolean_expression )
true_block else
false_block
Purpose:
executes true_block if the boolean condition is true. If the if
statement is followed by an else
statement and the boolean
condition is false, then false_block is executed.
Example:
int i = 9; matrix m[i][i]; if (i > 5 and typeof(m) == "matrix") { m[i][i] = i; }
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
keepring
name ;
Purpose:
moves the specified ring to the next (upper) level. This command can only
be used inside of procedures and it should be the last command before the
return
statement. There it provides the possibility to keep
a ring which is local to the procedure (and its objects) accessible after
the procedure ended without making the ring global.
Example:
proc P1 { ring r=0,x,dp; keepring r; } proc P2 { "inside P2: " + nameof(basering); P1(); "inside P2, after call of P1: " + nameof(basering); } ring r1= 0,y,dp; P2(); → inside P2: r1 → inside P2, after call of P1: r "at top level: " + nameof(basering); → at top level: r1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
quit;
Purpose:
quits SINGULAR;
works also from inside a procedure. The commands quit
and
exit
are synonymous.
Example:
quit;
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
return (
expression_list );
return ();
Type:
any
Purpose:
returns the result(s) of a procedure and can only be used inside a procedure. Note that the brackets are required even if no return value is given.
Example:
proc p2 { int i,j; for(i=1;i<=10;i++) { j=j+i; } return(j); } // can also return an expression list, i.e., more than one value proc tworeturn () { return (1,2); } int i,j = tworeturn(); // return type may even depend on the input proc type_return (int i) { if (i > 0) {return (i);} else {return (list(i));} } // then we need def type (or list) to collect value def t1 = type_return(1); def t2 = type_return(-1);
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
while (
boolean_expression)
block
Purpose:
repetitive, conditional execution of block.
The boolean_expression is evaluated and if its value is TRUE, the
block gets executed. This is repeated until boolean_expression evaluates
to FALSE. The command break
leaves the innermost while
construction.
Example:
int i = 9; while (i>0) { // … // do something for i=9, 8, ..., 1 i = i - 1; } while (1) { // … // do something forever if (i == -5) // but leave the loop if i is -5 { break; } }
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Syntax:
~;
Purpose:
sets a break point. Whenever SINGULAR reaches the command ~;
in a sequence of commands it prompts for input. The user may now input
lines of SINGULAR commands. The line length cannot exceed 80
characters.
SINGULAR proceeds with the execution of the command following ~;
as soon as it receives an empty line.
Example:
proc t { int i=2; ~; return(i+1); } t(); → -- break point in t -- → -- 0: called from STDIN -- // here local variables of the procedure can be accessed i; → 2 → -- break point in t -- → 3
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.3.1 degBound | ||
5.3.2 echo | ||
5.3.3 minpoly | ||
5.3.4 multBound | ||
5.3.5 noether | ||
5.3.6 printlevel | ||
5.3.7 short | ||
5.3.8 timer | ||
5.3.9 TRACE | ||
5.3.10 rtimer | ||
5.3.11 voice |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
The standard basis computation is stopped if the total
(weighted) degree
exceeds degBound
.
degBound
should not be used for a global ordering with inhomogeneous
input.
Reset this bound by setting degBound
to 0.
Example:
degBound = 7; option(); → //options for 'std'-command: degBound ideal j=std(i); degBound; → 7 degBound = 0; //resets degree bound to infinity
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
input is echoed if echo
>= voice
.
echo
is a local setting for a procedure and defaulted to 0.
echo
does not affect the output of commands.
Example:
echo = 1; int i = echo; → int i = echo;
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
number
Purpose:
describes the coefficient field of the current basering as
an algebraic extension with the minimal polynomial equal to minpoly
.
Setting the minpoly
should be the first command after
defining the ring.
Note:
The minimal polynomial has to be specified in the syntax of a polynomial.
Its variable is not one of the ring variables, but the algebraic element
which is being adjoined to the field.
Algebraic extensions in SINGULAR are only possible over the rational
numbers or over Z/p, p a prime number.
SINGULAR does not check whether the given
polynomial is irreducible! It can be checked in advance with the
function factorize
(see section factorize).
Example:
//(Q[i]/(i^2+1))[x,y,z]: ring Cxyz=(0,i),(x,y,z),dp; minpoly=i^2+1; i2; //this is a number, not a poly → -1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
The standard basis computation is stopped if the ideal is
zero-dimensional in a ring with local ordering
and its multiplicity (mult
) is lower than multBound
.
Reset this bound by setting multBound
to 0.
Example:
multBound = 20; option(); → //options for 'std'-command: multBound ideal j=std(i); multBound; → 20 multBound = 0; //disables multBound
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
poly
Purpose:
The standard basis computation in local rings
cuts off all monomials above
(in the sense of the monomial ordering)
the monomial noether
during the computation.
Reset noether
by setting noether
to 0.
Example:
ring R=32003,(x,y,z),ds; ideal i=x2+y12,y13; std(i); → _[1]=x2+y12 → _[2]=y13 noether=x11; std(i); → _[1]=x2 noether=0; //disables noether
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
sets the debug level for dbprint
.
If printlevel
>= voice
then dbprint
is equivalent to
print
, otherwise nothing is printed.
Note:
See section Procedures in a library, for a small example about how this is used for the display of comments while procedures are executed.
Example:
voice; → 1 printlevel=0; dbprint(1); printlevel=voice; dbprint(1); → 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
the output of monomials is done in the short manner,
if short
is non-zero. A C-like notion is used, if short is zero.
Both notations may be used as input.
The default depends on the names of the ring variables
(0 if there are names of variables longer than 1 character, 1 otherwise). Every
change of the basering sets short
to the previous value for
that ring. In other words, the value of the variable short
is
"ring-local".
Example:
ring r=23,x,dp; int save=short; short=1; 2x2,x2; → 2x2 x2 short=0; 2x2,x2; → 2*x^2 x^2 short=save; //resets short to the previous value
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
printlevel+1 >= voice
(which is by default true on the
SINGULAR top level, but not true while procedures are executed).
The default setting of timer
is 0, the default minimal time is
0.5 seconds, and the default timer resolution is 1 (i.e., the default unit
of time is one second). The minimal time and timer resolution
can be set using the command line options --min-time
and
--ticks-per-sec
and can be checked using
system("--min-time")
and system("--ticks-per-sec")
.
How to use timer
in order to measure the time for a sequence of
commands, see example below.
Note for Windows95/98:
The value of the timer
cannot be used (resp. trusted) when
SINGULAR is run under Windows95/98 (this is due to the shortcomings
of the Windows95/98 operating system). Use rtimer, instead.
Example:
timer=1; // The time of each command is printed int t=timer; // initialize t by timer ring r=0,(x,y,z),dp; poly p=(x+2y+3z+4xy+5xz+6yz)^20; // timer as int_expression: t=timer-t; t; // yields the time in ticks-per-sec (default 1) → 0 // since t was initialized by timer int tps=system("--ticks-per-sec"); t/tps; // yields the time in seconds truncated to int → 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
sets level of debugging.
TRACE=0
no debugging messages are printed.
TRACE=1
messages about entering and leaving of procedures are displayed.
TRACE=3
messages about entering and leaving of procedures together with line numbers are displayed.
TRACE=4
each line is echoed and the interpretation of commands
in this line is suspended until the user presses RETURN
.
TRACE
is defaulted to 0.
TRACE
does not affect the output of commands.
Example:
TRACE=1; LIB "general.lib"; sum(1..100); → entering sum (level 0) → leaving sum (level 0) → 5050
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
identical to timer
(see section timer), except that real times (i.e.,
wall-clock) times are reported, instead of CPU times. This can be
trusted on all operating systems (including Windows95/98).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Type:
int
Purpose:
shows the nesting level of procedures.
Note:
See section Guidelines for writing a library, for an small example how this is used for the display of comments while procedures are executed.
Example:
voice; → 1 proc p { voice; }; p(); → 2
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on a sunny day using texi2any.