1 | ////////////////////////////////////////////////////////////////////////////// |
---|
2 | version="$Id: ratgb.lib,v 1.4 2007-07-11 20:20:54 levandov Exp $"; |
---|
3 | category="Noncommutative"; |
---|
4 | info=" |
---|
5 | LIBRARY: ratgb.lib Groebner bases in Ore localizations |
---|
6 | AUTHOR: Viktor Levandovskyy, levandov@risc.uni-linz.ac.at |
---|
7 | |
---|
8 | PROCEDURES: |
---|
9 | ratstd(ideal I, int n); compute Groebner basis in Ore localization of the basering wrt first n variables |
---|
10 | |
---|
11 | SUPPORT: SpezialForschungsBereich F1301 of the Austrian FWF |
---|
12 | " |
---|
13 | |
---|
14 | proc ratstd(ideal I, int is) |
---|
15 | "USAGE: ratstd(I, n); I an ideal, n an integer |
---|
16 | RETURN: ring |
---|
17 | PURPOSE: compute the Groebner basis of I in the Ore localization of |
---|
18 | the basering with respect to the subalgebra, generated by first n variables |
---|
19 | ASSUME: the variables are organized in two blocks and |
---|
20 | @* the first block of length n contains the elements |
---|
21 | @* with respect to which one localizes, |
---|
22 | @* the basering is equipped with the elimination ordering |
---|
23 | @* for the variables in the second block |
---|
24 | NOTE: the output ring O is commutative. The ideal rGBid in O |
---|
25 | represents the rational form of the output ideal pGBid in the basering. |
---|
26 | @* During the computation, the D-dimension of I and the corresponding |
---|
27 | vector space D-dimension of I are computed and printed out. |
---|
28 | EXAMPLE: example ratstd; shows examples |
---|
29 | " |
---|
30 | { |
---|
31 | // 0. do the subst's /reformulations |
---|
32 | // for the time being, ASSUME |
---|
33 | // the ord. is an elim. ord. for D |
---|
34 | // and the block of X's is on the left |
---|
35 | // its length is 'is' |
---|
36 | |
---|
37 | // 1. compute G = GB(I) wrt. the elim. ord. for D |
---|
38 | |
---|
39 | option(redSB); |
---|
40 | option(redTail); |
---|
41 | ideal G = groebner(I); // although slimgb looks better |
---|
42 | G = simplify(G,2); // to be sure there are no 0's |
---|
43 | int sG = ncols(G); |
---|
44 | // 2. create L(G) with X's as coeffs |
---|
45 | |
---|
46 | ideal LG; |
---|
47 | int i,j,k; |
---|
48 | for (i=1; i<= sG; i++) |
---|
49 | { |
---|
50 | LG[i] = lead(G[i]); |
---|
51 | } |
---|
52 | |
---|
53 | // 3. create K(x)[D], commutative |
---|
54 | def save = basering; |
---|
55 | list L = ringlist(save); |
---|
56 | list RL, tmp1,tmp2,tmp3,tmp4; |
---|
57 | intvec iv; |
---|
58 | // copy: field, enlarge it with Xs |
---|
59 | |
---|
60 | if ( size(L[1]) == 0) |
---|
61 | { |
---|
62 | // i.e. the field with char only |
---|
63 | tmp2[1] = L[1]; |
---|
64 | // tmp1 = L[2]; |
---|
65 | j = size(L[2]); |
---|
66 | iv = 1; |
---|
67 | for (i=1; i<=is; i++) |
---|
68 | { |
---|
69 | tmp1[i] = L[2][i]; |
---|
70 | iv = iv,1; |
---|
71 | } |
---|
72 | iv = iv[1..size(iv)-1]; //extra 1 |
---|
73 | tmp2[2] = tmp1; |
---|
74 | tmp3[1] = "lp"; |
---|
75 | tmp3[2] = iv; |
---|
76 | // tmp2[3] = 0; |
---|
77 | tmp4[1] = tmp3; |
---|
78 | tmp2[3] = tmp4; |
---|
79 | //[1] = "lp"; |
---|
80 | // tmp2[3][2] = iv; |
---|
81 | tmp2[4] = ideal(0); |
---|
82 | RL[1] = tmp2; |
---|
83 | } |
---|
84 | |
---|
85 | if ( size(L[1]) >0 ) |
---|
86 | { |
---|
87 | // TODO!!!!! |
---|
88 | tmp2[1] = L[1][1]; //char K |
---|
89 | // there are parameters |
---|
90 | // add to them X's, IGNORE alg.extension |
---|
91 | // the ordering on pars |
---|
92 | tmp1 = L[1][2]; // param names |
---|
93 | j = size(tmp1); |
---|
94 | iv = L[1][3][1][2]; |
---|
95 | for (i=1; i<=is; i++) |
---|
96 | { |
---|
97 | tmp1[j+i] = L[2][i]; |
---|
98 | iv = iv,1; |
---|
99 | } |
---|
100 | tmp2[2] = tmp1; |
---|
101 | tmp2[3] = L[1][3]; |
---|
102 | tmp2[3][1][2] = iv; |
---|
103 | tmp2[4] = ideal(0); |
---|
104 | RL[1] = tmp2; |
---|
105 | } |
---|
106 | |
---|
107 | // vars: leave only D's |
---|
108 | kill tmp1; list tmp1; |
---|
109 | // tmp1 = L[2]; |
---|
110 | for (i=is+1; i<= size(L[2]); i++) |
---|
111 | { |
---|
112 | tmp1[i-is] = L[2][i]; |
---|
113 | } |
---|
114 | RL[2] = tmp1; |
---|
115 | |
---|
116 | // assume the ordering is the block with (a(0:is),ORD) |
---|
117 | // set up ORD as the ordering |
---|
118 | // L; "RL:"; RL; |
---|
119 | if (size(L[3]) != 3) |
---|
120 | { |
---|
121 | "note: strange ordering\n"; |
---|
122 | } |
---|
123 | kill tmp2; list tmp2; |
---|
124 | tmp2[1] = L[3][2]; |
---|
125 | tmp2[2] = L[3][3]; |
---|
126 | RL[3] = tmp2; |
---|
127 | |
---|
128 | // factor ideal is ignored |
---|
129 | RL[4] = ideal(0); |
---|
130 | |
---|
131 | // RL; |
---|
132 | |
---|
133 | // 3. map L(G) to K(X)[D] |
---|
134 | |
---|
135 | def @RAT = ring(RL); |
---|
136 | setring @RAT; |
---|
137 | |
---|
138 | ideal LG = imap(save, LG); |
---|
139 | // do not do groebner at this place, |
---|
140 | // it may cause misordering! |
---|
141 | |
---|
142 | // 4. run simplify |
---|
143 | |
---|
144 | ideal SLG = simplify(LG,8+32); //contains zeros |
---|
145 | intvec islg; |
---|
146 | if (SLG[1] == 0) |
---|
147 | { islg = 0; } |
---|
148 | else |
---|
149 | { islg = 1; } |
---|
150 | for (i=2; i<= ncols(SLG); i++) |
---|
151 | { |
---|
152 | if (SLG[i] == 0) |
---|
153 | { |
---|
154 | islg = islg, 0; |
---|
155 | } |
---|
156 | else |
---|
157 | { |
---|
158 | islg = islg, 1; |
---|
159 | } |
---|
160 | } |
---|
161 | |
---|
162 | // compute the D-dimension of the ideal |
---|
163 | |
---|
164 | LG = groebner(LG); // cosmetics |
---|
165 | int d = dim(LG); |
---|
166 | int Ddim = d; |
---|
167 | printf("the D-dimension is %s",d); |
---|
168 | if (d==0) |
---|
169 | { |
---|
170 | d = vdim(LG); |
---|
171 | int Dvdim = d; |
---|
172 | printf("the K-dimension is %s",d); |
---|
173 | } |
---|
174 | setring save; |
---|
175 | for (i=1; i<= ncols(LG); i++) |
---|
176 | { |
---|
177 | if (islg[i] == 0) |
---|
178 | { |
---|
179 | G[i] = 0; |
---|
180 | } |
---|
181 | } |
---|
182 | G = simplify(G,2); // ready! |
---|
183 | // return the result |
---|
184 | ideal pGBid = G; |
---|
185 | export pGBid; |
---|
186 | // export Ddim; |
---|
187 | // export Dvdim; |
---|
188 | setring @RAT; |
---|
189 | ideal rGBid = imap(save,G); |
---|
190 | export rGBid; |
---|
191 | setring save; |
---|
192 | return(@RAT); |
---|
193 | // kill @RAT; |
---|
194 | // return(G); |
---|
195 | } |
---|
196 | example |
---|
197 | { |
---|
198 | "EXAMPLE:"; echo = 2; |
---|
199 | ring r = 0,(k,n,K,N),(a(0,0,1,1),dp); |
---|
200 | matrix D[4][4]; |
---|
201 | D[1,3] = K; |
---|
202 | D[2,4] = N; |
---|
203 | ncalgebra(1,D); |
---|
204 | ideal I = (k+1)*K - (n-k), (n-k+1)*N - (n+1); |
---|
205 | int is = 2; |
---|
206 | def A = ratstd(I,is); |
---|
207 | pGBid; // polynomial form |
---|
208 | setring A; |
---|
209 | rGBid; // rational form |
---|
210 | } |
---|
211 | |
---|
212 | static proc exParam() |
---|
213 | { |
---|
214 | // Appel F4 |
---|
215 | ring r = (0,a,b,c,d),(x,y,Dx,Dy),(a(0,0,1,1),dp); |
---|
216 | matrix @D[4][4]; |
---|
217 | @D[1,3]=1; @D[2,4]=1; |
---|
218 | ncalgebra(1,@D); |
---|
219 | ideal I = |
---|
220 | x*Dx*(x*Dx+c-1) - x*(x*Dx+y*Dy+a)*(x*Dx+y*Dy+b), |
---|
221 | y*Dy*(y*Dy+d-1) - y*(x*Dx+y*Dy+a)*(x*Dx+y*Dy+b); |
---|
222 | def A = ratstd(I,2); |
---|
223 | pGBid; // polynomial form |
---|
224 | setring A; |
---|
225 | rGBid; // rational form |
---|
226 | } |
---|