1 | version="$Id$"; |
---|
2 | category="Commutative Algebra"; |
---|
3 | info=" |
---|
4 | LIBRARY: swalk.lib Sagbi Walk Conversion Algorithm |
---|
5 | AUTHOR: Junaid Alam Khan junaidalamkhan@gmail.com |
---|
6 | |
---|
7 | OVERVIEW: |
---|
8 | A library for computing the Sagbi basis of subalgebra through Sagbi walk |
---|
9 | algorithm. |
---|
10 | |
---|
11 | THEORY: The concept of SAGBI ( Subalgebra Analog to Groebner Basis for Ideals) |
---|
12 | is defined in [L. Robbiano, M. Sweedler: Subalgebra Bases, volume 42, volume |
---|
13 | 1430 of Lectures Note in Mathematics series, Springer-Verlag (1988),61-87]. |
---|
14 | The Sagbi Walk algorithm is the subalgebra analogue to the Groebner Walk |
---|
15 | algorithm which has been proposed in [S. Collart, M. Kalkbrener and D.Mall: |
---|
16 | Converting bases with the Grobner Walk. J. Symbolic Computation 24 (1997), |
---|
17 | 465-469]. |
---|
18 | |
---|
19 | PROCEDURE: |
---|
20 | swalk(ideal[,intvec]); Sagbi basis of subalgebra via Sagbi walk algorithm |
---|
21 | "; |
---|
22 | |
---|
23 | LIB "sagbi.lib"; |
---|
24 | ////////////////////////////////////////////////////////////////////////////// |
---|
25 | proc swalk(ideal Gox, list #) |
---|
26 | "USAGE: swalk(i[,v,w]); i ideal, v,w int vectors |
---|
27 | RETURN: The sagbi basis of the subalgebra defined by the generators of i, |
---|
28 | calculated via the Sagbi walk algorithm from the ordering dp to lp |
---|
29 | if v,w are not given (resp. from the ordering (a(v),lp) to the |
---|
30 | ordering (a(w),lp) if v and w are given). |
---|
31 | EXAMPLE: example swalk; shows an example |
---|
32 | " |
---|
33 | { |
---|
34 | /* we use ring with ordering (a(...),lp,C) */ |
---|
35 | list OSCTW = OrderStringalp_NP("al", #);//"dp" |
---|
36 | string ord_str = OSCTW[2]; |
---|
37 | intvec icurr_weight = OSCTW[3]; /* original weight vector */ |
---|
38 | intvec itarget_weight = OSCTW[4]; /* terget weight vector */ |
---|
39 | kill OSCTW; |
---|
40 | option(redSB); |
---|
41 | def xR = basering; |
---|
42 | list rl=ringlist(xR); |
---|
43 | rl[3][1][1]="dp"; |
---|
44 | def ostR=ring(rl); |
---|
45 | setring ostR; |
---|
46 | def new_ring = basering; |
---|
47 | ideal Gnew = fetch(xR, Gox); |
---|
48 | Gnew=sagbi(Gnew,1); |
---|
49 | Gnew=interreduceSd(Gnew); |
---|
50 | vector curr_weight=changeTypeInt(icurr_weight); |
---|
51 | vector target_weight=changeTypeInt(itarget_weight); |
---|
52 | ideal Gold; |
---|
53 | list l; |
---|
54 | intvec v; |
---|
55 | int n=0; |
---|
56 | while(n==0) |
---|
57 | { |
---|
58 | Gold=Gnew; |
---|
59 | def old_ring=new_ring; |
---|
60 | setring old_ring; |
---|
61 | number ulast; |
---|
62 | kill new_ring; |
---|
63 | if(curr_weight==target_weight){n=1;} |
---|
64 | else { |
---|
65 | l=collectDiffExpo(Gold); |
---|
66 | ulast=last(curr_weight, target_weight, l); |
---|
67 | vector new_weight=(1-ulast)*curr_weight+ulast*target_weight; |
---|
68 | vector w=cleardenom(new_weight); |
---|
69 | v=changeType(w); |
---|
70 | list p= ringlist(old_ring); |
---|
71 | p[3][1][2]= v; |
---|
72 | def new_ring=ring(p); |
---|
73 | setring new_ring; |
---|
74 | ideal Gold=fetch(old_ring,Gold); |
---|
75 | vector curr_weight=fetch(old_ring,new_weight); |
---|
76 | vector target_weight=fetch(old_ring,target_weight); |
---|
77 | kill old_ring; |
---|
78 | ideal Gnew=Convert(Gold); |
---|
79 | Gnew=interreduceSd(Gnew); |
---|
80 | } |
---|
81 | } |
---|
82 | setring xR; |
---|
83 | ideal result = fetch(old_ring, Gnew); |
---|
84 | attrib(result,"isSB",1); |
---|
85 | return (result); |
---|
86 | } |
---|
87 | example |
---|
88 | { |
---|
89 | "EXAMPLE:";echo = 2; |
---|
90 | ring r = 0,(x,y), lp; |
---|
91 | ideal I =x2,y2,xy+y,2xy2+y3; |
---|
92 | swalk(I); |
---|
93 | } |
---|
94 | |
---|
95 | ////////////////////////////////////////////////////////////////////////////// |
---|
96 | static proc inprod(vector v,vector w) |
---|
97 | "USAGE: inprod(v,w); v,w vectors |
---|
98 | RETURN: inner product of vector v and w |
---|
99 | EXAMPLE: example inprod; shows an example |
---|
100 | " |
---|
101 | { |
---|
102 | poly a; |
---|
103 | int i; |
---|
104 | for(i=1;i<=nvars(basering);i++) |
---|
105 | { |
---|
106 | a=a+v[i]*w[i] ; |
---|
107 | } |
---|
108 | return(a); |
---|
109 | } |
---|
110 | example |
---|
111 | { "EXAMPLE:"; echo = 2; |
---|
112 | ring r=0,(x,y,z),lp; |
---|
113 | vector v =[1,-1,2]; |
---|
114 | vector w = [1,0,3]; |
---|
115 | inprod(v,w); |
---|
116 | } |
---|
117 | |
---|
118 | ////////////////////////////////////////////////////////////////////////////// |
---|
119 | static proc diffExpo(poly f) |
---|
120 | "USAGE: diffExpo(f); f polynomial |
---|
121 | RETURN: a list of integers vectors which are the difference of exponent |
---|
122 | vector of leading monomial of f with the exponent vector of of other |
---|
123 | monmials in f. |
---|
124 | EXAMPLE: example diffExpo; shows an example |
---|
125 | " |
---|
126 | { |
---|
127 | list l; |
---|
128 | int i; |
---|
129 | intvec v; |
---|
130 | for(i=size(f);i>=2;i--) |
---|
131 | { |
---|
132 | v=leadexp(f[1])-leadexp(f[i]); |
---|
133 | l[i-1]=v; |
---|
134 | } |
---|
135 | return(l); |
---|
136 | } |
---|
137 | example |
---|
138 | { "EXAMPLE:"; echo = 2; |
---|
139 | ring r=0,(x,y,z),lp; |
---|
140 | poly f = xy+z2 ; |
---|
141 | diffExpo(f); |
---|
142 | } |
---|
143 | |
---|
144 | ////////////////////////////////////////////////////////////////////////////// |
---|
145 | static proc collectDiffExpo( ideal i) |
---|
146 | "USAGE: collectDiffExpo(i); i ideal |
---|
147 | RETURN: a list which contains diffExpo(f), for all generators f of ideal i |
---|
148 | EXAMPLE: example collectDiffExpo; shows an example |
---|
149 | " |
---|
150 | { |
---|
151 | list l; |
---|
152 | int j; |
---|
153 | for(j=ncols(i); j>=1;j--) |
---|
154 | { |
---|
155 | l[j]=diffExpo(i[j]); |
---|
156 | } |
---|
157 | return(l); |
---|
158 | } |
---|
159 | example |
---|
160 | { "EXAMPLE:"; echo = 2; |
---|
161 | ring r=0,(x,y,z),lp; |
---|
162 | ideal I = xy+z2,y3+x2y2; |
---|
163 | collectDiffExpo(I); |
---|
164 | } |
---|
165 | |
---|
166 | ////////////////////////////////////////////////////////////////////////////// |
---|
167 | static proc changeType(vector v) |
---|
168 | "USAGE: changeType(v); v vector |
---|
169 | RETURN: change the type of vector |
---|
170 | v into integer vector. |
---|
171 | |
---|
172 | EXAMPLE: example changeType; shows an example |
---|
173 | " |
---|
174 | { |
---|
175 | intvec w ; |
---|
176 | int j ; |
---|
177 | for(j=1;j<=nvars(basering);j++) |
---|
178 | { |
---|
179 | w[j]=int(leadcoef(v[j])); |
---|
180 | } |
---|
181 | return(w); |
---|
182 | } |
---|
183 | example |
---|
184 | { "EXAMPLE:"; echo = 2; |
---|
185 | ring r=0,(x,y,z),lp; |
---|
186 | vector v = [2,1,3]; |
---|
187 | changeType(v); |
---|
188 | } |
---|
189 | ////////////////////////////////////////////////////////////////////////////// |
---|
190 | static proc changeTypeInt( intvec v) |
---|
191 | "USAGE: changeTypeInt(v); v integer vector |
---|
192 | RETURN: change the type of integer vector v into vector. |
---|
193 | EXAMPLE: example changeTypeInt; shows an example |
---|
194 | " |
---|
195 | { |
---|
196 | vector w; |
---|
197 | int j ; |
---|
198 | for(j=1;j<=size(v);j++) |
---|
199 | { |
---|
200 | w=w+v[j]*gen(j); |
---|
201 | } |
---|
202 | return(w); |
---|
203 | } |
---|
204 | example |
---|
205 | { "EXAMPLE:"; echo = 2; |
---|
206 | ring r=0,(x,y,z),lp; |
---|
207 | intvec v = 4,2,3; |
---|
208 | changeTypeInt(v); |
---|
209 | } |
---|
210 | |
---|
211 | ////////////////////////////////////////////////////////////////////////////// |
---|
212 | static proc last( vector c, vector t,list l) |
---|
213 | "USAGE: last(c,t,l); c,t vectors, l list |
---|
214 | RETURN: a parametric value which corresponds to vector lies along the path |
---|
215 | between c and t using list l of integer vectors. This vector is the |
---|
216 | last vector on old Sagbi cone |
---|
217 | EXAMPLE: example last; shows an example |
---|
218 | " |
---|
219 | { |
---|
220 | number ul=1; |
---|
221 | int i,j,k; |
---|
222 | number u; |
---|
223 | vector v; |
---|
224 | for(i=1;i<=size(l);i++) |
---|
225 | { |
---|
226 | for(j=1;j<=size(l[i]);j++) |
---|
227 | { |
---|
228 | v=0; |
---|
229 | for(k=1;k<=size(l[i][j]);k++) |
---|
230 | { |
---|
231 | v=v+l[i][j][k]*gen(k); |
---|
232 | } |
---|
233 | poly n= inprod(c,v); |
---|
234 | poly q= inprod(t,v); |
---|
235 | number a=leadcoef(n); |
---|
236 | number b=leadcoef(q); |
---|
237 | number z=a-b; |
---|
238 | if(b<0) |
---|
239 | { |
---|
240 | u=a/z; |
---|
241 | if(u<ul) {ul=u;} |
---|
242 | } |
---|
243 | kill a,b,z,n,q ; |
---|
244 | } |
---|
245 | } |
---|
246 | return(ul); |
---|
247 | } |
---|
248 | example |
---|
249 | { "EXAMPLE:"; echo = 2; |
---|
250 | ring r=0,(x,y,z),(a(0,0,1),lp); |
---|
251 | vector v= [0,0,1]; |
---|
252 | vector w=[1,0,0]; |
---|
253 | ideal i=z2+xy,x2y2+y3; |
---|
254 | list l=collectDiffExpo(i); |
---|
255 | last(v,w,l) |
---|
256 | } |
---|
257 | |
---|
258 | ////////////////////////////////////////////////////////////////////////////// |
---|
259 | static proc initialForm(poly P) |
---|
260 | "USAGE: initialForm(P); P polynomial |
---|
261 | RETURN: sum of monomials of P with maximum w-degree |
---|
262 | where w is first row of matrix of a given monomial ordering |
---|
263 | EXAMPLE: example initialForm; shows an example |
---|
264 | " |
---|
265 | { |
---|
266 | poly q; |
---|
267 | int i=1; |
---|
268 | while(deg(P[i])==deg(P[1])) |
---|
269 | { |
---|
270 | q=q+P[i]; |
---|
271 | i++; |
---|
272 | if(i>size(P)) {break;} |
---|
273 | } |
---|
274 | return(q); |
---|
275 | } |
---|
276 | example |
---|
277 | { "EXAMPLE:"; echo = 2; |
---|
278 | ring r=0,(x,y,z),dp; |
---|
279 | poly f = x2+yz+z; |
---|
280 | initialForm(f); |
---|
281 | } |
---|
282 | |
---|
283 | ////////////////////////////////////////////////////////////////////////////// |
---|
284 | static proc Initial(ideal I) |
---|
285 | "USAGE: Initial(I); I ideal |
---|
286 | RETURN: an ideal which is generate by the InitialForm |
---|
287 | of the generators of I. |
---|
288 | EXAMPLE: example Initial; shows an example |
---|
289 | " |
---|
290 | { |
---|
291 | ideal J; |
---|
292 | int i; |
---|
293 | for(i=1;i<=ncols(I);i++) |
---|
294 | { |
---|
295 | J[i]=initialForm(I[i]); |
---|
296 | } |
---|
297 | return(J); |
---|
298 | } |
---|
299 | example |
---|
300 | { "EXAMPLE:"; echo = 2; |
---|
301 | ring r=0,(x,y,z),dp; |
---|
302 | ideal I = x+1,x+y+1; |
---|
303 | Initial(I); |
---|
304 | } |
---|
305 | |
---|
306 | ////////////////////////////////////////////////////////////////////////////// |
---|
307 | static proc Lift(ideal In,ideal InG,ideal Gold) |
---|
308 | "USAGE: Lift(In, InG, Gold); In, InG, Gold ideals; |
---|
309 | Gold given by Sagbi basis {g_1,...,g_t}, |
---|
310 | In given by tne initial forms In(g_1),...,In(g_t), |
---|
311 | InG = {h_1,...,h_s} a Sagbi basis of In |
---|
312 | RETURN: P_j, a polynomial in K[y_1,..,y_t] such that h_j = |
---|
313 | P_j(In(g_1),...,In_(g_t)) |
---|
314 | and return f_j = P_j(g_1,...,g_t) |
---|
315 | EXAMPLE: example Lift; shows an example |
---|
316 | " |
---|
317 | { |
---|
318 | int i; |
---|
319 | ideal J; |
---|
320 | for(i=1;i<=ncols(InG);i++) |
---|
321 | { |
---|
322 | poly f=InG[i]; |
---|
323 | list l=algebra_containment(f,In,1); |
---|
324 | def s=l[2]; |
---|
325 | map F=s,maxideal(1),Gold ; |
---|
326 | poly g=F(check); |
---|
327 | ideal k=g; |
---|
328 | J=J+k; |
---|
329 | kill g,l,s,F,f,k; |
---|
330 | } |
---|
331 | return(J); |
---|
332 | } |
---|
333 | example |
---|
334 | { "EXAMPLE:"; echo = 2; |
---|
335 | ring r=0,(x,y,z),(a(2,0,3),lp); |
---|
336 | ideal In = xy+z2,x2y2; |
---|
337 | ideal InG=xy+z2,x2y2,xyz2+1/2z4; |
---|
338 | ideal Gold=xy+z2,y3+x2y2; |
---|
339 | Lift(In,InG,Gold); |
---|
340 | } |
---|
341 | |
---|
342 | ////////////////////////////////////////////////////////////////////////////// |
---|
343 | static proc Convert( ideal Gold ) |
---|
344 | "USAGE: Convert(I); I ideal |
---|
345 | RETURN: Convert old Sagbi basis into new Sagbi basis |
---|
346 | EXAMPLE: example Convert; shows an example |
---|
347 | " |
---|
348 | { |
---|
349 | ideal In=Initial(Gold); |
---|
350 | ideal InG=sagbi(In,1)+In; |
---|
351 | ideal Gnew=Lift(In,InG,Gold); |
---|
352 | return(Gnew); |
---|
353 | } |
---|
354 | example |
---|
355 | { "EXAMPLE:"; echo = 2; |
---|
356 | ring r=0,(x,y,z),lp; |
---|
357 | ideal I=xy+z2, y3+x2y2; |
---|
358 | Convert(I); |
---|
359 | } |
---|
360 | |
---|
361 | ////////////////////////////////////////////////////////////////////////////// |
---|
362 | static proc interreduceSd(ideal I) |
---|
363 | "USAGE: interreduceSd(I); I ideal |
---|
364 | RETURN: interreduceSd the set of generators if I with |
---|
365 | respect to a given term ordering |
---|
366 | EXAMPLE: example interreduceSd; shows an example |
---|
367 | " |
---|
368 | { |
---|
369 | list l,M; |
---|
370 | ideal J,B; |
---|
371 | int i,j,k; |
---|
372 | poly f; |
---|
373 | for(k=1;k<=ncols(I);k++) |
---|
374 | {l[k]=I[k];} |
---|
375 | for(j=1;j<=size(l);j++) |
---|
376 | { |
---|
377 | f=l[j]; |
---|
378 | M=delete(l,j); |
---|
379 | for(i=1;i<=size(M);i++) |
---|
380 | { B[i]=M[i];} |
---|
381 | f=sagbiNF(f,B,1); |
---|
382 | J=J+f; |
---|
383 | } |
---|
384 | return(J); |
---|
385 | } |
---|
386 | example |
---|
387 | { "EXAMPLE:"; echo = 2; |
---|
388 | ring r=0,(x,y,z),lp; |
---|
389 | ideal I = xy+z2,x2y2+y3; |
---|
390 | interreduceSd(I); |
---|
391 | } |
---|
392 | |
---|
393 | ////////////////////////////////////////////////////////////////////////////// |
---|
394 | static proc OrderStringalp(string Wpal,list #) |
---|
395 | { |
---|
396 | int n= nvars(basering); |
---|
397 | string order_str; |
---|
398 | intvec curr_weight, target_weight; |
---|
399 | curr_weight = system("Mivdp",n); |
---|
400 | target_weight = system("Mivlp",n); |
---|
401 | |
---|
402 | if(size(#) != 0) |
---|
403 | { |
---|
404 | if(size(#) == 1) |
---|
405 | { |
---|
406 | if(typeof(#[1]) == "intvec") |
---|
407 | { |
---|
408 | if(Wpal == "al"){ |
---|
409 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
410 | } |
---|
411 | else { |
---|
412 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
413 | } |
---|
414 | curr_weight = #[1]; |
---|
415 | } |
---|
416 | else |
---|
417 | { |
---|
418 | if(typeof(#[1]) == "string") |
---|
419 | { |
---|
420 | if(#[1] == "Dp") { |
---|
421 | order_str = "Dp"; |
---|
422 | } |
---|
423 | else { |
---|
424 | order_str = "dp"; |
---|
425 | } |
---|
426 | } |
---|
427 | else { |
---|
428 | order_str = "dp"; |
---|
429 | } |
---|
430 | } |
---|
431 | } |
---|
432 | else |
---|
433 | { |
---|
434 | if(size(#) == 2) |
---|
435 | { |
---|
436 | if(typeof(#[2]) == "intvec") |
---|
437 | { |
---|
438 | target_weight = #[2]; |
---|
439 | } |
---|
440 | if(typeof(#[1]) == "intvec") |
---|
441 | { |
---|
442 | if(Wpal == "al"){ |
---|
443 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
444 | } |
---|
445 | else { |
---|
446 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
447 | } |
---|
448 | curr_weight = #[1]; |
---|
449 | } |
---|
450 | else |
---|
451 | { |
---|
452 | if(typeof(#[1]) == "string") |
---|
453 | { |
---|
454 | if(#[1] == "Dp") { |
---|
455 | order_str = "Dp"; |
---|
456 | } |
---|
457 | else { |
---|
458 | order_str = "dp"; |
---|
459 | } |
---|
460 | } |
---|
461 | else { |
---|
462 | order_str = "dp"; |
---|
463 | } |
---|
464 | } |
---|
465 | } |
---|
466 | } |
---|
467 | } |
---|
468 | else { |
---|
469 | order_str = "dp"; |
---|
470 | } |
---|
471 | list result; |
---|
472 | result[1] = order_str; |
---|
473 | result[2] = curr_weight; |
---|
474 | result[3] = target_weight; |
---|
475 | return(result); |
---|
476 | } |
---|
477 | |
---|
478 | ////////////////////////////////////////////////////////////////////////////// |
---|
479 | static proc OrderStringalp_NP(string Wpal,list #) |
---|
480 | { |
---|
481 | int n= nvars(basering); |
---|
482 | string order_str = "dp"; |
---|
483 | int nP = 1;// call LatsGB to compute the wanted GB by pwalk |
---|
484 | intvec curr_weight = system("Mivdp",n); //define (1,1,...,1) |
---|
485 | intvec target_weight = system("Mivlp",n); //define (1,0,...,0) |
---|
486 | if(size(#) != 0) |
---|
487 | { |
---|
488 | if(size(#) == 1) |
---|
489 | { |
---|
490 | if(typeof(#[1]) == "intvec") |
---|
491 | { |
---|
492 | curr_weight = #[1]; |
---|
493 | |
---|
494 | if(Wpal == "al") |
---|
495 | { |
---|
496 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
497 | } |
---|
498 | else |
---|
499 | { |
---|
500 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
501 | } |
---|
502 | } |
---|
503 | else { |
---|
504 | if(typeof(#[1]) == "int") |
---|
505 | { |
---|
506 | nP = #[1]; |
---|
507 | } |
---|
508 | else |
---|
509 | { |
---|
510 | print("// ** the input must be \"(ideal, int)\" or "); |
---|
511 | print("// ** \"(ideal, intvec)\""); |
---|
512 | print("// ** a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
513 | } |
---|
514 | } |
---|
515 | } |
---|
516 | else |
---|
517 | { |
---|
518 | if(size(#) == 2) |
---|
519 | { |
---|
520 | if(typeof(#[1]) == "intvec" and typeof(#[2]) == "int") |
---|
521 | { |
---|
522 | curr_weight = #[1]; |
---|
523 | |
---|
524 | if(Wpal == "al") |
---|
525 | { |
---|
526 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
527 | } |
---|
528 | else |
---|
529 | { |
---|
530 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
531 | } |
---|
532 | } |
---|
533 | else |
---|
534 | { |
---|
535 | if(typeof(#[1]) == "intvec" and typeof(#[2]) == "intvec") |
---|
536 | { |
---|
537 | curr_weight = #[1]; |
---|
538 | target_weight = #[2]; |
---|
539 | |
---|
540 | if(Wpal == "al") |
---|
541 | { |
---|
542 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
543 | } |
---|
544 | else |
---|
545 | { |
---|
546 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
547 | } |
---|
548 | } |
---|
549 | else |
---|
550 | { |
---|
551 | print("// ** the input must be \"(ideal,intvec,int)\" or "); |
---|
552 | print("// ** \"(ideal,intvec,intvec)\""); |
---|
553 | print("// ** and a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
554 | } |
---|
555 | } |
---|
556 | } |
---|
557 | else { |
---|
558 | if(size(#) == 3) |
---|
559 | { |
---|
560 | if(typeof(#[1]) == "intvec" and typeof(#[2]) == "intvec" and |
---|
561 | typeof(#[3]) == "int") |
---|
562 | { |
---|
563 | curr_weight = #[1]; |
---|
564 | target_weight = #[2]; |
---|
565 | nP = #[3]; |
---|
566 | if(Wpal == "al") |
---|
567 | { |
---|
568 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
569 | } |
---|
570 | else |
---|
571 | { |
---|
572 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
573 | } |
---|
574 | } |
---|
575 | else |
---|
576 | { |
---|
577 | print("// ** the input must be \"(ideal,intvec,intvec,int)\""); |
---|
578 | print("// ** and a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
579 | |
---|
580 | } |
---|
581 | } |
---|
582 | else |
---|
583 | { |
---|
584 | print("// ** The given input is wrong"); |
---|
585 | print("// ** and a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
586 | } |
---|
587 | } |
---|
588 | } |
---|
589 | } |
---|
590 | list result; |
---|
591 | result[1] = nP; |
---|
592 | result[2] = order_str; |
---|
593 | result[3] = curr_weight; |
---|
594 | result[4] = target_weight; |
---|
595 | return(result); |
---|
596 | } |
---|
597 | |
---|
598 | ///////////////////////////////////////////////////////////////////////////////* |
---|
599 | Further examples |
---|
600 | ring r=0,(x,y,z),lp; |
---|
601 | |
---|
602 | ideal I=x2y4, y4z2, xy4z+y2z, xy6z2+y10z5; |
---|
603 | |
---|
604 | ideal Q=x2y4, y4z2, xy4z+y2z, xy6z2+y14z7; |
---|
605 | |
---|
606 | ideal J=x2y4, y4z2, xy4z+y2z, xy6z2+y18z9; |
---|
607 | |
---|
608 | ideal K=x2,y2,xy+y,2xy2+y5,z3+x; |
---|
609 | |
---|
610 | ideal L=x2+y,y2+z,x+z2; |
---|
611 | */ |
---|
612 | |
---|
613 | |
---|