source: git/Tst/BuchDL/Ex_L1.tst @ e1b6326

spielwiese
Last change on this file since e1b6326 was 9558c5f, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes/lossen: very long examples from DL-Book git-svn-id: file:///usr/local/Singular/svn/trunk@8762 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 KB
Line 
1LIB "tst.lib";
2tst_init();
3
4
5//======================  Example 1.19 =============================
6ring R = 0, (w,x,y,z), dp;
7ideal I = xz-y2, wz-xy, wy-x2;
8I;
9//->    I[1]=-y2+xz
10//->    I[2]=-xy+wz
11//->    I[3]=-x2+wy
12
13resolution fI = mres(I,0);
14fI;
15//->     1      3      2     
16//->    R <--  R <--  R
17//->    0      1      2 
18
19print(fI[1]);   // the first syzygy matrix of R/I
20//->    y2-xz,             
21//->    xy-wz,
22//->    x2-wy
23
24print(fI[2]);   // the second syzygy matrix of R/I
25//->    x, w,
26//->    -y,-x,
27//->    z, y 
28
29print(betti(fI),"betti");   // the Betti diagram
30                            // (see the remark below)
31//->               0     1     2
32//->    ------------------------
33//->        0:     1     -     -
34//->        1:     -     3     2
35//->    ------------------------
36//->    total:     1     3     2
37
38
39//==================  continued in Example 1.26 ====================
40ideal GI = groebner(I);
41hilb(GI);
42//->    //         1 t^0
43//->    //        -3 t^2
44//->    //         2 t^3
45//->
46//->    //         1 t^0
47//->    //         2 t^1
48//->    // dimension (proj.)  = 1
49//->    // degree      = 3
50
51intvec co1 = hilb(GI,1);
52co1;
53//->    1,0,-3,2,0
54intvec co2 = hilb(GI,2);
55co2;
56//->    1,2,0
57
58proc displayHilbPoly(ideal G)
59"USAGE:  displayHilbPoly(G), G of type ideal
60ASSUME:  G must be a homogeneous Groebner basis for an ideal of the
61         active ring in the SINGULAR session; say, G generates the
62         homogeneous ideal I of R.
63RETURN:  None.
64NOTE:    Displays the Hilbert polynomial of R/I.
65"
66{
67  int d = dim(G)-1;       // degree of Hibert polynomial
68  intvec co = hilb(G,2);  // representation II of Hilbert series
69  int s = size(co)-1;     // s = deg(Q_M) +1
70  ring Qt = 0, t, dp;     // change active ring to Q[t]
71  poly QM = 0;
72  for (int i=1; i<=s; i=i+1)
73  {
74    QM = QM+co[i]*t^(i-1);
75  }
76  poly QMi = QM;          // the polynomial Q_M(t)
77  int ifac = 1;
78  list a;
79  for (i=1; i<=d+1; i=i+1)
80  {
81    a = insert(a, subst(QMi,t,1)/ifac, i-1);
82    QMi = diff((QMi),t);
83    ifac = ifac*i;
84  }
85  poly PM = (-1)^(d)*a[d+1];
86  poly bin = 1;
87  for (i=1; i<=d; i=i+1)
88  {
89    bin = bin*(t+i)/i;    // compute binomial coeff. by recursion
90    PM = PM+(-1)^(d-i)*a[d+1-i]*bin;
91  }
92  print(PM);
93}
94
95
96displayHilbPoly(GI);
97//->    3t+1
98
99
100kill R,co1,co2;
101//======================  Example 1.39 (New Session) ======================
102ring R = 0, (x,y), dp;       
103ideal I = x2y-y3, x3;
104poly f = x3y+x3;
105reduce(f,I,1);
106//->    // ** I is no standard basis
107//->    xy3+x3
108
109reduce(f,I);         
110//->    // ** I is no standard basis
111//->    xy3
112
113ideal GI = groebner(I);
114GI;
115//->    GI[1]=x2y-y3
116//->    GI[2]=x3
117//->    GI[3]=xy3
118//->    GI[4]=y5
119reduce(f,GI);     
120//->    0         
121
122tst_status(1);$
123
Note: See TracBrowser for help on using the repository browser.