Top
Back: Programming
Forward: Writing procedures and libraries
FastBack: Examples
FastForward: Computing Groebner and Standard Bases
Up: Programming
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

A.1.1 Basic programming

We show in the example below the following:

  • define the ring R of characteristic 32003, variables x,y,z, monomial ordering dp (implementing F_32003[x,y,z])
  • list the information about R by typing its name
  • check the order of the variables
  • define the integers a,b,c,t
  • define a polynomial f (depending on a,b,c,t) and display it
  • define the jacobian ideal i of f
  • compute a Groebner basis of i
  • compute the dimension of the algebraic set defined by i (requires the computation of a Groebner basis)
  • create and display a string in order to comment the result (text between quotes " "; is a 'string')
  • load a library (see primdec_lib)
  • compute a primary decomposition for i and assign the result to a list L (which is a list of lists of ideals)
  • display the number of primary components and the first primary and prime components (entries of the list L[1])
  • implement the localization of F_32003[x,y,z] at the homogeneous maximal ideal (generated by x,y,z) by defining a ring with local monomial ordering (ds in place of dp)
  • map i to this ring (see imap) - we may use the same name i, since ideals are ring dependent data
  • compute the local dimension of the algebraic set defined by i at the origin (= dimension of the ideal generated by i in the localization)
  • compute the local dimension of the algebraic set defined by i at the point (-2000,-6961,-7944) (by applying a linear coordinate transformation)
For a more basic introduction to programming in SINGULAR, we refer to Getting started.

 
ring R = 32003,(x,y,z),dp;
R;
==> // coefficients: ZZ/32003
==> // number of vars : 3
==> //        block   1 : ordering dp
==> //                  : names    x y z
==> //        block   2 : ordering C
x > y;
==> 1
y > z;
==> 1
int a,b,c,t = 1,2,-1,4;
poly f = a*x3+b*xy3-c*xz3+t*xy2z2;
f;
==> 4xy2z2+2xy3+xz3+x3
ideal i = jacob(f);    // Jacobian Ideal of f
ideal si = std(i);     // compute Groebner basis
int dimi = dim(si);
string s = "The dimension of V(i) is "+string(dimi)+".";
s;
==> The dimension of V(i) is 1.
LIB "primdec.lib";     // load library primdec.lib
list L = primdecGTZ(i);
size(L);               // number of prime components
==> 6
L[1][1];               // first primary component
==> _[1]=2y2z2+y3-16001z3
==> _[2]=x
L[1][2];               // corresponding prime component
==> _[1]=2y2z2+y3-16001z3
==> _[2]=x
ring Rloc = 32003,(x,y,z),ds;   // ds = local monomial ordering
ideal i = imap(R,i);
dim(std(i));
==> 1
map phi = R, x-2000, y-6961, z-7944;
dim(std(phi(i)));
==> 0


Top Back: Programming Forward: Writing procedures and libraries FastBack: Examples FastForward: Computing Groebner and Standard Bases Up: Programming Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.3.1, 2022, generated by texi2html.