1 | LIB "tst.lib"; |
---|
2 | tst_init(); |
---|
3 | |
---|
4 | |
---|
5 | //====================== Example 2.28 ============================= |
---|
6 | //================== Output depends on random ====================== |
---|
7 | ring R = 0, x(0..3), dp; |
---|
8 | matrix A[4][1] = x(0),x(1),0,0; |
---|
9 | LIB "random.lib"; // loads other libraries incl. matrix.lib |
---|
10 | // and elim.lib, too |
---|
11 | matrix B = randommat(4,2,maxideal(1),100); |
---|
12 | |
---|
13 | |
---|
14 | matrix M = concat(B,A); // from matrix.lib |
---|
15 | print(M); |
---|
16 | |
---|
17 | ideal I = minor(M,3); |
---|
18 | ideal GI = groebner(I); |
---|
19 | int codimI = nvars(R)-dim(GI); |
---|
20 | codimI; |
---|
21 | //-> 2 |
---|
22 | |
---|
23 | ideal singI = groebner(minor(jacob(GI),codimI) + I); |
---|
24 | nvars(R) - dim(singI); |
---|
25 | //-> 3 |
---|
26 | |
---|
27 | print(betti(singI,0),"betti"); |
---|
28 | //-> 0 1 |
---|
29 | //-> ------------------ |
---|
30 | //-> 0: 1 - |
---|
31 | //-> 1: - - |
---|
32 | //-> 2: - 4 |
---|
33 | //-> 3: - 20 |
---|
34 | //-> ------------------ |
---|
35 | //-> total: 1 24 |
---|
36 | |
---|
37 | ideal singI_sat = sat(singI,maxideal(1))[1]; // from elim.lib |
---|
38 | print(betti(singI_sat,0),"betti"); |
---|
39 | //-> 0 1 |
---|
40 | //-> ------------------ |
---|
41 | //-> 0: 1 2 |
---|
42 | //-> 1: - 1 |
---|
43 | //-> ------------------ |
---|
44 | //-> total: 1 3 |
---|
45 | |
---|
46 | singI_sat; |
---|
47 | //-> singI_sat[1]=x(1) |
---|
48 | //-> singI_sat[2]=x(0) |
---|
49 | //-> singI_sat[3]=3297*x(2)^2-2680*x(2)*x(3)-5023*x(3)^2 |
---|
50 | |
---|
51 | ideal IL = x(0),x(1); |
---|
52 | reduce(I,groebner(IL),1); |
---|
53 | //-> _[1]=0 |
---|
54 | //-> _[2]=0 |
---|
55 | //-> _[3]=0 |
---|
56 | //-> _[4]=0 |
---|
57 | |
---|
58 | ideal I' = sat(I,IL)[1]; // result is Groebner basis |
---|
59 | |
---|
60 | degree(GI); |
---|
61 | //-> // dimension (proj.) = 1 |
---|
62 | //-> // degree (proj.) = 6 |
---|
63 | |
---|
64 | degree(I'); |
---|
65 | //-> // dimension (proj.) = 1 |
---|
66 | //-> // degree (proj.) = 5 |
---|
67 | |
---|
68 | int codimI' = nvars(R)-dim(I'); |
---|
69 | ideal singI' = minor(jacob(I'),codimI') + I'; |
---|
70 | nvars(R) - dim(groebner(singI')); |
---|
71 | //-> 4 |
---|
72 | |
---|
73 | |
---|
74 | kill R,codimI,codimI'; |
---|
75 | //================== Example 2.33 (New Session) ========================= |
---|
76 | ring P1P3 = 0, (s,t,w,x,y,z), (dp(2),dp); |
---|
77 | ideal J = w-s3, x-s2t, y-st2, z-t3; |
---|
78 | J = groebner(J); |
---|
79 | J; |
---|
80 | //-> J[1]=y2-xz |
---|
81 | //-> J[2]=xy-wz |
---|
82 | //-> J[3]=x2-wy |
---|
83 | //-> J[4]=sz-ty |
---|
84 | //-> [...] |
---|
85 | //-> J[10]=s3-w |
---|
86 | |
---|
87 | ring P1 = 0, (s,t), dp; |
---|
88 | ideal ZERO; |
---|
89 | ideal PARA = s3, s2t, st2, t3; |
---|
90 | ring P3 = 0, (w,x,y,z), dp; |
---|
91 | ideal IC = preimage(P1,PARA,ZERO); |
---|
92 | print(IC); |
---|
93 | //-> y2-xz, |
---|
94 | //-> xy-wz, |
---|
95 | //-> x2-wy |
---|
96 | |
---|
97 | ideal P = w-y, x, z; |
---|
98 | size(reduce(IC,groebner(P),1)); // ideal membership test |
---|
99 | //-> 2 |
---|
100 | |
---|
101 | ring P2 = 0, (a,b,c), dp; |
---|
102 | ideal PIC = preimage(P3,P,IC); |
---|
103 | PIC; |
---|
104 | //-> PIC[1]=b3-a2c-2b2c+bc2 |
---|
105 | |
---|
106 | setring P3; |
---|
107 | ideal Q = w, y, z; |
---|
108 | size(reduce(IC,groebner(Q),1)); // check: Q not on C |
---|
109 | //-> 1 |
---|
110 | setring P2; |
---|
111 | ideal QIC = preimage(P3,Q,IC); |
---|
112 | QIC; |
---|
113 | //-> QIC[1]=b3-ac2 |
---|
114 | |
---|
115 | |
---|
116 | kill P1,P3,P1P3,P2; |
---|
117 | //================== Example 2.34 (New Session) ========================= |
---|
118 | ring S2 = 0, x(1..3), dp; |
---|
119 | ideal SPHERE = x(1)^2+x(2)^2+x(3)^2-1; |
---|
120 | ideal MAP = x(1)*x(2), x(1)*x(3), x(2)*x(3); |
---|
121 | ring R3 = 0, y(1..3), dp; |
---|
122 | ideal ST = preimage(S2, MAP, SPHERE); |
---|
123 | print(ST); |
---|
124 | //-> y(1)^2*y(2)^2+y(1)^2*y(3)^2+y(2)^2*y(3)^2-y(1)*y(2)*y(3) |
---|
125 | |
---|
126 | |
---|
127 | |
---|
128 | tst_status(1);$ |
---|
129 | |
---|