1 | ////////////////////////////////////////////////////////////////////////////// |
---|
2 | version="$Id: sagbi.lib,v 1.9 2007-01-23 18:27:17 Singular Exp $"; |
---|
3 | category="Commutative Algebra"; |
---|
4 | info=" |
---|
5 | LIBRARY: SAGBI.lib Compute Subalgebras bases Analogous to Groebner bases for ideals |
---|
6 | AUTHORS: Gerhard Pfister, pfister@mathematik.uni-kl.de, |
---|
7 | @* Anen Lakhal, alakhal@mathematik.uni-kl.de |
---|
8 | |
---|
9 | PROCEDURES: |
---|
10 | sagbiRreduction(p,I); perform one step subalgebra reducton (for short S-reduction) of p w.r.t I |
---|
11 | sagbiSPoly(I); compute the S-polynomials of the Subalgebra defined by the genartors of I |
---|
12 | sagbiNF(id,I); perform iterated S-reductions in order to compute Subalgebras normal forms |
---|
13 | sagbi(I); construct SAGBI basis for the Subalgebra defined by I |
---|
14 | sagbiPart(I); construct partial SAGBI basis for the Subalgebra defined by I |
---|
15 | "; |
---|
16 | |
---|
17 | LIB "algebra.lib"; |
---|
18 | LIB "elim.lib"; |
---|
19 | |
---|
20 | /////////////////////////////////////////////////////////////////////////////// |
---|
21 | proc sagbiSPoly(id ,list #) |
---|
22 | "USAGE: sagbiSPoly(id [,n]); id ideal, n positive integer. |
---|
23 | RETURN: an ideal |
---|
24 | @format |
---|
25 | - If (n=0 or default) an ideal, whose generators are the S-polynomials. |
---|
26 | - If (n=1) a list of size 2: |
---|
27 | the first element of this list is the ideal of S-polynomials. |
---|
28 | the second element of this list is the ring in which is defined |
---|
29 | the ideal of algebraic relations. |
---|
30 | @end format |
---|
31 | EXAMPLE: example sagbiSPoly; show an example " |
---|
32 | { |
---|
33 | if(size(#)==0) |
---|
34 | { |
---|
35 | #[1]=0; |
---|
36 | } |
---|
37 | degBound=0; |
---|
38 | def bsr=basering; |
---|
39 | ideal vars=maxideal(1); |
---|
40 | ideal B=ideal(bsr);//when the basering is quotient ring this "type casting" |
---|
41 | //gives th quotient ideal. |
---|
42 | int b=size(B); |
---|
43 | |
---|
44 | |
---|
45 | //In quotient rings,SINGULAR does not reduce polynomials w.r.t the |
---|
46 | //quotient ideal,therefore we should first 'reduce';if it is necessary for |
---|
47 | //computations to have a uniquely determined representant for each equivalent |
---|
48 | //class,which is the case of this procedure. |
---|
49 | |
---|
50 | if(b!=0) |
---|
51 | { |
---|
52 | id =reduce(id,groebner(0)); |
---|
53 | } |
---|
54 | int n,m=nvars(bsr),ncols(id); |
---|
55 | int z; |
---|
56 | string mp=string(minpoly); |
---|
57 | ideal P; |
---|
58 | list L; |
---|
59 | |
---|
60 | if(id==0) |
---|
61 | { |
---|
62 | if(#[1]==0) |
---|
63 | { |
---|
64 | return(P); |
---|
65 | } |
---|
66 | else |
---|
67 | { |
---|
68 | return(L); |
---|
69 | } |
---|
70 | } |
---|
71 | else |
---|
72 | { |
---|
73 | //==================create anew ring with extra variables================ |
---|
74 | |
---|
75 | execute("ring R1=("+charstr(bsr)+"),("+varstr(bsr)+",@y(1..m)),(dp(n),dp(m));"); |
---|
76 | execute("minpoly=number("+mp+");"); |
---|
77 | ideal id=imap(bsr,id); |
---|
78 | ideal A; |
---|
79 | |
---|
80 | for(z=1;z<=m;z++) |
---|
81 | { |
---|
82 | A[z]=lead(id[z])-@y(z); |
---|
83 | } |
---|
84 | |
---|
85 | A=groebner(A); |
---|
86 | ideal kern=nselect(A,1,n);// "kern" is the kernel of the ring map: |
---|
87 | // R1----->bsr ;y(z)----> lead(id[z]). |
---|
88 | //"kern" is the ideal of algebraic relations between |
---|
89 | // lead(id[z]). |
---|
90 | |
---|
91 | export kern,A;// we export: |
---|
92 | // * the ideal A to avoid useless computations |
---|
93 | // between 2 steps in sagbi procedure. |
---|
94 | // * the ideal kern : some times we can get intresting |
---|
95 | // informations from this ideal. |
---|
96 | |
---|
97 | setring bsr; |
---|
98 | map phi=R1,vars,id; |
---|
99 | |
---|
100 | // the sagbiSPolynomials are the image by phi of the generators of kern |
---|
101 | |
---|
102 | P=simplify(phi(kern),1); |
---|
103 | if(#[1]==0) |
---|
104 | { |
---|
105 | return(P); |
---|
106 | } |
---|
107 | else |
---|
108 | { |
---|
109 | L=P,R1; |
---|
110 | kill phi,vars; |
---|
111 | |
---|
112 | dbprint(printlevel-voice+3," |
---|
113 | // 'sagbiSPoly' created a ring as 2nd element of the list. |
---|
114 | // The ring contains the ideal 'kern' of algebraic relations between the |
---|
115 | //leading terms of the generators of I. |
---|
116 | // To access to this ring and see 'kern' you should give the ring a name, |
---|
117 | // e.g.: |
---|
118 | def S = L[2]; setring S; kern; |
---|
119 | "); |
---|
120 | return(L); |
---|
121 | } |
---|
122 | } |
---|
123 | } |
---|
124 | example |
---|
125 | { "EXAMPLE:"; echo = 2; |
---|
126 | ring r=0, (x,y),dp; |
---|
127 | poly f1,f2,f3,f4=x2,y2,xy+y,2xy2; |
---|
128 | ideal I=f1,f2,f3,f4; |
---|
129 | sagbiSPoly(I); |
---|
130 | list L=sagbiSPoly(I,1); |
---|
131 | L[1]; |
---|
132 | def S= L[2]; setring S; kern; |
---|
133 | } |
---|
134 | |
---|
135 | |
---|
136 | /////////////////////////////////////////////////////////////////////////////// |
---|
137 | static proc std1(ideal J,ideal I,list #) |
---|
138 | // I is contained in J, and it is assumed to be a standard bases! |
---|
139 | //This procedure computes a Standard basis for J from I one's |
---|
140 | //This procedure is essential for Spoly1 procedure. |
---|
141 | { |
---|
142 | def br=basering; |
---|
143 | int tt; |
---|
144 | ideal Res,@result; |
---|
145 | |
---|
146 | |
---|
147 | if(size(#)>0) {tt=#[1];} |
---|
148 | |
---|
149 | if(size(I)==0) {@result=groebner(J);} |
---|
150 | |
---|
151 | if((size(I)!=0) && (size(J)-size(I)>=1)) |
---|
152 | { |
---|
153 | qring Q=I; |
---|
154 | ideal J=fetch(br,J); |
---|
155 | J=groebner(J); |
---|
156 | setring br; |
---|
157 | Res=fetch(Q,J);// Res contains the generators that we add to I |
---|
158 | // to get the generators of std(J); |
---|
159 | @result=Res+I; |
---|
160 | } |
---|
161 | |
---|
162 | if(tt==0) { return(@result);} |
---|
163 | else { return(Res);} |
---|
164 | } |
---|
165 | |
---|
166 | /////////////////////////////////////////////////////////////////////////////// |
---|
167 | |
---|
168 | static proc Spoly1(list l,ideal I,ideal J,int a) |
---|
169 | //an implementation of SAGBI construction Algorithm using Spoly |
---|
170 | //procedure leads to useless computations and affect the efficiency |
---|
171 | //of SAGBI bases computations. This procedure is a variant of Spoly |
---|
172 | //in order to avoid these useless compuations. |
---|
173 | { |
---|
174 | degBound=0; |
---|
175 | def br=basering; |
---|
176 | ideal vars=maxideal(1); |
---|
177 | ideal B=ideal(br); |
---|
178 | int b=size(B); |
---|
179 | |
---|
180 | if(b!=0) |
---|
181 | { |
---|
182 | I=reduce(I,groebner(0)); |
---|
183 | J=reduce(J,groebner(0)); |
---|
184 | } |
---|
185 | int n,ii,jj=nvars(br),ncols(I),ncols(J); |
---|
186 | int z; |
---|
187 | list @L; |
---|
188 | string mp =string(minpoly); |
---|
189 | |
---|
190 | if(size(J)==0) |
---|
191 | { |
---|
192 | @L =sagbiSPoly(I,1); |
---|
193 | } |
---|
194 | else |
---|
195 | { |
---|
196 | ideal @sum=I+J; |
---|
197 | ideal P1; |
---|
198 | ideal P=l[1];//P is the ideal of spolynomials of I; |
---|
199 | def R=l[2];setring R;int kk=nvars(R); |
---|
200 | ideal J=fetch(br,J); |
---|
201 | |
---|
202 | //================create a new ring with extra variables============== |
---|
203 | |
---|
204 | execute("ring R1=("+charstr(R)+"),("+varstr(R)+",@y((ii+1)..(ii+jj))),(dp(n),dp(kk+jj-n));"); |
---|
205 | // *levandov: would it not be easier and better to use |
---|
206 | // ring @Y = char(R),(@y((ii+1)..(ii+jj))),dp; |
---|
207 | // def R1 = R + @Y; |
---|
208 | // setring R1; |
---|
209 | // -> thus |
---|
210 | ideal kern1; |
---|
211 | ideal A=fetch(R,A); |
---|
212 | attrib(A,"isSB",1); |
---|
213 | ideal J=fetch(R,J); |
---|
214 | ideal kern=fetch(R,kern); |
---|
215 | ideal A1; |
---|
216 | for(z=1;z<=jj;z++) |
---|
217 | { |
---|
218 | A1[z]=lead(J[z])-var(z+kk); |
---|
219 | } |
---|
220 | A1=A+A1; |
---|
221 | ideal @Res=std1(A1,A,1);// the generators of @Res are whose we have to add |
---|
222 | // to A to get std(A1). |
---|
223 | A=A+@Res; |
---|
224 | kern1=nselect(@Res,1,n); |
---|
225 | kern=kern+kern1; |
---|
226 | export kern,kern1,A; |
---|
227 | setring br; |
---|
228 | map phi=R1,vars,@sum; |
---|
229 | P1=simplify(phi(kern1),1);//P1 is th ideal we add to P to get the ideal |
---|
230 | //of Spolynomials of @sum. |
---|
231 | P=P+P1; |
---|
232 | |
---|
233 | if (a==1) |
---|
234 | { |
---|
235 | @L=P,R1; |
---|
236 | kill phi,vars; |
---|
237 | dbprint(printlevel-voice+3," |
---|
238 | // 'Spoly1' created a ring as 2nd element of the list. |
---|
239 | // The ring contains the ideal 'kern' of algebraic relations between the |
---|
240 | //generators of I+J. |
---|
241 | // To access to this ring and see 'kern' you should give the ring a name, |
---|
242 | // e.g.: |
---|
243 | def @ring = L[2]; setring @ring ; kern; |
---|
244 | "); |
---|
245 | } |
---|
246 | if(a==2) |
---|
247 | { |
---|
248 | @L=P1,R1; |
---|
249 | kill phi,vars; |
---|
250 | } |
---|
251 | } |
---|
252 | return(@L); |
---|
253 | } |
---|
254 | /////////////////////////////////////////////////////////////////////////////// |
---|
255 | |
---|
256 | proc sagbiReduction(poly p,ideal dom,list #)//one step Subalgebra reduction |
---|
257 | "USAGE: sagbiReduction(p,dom[,n]); p poly , dom ideal |
---|
258 | RETURN: a polynomial |
---|
259 | @format |
---|
260 | Three algorithm variants are used to perform subalgebra reduction. |
---|
261 | The positive interger n determine which variant should be used. |
---|
262 | n may take the values (0 or default),1 or 2. |
---|
263 | @end format |
---|
264 | EXAMPLE: sagbiReduction; show an example" |
---|
265 | { |
---|
266 | def bsr=basering; |
---|
267 | ideal B=ideal(bsr);//When the basering is quotient ring this type casting |
---|
268 | // gives the quotient ideal. |
---|
269 | int b=size(B); |
---|
270 | int n=nvars(bsr); |
---|
271 | |
---|
272 | //In quotient rings, SINGULAR, usually does not reduce polynomials w.r.t the |
---|
273 | //quotient ideal,therefore we should first reduce ,when it is necessary for computations, |
---|
274 | // to have a uniquely determined representant for each equivalent |
---|
275 | //class,which is the case of this algorithm. |
---|
276 | |
---|
277 | if(b !=0) //means that the basering is a quotient ring |
---|
278 | { |
---|
279 | p=reduce(p,std(0)); |
---|
280 | dom=reduce(dom,std(0)); |
---|
281 | } |
---|
282 | |
---|
283 | int i,choose; |
---|
284 | int z=ncols(dom); |
---|
285 | |
---|
286 | if((size(#)>0) && (typeof(#[1])=="int")) |
---|
287 | { |
---|
288 | choose = #[1]; |
---|
289 | } |
---|
290 | if (size(#)>1) |
---|
291 | { |
---|
292 | choose =#[2]; |
---|
293 | } |
---|
294 | |
---|
295 | //=======================first algorithm(default)========================= |
---|
296 | if ( choose == 0 ) |
---|
297 | { |
---|
298 | list L = algebra_containment(lead(p),lead(dom),1); |
---|
299 | if( L[1]==1 ) |
---|
300 | { |
---|
301 | // the ring L[2] = char(bsr),(x(1..nvars(bsr)),y(1..z)),(dp(n),dp(m)), |
---|
302 | // contains poly check s.t. LT(p) is of the form check(LT(f1),...,LT(fr)) |
---|
303 | def s1 = L[2]; |
---|
304 | map psi = s1,maxideal(1),dom; |
---|
305 | poly re = p - psi(check); |
---|
306 | // divide by the maximal power of #[1] |
---|
307 | if ( (size(#)>0) && (typeof(#[1])=="poly") ) |
---|
308 | { |
---|
309 | while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0)) |
---|
310 | { |
---|
311 | re=re/#[1]; |
---|
312 | } |
---|
313 | } |
---|
314 | return(re); |
---|
315 | } |
---|
316 | return(p); |
---|
317 | } |
---|
318 | //======================2end variant of algorithm========================= |
---|
319 | //It uses two different commands for elimaination. |
---|
320 | //if(choose==1):"elimainate"command. |
---|
321 | //if (choose==2):"nselect" command. |
---|
322 | else |
---|
323 | { |
---|
324 | poly v=product(maxideal(1)); |
---|
325 | |
---|
326 | //------------- change the basering bsr to bsr[@(0),...,@(z)] ---------- |
---|
327 | execute("ring s=("+charstr(basering)+"),("+varstr(basering)+",@(0..z)),dp;"); |
---|
328 | // Ev hier die Reihenfolge der Vars aendern. Dazu muss unten aber entsprechend |
---|
329 | // geaendert werden: |
---|
330 | // execute("ring s="+charstr(basering)+",(@(0..z),"+varstr(basering)+"),dp;"); |
---|
331 | |
---|
332 | //constructs the leading ideal of dom=(p-@(0),dom[1]-@(1),...,dom[z]-@(z)) |
---|
333 | ideal dom=imap(bsr,dom); |
---|
334 | for (i=1;i<=z;i++) |
---|
335 | { |
---|
336 | dom[i]=lead(dom[i])-var(nvars(bsr)+i+1); |
---|
337 | } |
---|
338 | dom=lead(imap(bsr,p))-@(0),dom; |
---|
339 | |
---|
340 | //---------- eliminate the variables of the basering bsr -------------- |
---|
341 | //i.e. computes dom intersected with K[@(0),...,@(z)]. |
---|
342 | |
---|
343 | if(choose==1) |
---|
344 | { |
---|
345 | ideal kern=eliminate(dom,imap(bsr,v));//eliminate does not need a |
---|
346 | //standard basis as input. |
---|
347 | } |
---|
348 | if(choose==2) |
---|
349 | { |
---|
350 | ideal kern= nselect(groebner(dom),1,n);//"nselect" is combinatorial command |
---|
351 | //which uses the internal command |
---|
352 | // "simplify" |
---|
353 | } |
---|
354 | |
---|
355 | //--------- test wether @(0)-h(@(1),...,@(z)) is in ker --------------- |
---|
356 | // for some poly h and divide by maximal power of q=#[1] |
---|
357 | poly h; |
---|
358 | z=size(kern); |
---|
359 | for (i=1;i<=z;i++) |
---|
360 | { |
---|
361 | h=kern[i]/@(0); |
---|
362 | if (deg(h)==0) |
---|
363 | { |
---|
364 | h=(1/h)*kern[i]; |
---|
365 | // define the map psi : s ---> bsr defined by @(i) ---> p,dom[i] |
---|
366 | setring bsr; |
---|
367 | map psi=s,maxideal(1),p,dom; |
---|
368 | poly re=psi(h); |
---|
369 | // divide by the maximal power of #[1] |
---|
370 | if ((size(#)>0) && (typeof(#[1])== "poly") ) |
---|
371 | { |
---|
372 | while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0)) |
---|
373 | { |
---|
374 | re=re/#[1]; |
---|
375 | } |
---|
376 | } |
---|
377 | return(re); |
---|
378 | } |
---|
379 | } |
---|
380 | setring bsr; |
---|
381 | return(p); |
---|
382 | } |
---|
383 | } |
---|
384 | example |
---|
385 | {"EXAMPLE:"; echo = 2; |
---|
386 | ring r= 0,(x,y),dp; |
---|
387 | ideal dom =x2,y2,xy-y; |
---|
388 | poly p=x4+x3y+xy2-y2; |
---|
389 | sagbiReduction(p,dom); |
---|
390 | sagbiReduction(p,dom,1); |
---|
391 | sagbiReduction(p,dom,2); |
---|
392 | } |
---|
393 | |
---|
394 | /////////////////////////////////////////////////////////////////////////////// |
---|
395 | static proc completeReduction(poly p,ideal dom,list#)//reduction |
---|
396 | { |
---|
397 | poly p1=p; |
---|
398 | poly p2=sagbiReduction(p,dom,#); |
---|
399 | while (p1!=p2) |
---|
400 | { |
---|
401 | p1=p2; |
---|
402 | p2=sagbiReduction(p1,dom,#); |
---|
403 | } |
---|
404 | return(p2); |
---|
405 | } |
---|
406 | /////////////////////////////////////////////////////////////////////////////// |
---|
407 | |
---|
408 | static proc completeReduction1(poly p,ideal dom,list #) //tail reduction |
---|
409 | { |
---|
410 | poly p1,p2,re; |
---|
411 | p1=p; |
---|
412 | while(p1!=0) |
---|
413 | { |
---|
414 | p2=sagbiReduction(p1,dom,#); |
---|
415 | if(p2!=p1) |
---|
416 | { |
---|
417 | p1=p2; |
---|
418 | } |
---|
419 | else |
---|
420 | { |
---|
421 | re=re+lead(p2); |
---|
422 | p1=p2-lead(p2); |
---|
423 | } |
---|
424 | } |
---|
425 | return(re); |
---|
426 | } |
---|
427 | |
---|
428 | |
---|
429 | |
---|
430 | /////////////////////////////////////////////////////////////////////////////// |
---|
431 | |
---|
432 | proc sagbiNF(id,ideal dom,int k,list#) |
---|
433 | "USAGE: sagbiNF(id,dom,k[,n]); id either poly or ideal,dom ideal, k and n positive intergers. |
---|
434 | RETURN: depends On the type of id; ideal or polynomial. |
---|
435 | @format |
---|
436 | The integer k determines what kind of s-reduction is performed: |
---|
437 | - if (k=0) no tail s-reduction is performed. |
---|
438 | - if (k=1) tail s-reduction is performed. |
---|
439 | Three Algorthim variants are used to perform Subalgebra reduction. |
---|
440 | The positive integer n determine which variant should be used. |
---|
441 | n may take the values (0 or default),1 or 2. |
---|
442 | @end format |
---|
443 | NOTE: computation of Subalgebras normal forms may be performed either |
---|
444 | in polynomial rings or quotient polynomial rings |
---|
445 | EXAMPLE: example sagbiNF; show example " |
---|
446 | { |
---|
447 | int z; |
---|
448 | ideal Red; |
---|
449 | poly re; |
---|
450 | if(typeof(id)=="ideal") |
---|
451 | { |
---|
452 | int i=ncols(id); |
---|
453 | for(z=1;z<=i;z++) |
---|
454 | { |
---|
455 | if(k==0) |
---|
456 | { |
---|
457 | id[z]=completeReduction(id[z],dom,#); |
---|
458 | } |
---|
459 | else |
---|
460 | { |
---|
461 | id[z]=completeReduction1(id[z],dom,#);//tail reduction. |
---|
462 | } |
---|
463 | } |
---|
464 | Red=simplify(id,7); |
---|
465 | return(Red); |
---|
466 | } |
---|
467 | if(typeof(id)=="poly") |
---|
468 | { |
---|
469 | if(k==0) |
---|
470 | { |
---|
471 | re=completeReduction(id,dom,#); |
---|
472 | } |
---|
473 | else |
---|
474 | { |
---|
475 | re=completeReduction1(id,dom,#); |
---|
476 | } |
---|
477 | return(re); |
---|
478 | } |
---|
479 | } |
---|
480 | example |
---|
481 | {"EXAMPLE:"; echo = 2; |
---|
482 | ring r=0,(x,y),dp; |
---|
483 | ideal I= x2-xy; |
---|
484 | qring Q=std(I); |
---|
485 | ideal dom =x2,x2y+y,x3y2; |
---|
486 | poly p=x4+x2y+y; |
---|
487 | sagbiNF(p,dom,0); |
---|
488 | sagbiNF(p,dom,1);// tail subalgebra reduction is performed |
---|
489 | } |
---|
490 | |
---|
491 | |
---|
492 | /////////////////////////////////////////////////////////////////////////////// |
---|
493 | |
---|
494 | static proc intRed(id,int k, list #) |
---|
495 | { |
---|
496 | int i,z; |
---|
497 | ideal Rest,intRed; |
---|
498 | z=ncols(id); |
---|
499 | for(i=1;i<=z;i++) |
---|
500 | { |
---|
501 | Rest=id; |
---|
502 | Rest[i]=0; |
---|
503 | Rest=simplify(Rest,2); |
---|
504 | if(k==0) |
---|
505 | { |
---|
506 | intRed[i]=completeReduction(id[i],Rest,#); |
---|
507 | } |
---|
508 | else |
---|
509 | { |
---|
510 | intRed[i]=completeReduction1(id[i],Rest,#); |
---|
511 | } |
---|
512 | } |
---|
513 | intRed=simplify(intRed,7);//1+2+4 in simplify command |
---|
514 | return(intRed); |
---|
515 | } |
---|
516 | ////////////////////////////////////////////////////////////////////////////// |
---|
517 | |
---|
518 | proc sagbi(id,int k,list#) |
---|
519 | "USAGE: sagbi(id,k[,n]); id ideal, k and n positive integers. |
---|
520 | RETURN: A SAGBI basis for the subalgebra defined by the generators of id. |
---|
521 | @format |
---|
522 | k determine what kind of s-reduction is performed: |
---|
523 | - if (k=0) no tail s-reduction is performed. |
---|
524 | - if (k=1) tail s-reduction is performed, and S-interreduced SAGBI basis |
---|
525 | is returned. |
---|
526 | Three Algorithm variants are used to perform Subalgebra reduction. |
---|
527 | The positive interger n determine which variant should be used. |
---|
528 | n may take the values (0 or default),1 or 2. |
---|
529 | @end format |
---|
530 | NOTE: SAGBI bases computations may be performed either |
---|
531 | in polynomial rings or quotient polynomial rings. |
---|
532 | EXAMPLE: example sagbi; show example " |
---|
533 | { |
---|
534 | degBound=0; |
---|
535 | ideal S,oldS,Red; |
---|
536 | list L; |
---|
537 | S=intRed(id,k,#); |
---|
538 | while(size(S)!=size(oldS)) |
---|
539 | { |
---|
540 | L=Spoly1(L,S,Red,2); |
---|
541 | Red=L[1]; |
---|
542 | Red=sagbiNF(Red,S,k,#); |
---|
543 | oldS=S; |
---|
544 | S=S+Red; |
---|
545 | } |
---|
546 | return(S); |
---|
547 | } |
---|
548 | example |
---|
549 | { "EXAMPLE:"; echo = 2; |
---|
550 | ring r= 0,(x,y),dp; |
---|
551 | ideal I=x2,y2,xy+y; |
---|
552 | sagbi(I,1,1); |
---|
553 | } |
---|
554 | /////////////////////////////////////////////////////////////////////////////// |
---|
555 | proc sagbiPart(id,int k,int c,list #) |
---|
556 | "USAGE: sagbi(id,k,c[,n]); id ideal, k, c and n positive integer. |
---|
557 | RETURN: A partial SAGBI basis for the subalgebra defined by the generators of id. |
---|
558 | @format |
---|
559 | should stop. k determine what kind of s-reduction is performed: |
---|
560 | - if (k=0) no tail s-reduction is performed. |
---|
561 | - if (k=1) tail s-reduction is performed, and S-intereduced SAGBI basis |
---|
562 | is returned. |
---|
563 | c determines, after which turn Sagbi basis computations should stop |
---|
564 | Three Algorithm variants are used to perform Subalgebra reduction. |
---|
565 | The positive integer n determines which variant should be used. |
---|
566 | n may take the values (0 or default),1 or 2. |
---|
567 | @end format |
---|
568 | NOTE:- SAGBI bases computations may be performed either |
---|
569 | in polynomial rings or quotient polynomial rings. |
---|
570 | - This version of sagbi procedure is interesting in the case of an Subalgebras |
---|
571 | with infinte SAGBI basis. In this case, by means of this procedure, |
---|
572 | we may check for example, if the elements of this basis have a particular form. |
---|
573 | EXAMPLE: example sagbiPart; show example " |
---|
574 | { |
---|
575 | degBound=0; |
---|
576 | ideal S,oldS,Red; |
---|
577 | int counter; |
---|
578 | list L; |
---|
579 | S=intRed(id,k,#); |
---|
580 | while((size(S)!=size(oldS))&&(counter<=c)) |
---|
581 | { |
---|
582 | L=Spoly1(L,S,Red,2); |
---|
583 | Red=L[1]; |
---|
584 | Red=sagbiNF(Red,S,k,#); |
---|
585 | oldS=S; |
---|
586 | S=S+Red; |
---|
587 | counter=counter+1; |
---|
588 | } |
---|
589 | return(S); |
---|
590 | } |
---|
591 | example |
---|
592 | { "EXAMPLE:"; echo = 2; |
---|
593 | ring r= 0,(x,y),dp; |
---|
594 | ideal I=x,xy-y2,xy2;//the corresponding Subalgebra has an infinte SAGBI basis |
---|
595 | sagbiPart(I,1,3);// computations should stop after 3 turns. |
---|
596 | } |
---|
597 | ////////////////////////////////////////////////////////////////////////////// |
---|