source: git/Singular/LIB/invar.lib @ d2b2a7

spielwiese
Last change on this file since d2b2a7 was d2b2a7, checked in by Kai Krüger <krueger@…>, 26 years ago
Modified Files: libparse.l utils.cc LIB/classify.lib LIB/deform.lib LIB/elim.lib LIB/factor.lib LIB/fastsolv.lib LIB/finvar.lib LIB/general.lib LIB/hnoether.lib LIB/homolog.lib LIB/inout.lib LIB/invar.lib LIB/makedbm.lib LIB/matrix.lib LIB/normal.lib LIB/poly.lib LIB/presolve.lib LIB/primdec.lib LIB/primitiv.lib LIB/random.lib LIB/ring.lib LIB/sing.lib LIB/standard.lib LIB/tex.lib LIB/tst.lib Changed help section o procedures to have an quoted help-string between proc-definition and proc-body. git-svn-id: file:///usr/local/Singular/svn/trunk@1601 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 15.0 KB
RevLine 
[d2b2a7]1// $Id: invar.lib,v 1.6 1998-05-05 11:55:30 krueger Exp $
[4b35a90]2///////////////////////////////////////////////////////
3// invar.lib
4// algorithm for computing the ring of invariants under
[5dc4ea]5// the action of the additive group (C,+)
[4b35a90]6// written by Gerhard Pfister
7//////////////////////////////////////////////////////
8
[d2b2a7]9version="$Id: invar.lib,v 1.6 1998-05-05 11:55:30 krueger Exp $";
[5480da]10info="
[e801fe]11LIBRARY: invar.lib PROCEDURES FOR COMPUTING INVARIANTS OF (C,+)-ACTIONS
[4b35a90]12
13  invariantRing(matrix m,poly p,poly q,int choose)
14  // ring of invariants of the action of the additive group
15  // defined by the vectorfield corresponding to the matrix m
16  // (m[i,1] are the coefficients of d/dx(i))
17  // the polys p and q are assumed to be variables x(i) and x(j)
18  // such that m[j,1]=0 and m[i,1]=x(j)
19  // if choose=0 the computation stops if generators of the ring
20  // of invariants are computed (to be used only if you know that
21  // the ring of invariants is finitey generated)
22  // if choose<>0 it computes invariants up to degree choose
23   
24  actionIsProper(matrix m)
25  // returns 1 if the action of the additive group defined by the
26  // matrix m as above i proper and 0 if not.
[5480da]27";
[4b35a90]28
29///////////////////////////////////////////////////////////////////////////////
30
31LIB "inout.lib";
32LIB "general.lib";
33
34///////////////////////////////////////////////////////////////////////////////
35
36
37proc sortier(ideal id)
38{
39  if(size(id)==0)
40  {
41     return(id);
42  }
43  intvec i=sortvec(id);
44  int j;
45  ideal m;
46  for (j=1;j<=size(i);j++)
47  {
48    m[j] = id[i[j]];
49  }
50  return(m);
51}
52example
53{ "EXAMPLE:"; echo = 2;
54   ring q=0,(x,y,z,u,v,w),dp;
55   ideal i=w,x,z,y,v;
56   ideal j=sortier(i);
57   j;
58}
59
60
61///////////////////////////////////////////////////////////////////////////////
62
63
64proc der (matrix m, poly f)
[d2b2a7]65"USAGE:   der(m,f);  m matrix, f poly
[4b35a90]66RETURN:  poly= application of the vectorfield m befined by the matrix m
67         (m[i,1] are the coefficients of d/dx(i)) to f
68NOTE:   
69EXAMPLE: example der; shows an example
[d2b2a7]70"
[4b35a90]71{
72  matrix mh=matrix(jacob(f))*m;
73  return(mh[1,1]);
74}
75example
76{ "EXAMPLE:"; echo = 2;
77   ring q=0,(x,y,z,u,v,w),dp;
78   poly f=2xz-y2;
79   matrix m[6][1];
80   m[2,1]=x;
81   m[3,1]=y;
82   m[5,1]=u;
83   m[6,1]=v;
84   der(m,f);
85}
86
87///////////////////////////////////////////////////////////////////////////////
88
89
90proc actionIsProper(matrix m)
[d2b2a7]91"USAGE:   actionIsProper(m); m matrix
[4b35a90]92RETURN:  int= 1 if is proper, 0 else
93NOTE:   
94EXAMPLE: example actionIsProper; shows an example
[d2b2a7]95"
[4b35a90]96{
97  int i;
98  ideal id=maxideal(1);
99  def bsr=basering;
100
101  //changes the basering bsr to bsr[@t]
102  execute "ring s="+charstr(basering)+",("+varstr(basering)+",@t),dp;";
103  poly inv,delta,tee,j;
104  ideal id=imap(bsr,id);
105  matrix @m[size(id)+1][1];
106  @m=imap(bsr,m),0;
107
108  //computes the exp(@t*m)(var(i)) for all i
109  for(i=1;i<=nvars(basering)-1;i++)
110  {
111     inv=var(i);
112     delta=der(@m,inv);
113     j=1;
114     tee=@t;
115     while(delta!=0)
116     {
117        inv=inv+1/j*delta*tee;
118        j=j*(j+1);
119        tee=tee*@t;
120        delta=der(@m,delta);
121     }
122     id=id+ideal(inv);   
123  }
124  i=inSubring(@t,id)[1];
125  setring(bsr);
126  return(i);
127}
128example
129{ "EXAMPLE:"; echo = 2;
130
131  ring rf=0,(x(1..7)),dp;
132  matrix m[7][1];
133  m[4,1]=x(1)^3;
134  m[5,1]=x(2)^3;
135  m[6,1]=x(3)^3;
136  m[7,1]=(x(1)*x(2)*x(3))^2;
137  actionIsProper(m);
138
139  ring rd=0,(x(1..5)),dp;
140  matrix m[5][1];
141  m[3,1]=x(1);
142  m[4,1]=x(2);
143  m[5,1]=1+x(1)*x(4)^2
144  actionIsProper(m);
145}
146///////////////////////////////////////////////////////////////////////////////
147
148
[e801fe]149proc reduction(poly p, ideal dom, list #)
[d2b2a7]150"USAGE:   reduction(p,dom,q); p poly, dom ideal, q (optional) monomial
[4b35a90]151RETURN:  poly= (p-H(f1,...,fr))/q^a, if Lt(p)=H(Lt(f1),...,Lt(fr)) for
152               some polynomial H in r variables over the base field,
153               a maximal such that q^a devides p-H(f1,...,fr),
[e801fe]154               dom =(f1,...,fr)
[4b35a90]155NOTE:   
156EXAMPLE: example reduction; shows an example
[d2b2a7]157"
[4b35a90]158{
159  int i;
[e801fe]160  int z=size(dom);
[4b35a90]161  def bsr=basering;
162 
163  //arranges the monomial v for elimination
164  poly v=var(1);
165  for (i=2;i<=nvars(basering);i=i+1)
166  {
167    v=v*var(i);
168  }
169
170  //changes the basering bsr to bsr[@(0),...,@(z)]
171  execute "ring s="+charstr(basering)+",("+varstr(basering)+",@(0..z)),dp;";
172 
[e801fe]173  //costructes the ideal dom=(p-@(0),dom[1]-@(1),...,dom[z]-@(z))
174  ideal dom=imap(bsr,dom);
[4b35a90]175  for (i=1;i<=z;i++)
176  {
[e801fe]177    dom[i]=lead(dom[i])-var(nvars(bsr)+i+1);
[4b35a90]178  }
[e801fe]179  dom=lead(imap(bsr,p))-@(0),dom;
[4b35a90]180 
181  //eliminates the variables of the basering bsr
[e801fe]182  //i.e. computes dom intersected with K[@(0),...,@(z)]
183  ideal kern=eliminate(dom,imap(bsr,v));
[4b35a90]184
185  // test wether @(0)-h(@(1),...,@(z)) is in ker for some poly h
186  poly h;
187  z=size(kern);
188  for (i=1;i<=z;i++)
189  {
190     h=kern[i]/@(0);
191     if (deg(h)==0)
192     {
193        h=(1/h)*kern[i];
[e801fe]194        // defines the map psi : s ---> bsr defined by @(i) ---> p,dom[i]
[4b35a90]195        setring bsr;
[e801fe]196        map psi=s,maxideal(1),p,dom;
[4b35a90]197        poly re=psi(h);
198
199        // devides by the maximal power of #[1]
200        if (size(#)>0)
201        {
202           while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0))
203           {
204             re=re/#[1];
205           }
206        }
207
208        return(re);
209     }
210  }
211  setring bsr;
212  return(p);
213}
214example
215{ "EXAMPLE:"; echo = 2;
216   ring q=0,(x,y,z,u,v,w),dp;
217   poly p=x2yz-x2v;
[e801fe]218   ideal dom =x-w,u2w+1,yz-v;
219   reduction(p,dom);
220   reduction(p,dom,w);
[4b35a90]221}
222
223///////////////////////////////////////////////////////////////////////////////
224
[e801fe]225proc completeReduction(poly p, ideal dom, list #)
[d2b2a7]226"USAGE:   completeReduction(p,dom,q); p poly, dom ideal,
[4b35a90]227                                     q (optional) monomial
[e801fe]228RETURN:  poly= the polynomial p reduced with dom via the procedure
[4b35a90]229               reduction as long as possible
230NOTE:   
231EXAMPLE: example completeReduction; shows an example
[d2b2a7]232"
[4b35a90]233{
234  poly p1=p;
[e801fe]235  poly p2=reduction(p,dom,#);
[4b35a90]236  while (p1!=p2)
237  {
238    p1=p2;
[e801fe]239    p2=reduction(p1,dom,#);
[4b35a90]240  }
241  return(p2);
242}
243example
244{ "EXAMPLE:"; echo = 2;
245   ring q=0,(x,y,z,u,v,w),dp;
246   poly p=x2yz-x2v;
[e801fe]247   ideal dom =x-w,u2w+1,yz-v;
248   completeReduction(p,dom);
249   completeReduction(p,dom,w);
[4b35a90]250}
251///////////////////////////////////////////////////////////////////////////////
252
[e801fe]253proc inSubring(poly p, ideal dom)
[d2b2a7]254"USAGE:   inSubring(p,dom); p poly, dom ideal
[e801fe]255RETURN:  list= 1,string(@(0)-h(@(1),...,@(size(dom)))) :if p = h(dom[1],...,dom[size(dom)])
256              0,string(h(@(0),...,@(size(dom)))) :if there is only a nonlinear relation
257              h(p,dom[1],...,dom[size(dom)])=0.
[4b35a90]258NOTE:   
259EXAMPLE: example inSubring; shows an example
[d2b2a7]260"
[4b35a90]261{
[e801fe]262  int z=size(dom);
[4b35a90]263  int i;
264  def gnir=basering;
265  list l;
266  poly mile=var(1);
267  for (i=2;i<=nvars(basering);i++)
268  {
269    mile=mile*var(i);
270  }
271  string eli=string(mile);
[e801fe]272  // the intersection of ideal nett=(p-@(0),dom[1]-@(1),...)
[4b35a90]273  // with the ring k[@(0),...,@(n)] is computed, the result is ker
274  execute "ring r1="+charstr(basering)+",("+varstr(basering)+",@(0..z)),dp;";
[e801fe]275  ideal nett=imap(gnir,dom);
[4b35a90]276  poly p;
277  for (i=1;i<=z;i++)
278  {
279    execute "p=@("+string(i)+");";
280    nett[i]=nett[i]-p;
281  }
282  nett=imap(gnir,p)-@(0),nett;
283  execute "ideal ker=eliminate(nett,"+eli+");";
284  // test wether @(0)-h(@(1),...,@(z)) is in ker
285  l[1]=0;
286  l[2]="";
287  for (i=1;i<=size(ker);i++)
288  {
289     if (deg(ker[i]/@(0))==0)
290     {
291        string str=string(ker[i]);
292        setring gnir;
293        l[1]=1;
294        l[2]=str;
295        return(l);
296     }
297     if (deg(ker[i]/@(0))>0)
298     {
299        l[2]=l[2]+string(ker[i]);
300     }
301  }
302  setring gnir;
303  return(l);
304}
305example
306{ "EXAMPLE:"; echo = 2;
307   ring q=0,(x,y,z,u,v,w),dp;
308   poly p=xyzu2w-1yzu2w2+u4w2-1xu2vw+u2vw2+xyz-1yzw+2u2w-1xv+vw+2;
[e801fe]309   ideal dom =x-w,u2w+1,yz-v;
310   inSubring(p,dom);
[4b35a90]311}
312
313///////////////////////////////////////////////////////////////////////////////
314
315proc localInvar(matrix m, poly p, poly q, poly h)
[d2b2a7]316"USAGE:   localInvar(m,p,q,h); m matrix, p,q,h poly
[4b35a90]317RETURN:  poly= the invariant of the vectorfield m=Sum m[i,1]*d/dx(i) with respect
318               to p,q,h, i.e.
319               Sum (-1)^v*(1/v!)*m^v(p)*(q/m(q))^v)*m(q)^N, m^N(q)=0, m^(N-1)(q)<>0
320               it is assumed that m(q) and h are invariant
321               the sum above is divided by h as much as possible
322NOTE:   
323EXAMPLE: example localInvar; shows an example
[d2b2a7]324"
[4b35a90]325{
326  if ((der(m,h) !=0) || (der(m,der(m,q)) !=0))
327  {
328    "the last variable defines not an invariant function ";
329    return(q);
330  }
331  poly inv=p;
332  poly dif= der(m,inv);
333  poly a=der(m,q);
334  poly sgn=-1;
335  poly coeff=sgn*q;
336  int k=1;
337  if (dif==0)
338  {
339    return(inv);
340  }
341  while (dif!=0)
342  {
343    inv=(a*inv)+(coeff*dif);
344    dif=der(m,dif);
345    k=k+1;
346    coeff=q*coeff*sgn/k;
347  }
348  while ((inv!=0) && (inv!=h) &&(subst(inv,h,0)==0))
349 {
350   inv=inv/h;
351  }
352  return(inv);
353}
354example
355{ "EXAMPLE:"; echo = 2;
356   ring q=0,(x,y,z),dp;
357   matrix m[3][1];
358   m[2,1]=x;
359   m[3,1]=y;
360   poly in=localInvar(m,z,y,x);
361   in;
362}
363///////////////////////////////////////////////////////////////////////////////
364
365
366
367proc furtherInvar(matrix m, ideal id, ideal karl, poly q)
[d2b2a7]368"USAGE:   furtherInvar(m,id,karl,q); m matrix, id,karl ideal,q poly
[4b35a90]369RETURN:  ideal= further invariants of the vectorfield m=Sum m[i,1]*d/dx(i) with respect
370               to id,p,q, i.e.
371               the ideal id contains invariants of m and we are looking for elements
372               in the subring generated by id which are divisible by q
373               it is assumed that m(p) and q are invariant
374               the elements mentioned  above are computed and divided by q
375               as much as possible
376               the ideal karl contains all invariants computed yet
377NOTE:   
378EXAMPLE: example furtherInvar; shows an example
[d2b2a7]379"
[4b35a90]380{
381  int i;
382  ideal null;
383  int z=size(id);
384  intvec v;
385  def @r=basering;
386  ideal su;
387  for (i=1;i<=z;i++)
388  {
389    su[i]=subst(id[i],q,0);
390  }
391  // defines the map phi : r1 ---> @r defined by
392  // y(i) ---> id[i](q=0)
393  execute "ring r1="+charstr(basering)+",(y(1..z)),dp";
394  setring @r;
395  map phi=r1,su;
396  setring r1; 
397  // computes the kernel of phi
398  execute "ideal ker=preimage(@r,phi,null)";
399  // defines the map psi : r1 ---> @r defined by y(i) ---> id[i]
400  setring @r;
401  map psi=r1,id;
402  // computes psi(ker(phi))
403  ideal rel=psi(ker);
404  // devides by the maximal power of q
405  // and tests wether we really obtain invariants
406  for (i=1;i<=size(rel);i++)
407  {
408    while ((rel[i]!=0) && (rel[i]!=q) &&(subst(rel[i],q,0)==0))
409    {
410      rel[i]=rel[i]/q;
411      if (der(m,rel[i])!=0)
412      {
413         "error in furtherInvar, function not invariant";
414         rel[i];
415      }
416    }
417    rel[i]=simplify(rel[i],1);
418  }
419  // test whether some variables occur linearly
420  // and deletes the corresponding invariant function
421  setring r1;
422  int j;
423  for (i=1;i<=size(ker);i=i+1)
424  {
425     for (j=1;j<=z;j++)
426     {
427        if (deg(ker[i]/y(j))==0)
428        {
429           setring @r;
430           rel[i]= completeReduction(rel[i],karl,q);
431           if(rel[i]!=0)
432           {
433              karl[j+1]=rel[i];
434              rel[i]=0;
435           }
436           setring r1;
437        }
438     }
439   
440  }
441  setring @r;
442  list l=rel+null,karl;
443  return(l);
444}
445example
446{ "EXAMPLE:"; echo = 2;
447   ring r=0,(x,y,z,u),dp;
448   matrix m[4][1];
449   m[2,1]=x;
450   m[3,1]=y;
451   m[4,1]=z;
452   ideal id=localInvar(m,z,y,x),localInvar(m,u,y,x);
453   ideal karl=id,x;
454   list in=furtherInvar(m,id,karl,x);
455   in;
456}
457///////////////////////////////////////////////////////////////////////////////
458
459
460
461proc invariantRing(matrix m, poly p, poly q,list #)
[d2b2a7]462"USAGE:   invariantRing(m,p,q); m matrix, p,q poly
[4b35a90]463RETURN:  ideal= the invariants of the vectorfield m=Sum m[i,1]*d/dx(i)
464                p,q variables with m(p)=q invariant
465NOTE:
466EXAMPLE: example furtherInvar; shows an example
[d2b2a7]467"
[4b35a90]468{
469  ideal j;
470  int i,it;
471  int bou=-1;
472  if(size(#)>0)
473  {
474     bou=#[1];
475  }
476  int z; 
477  ideal karl;
478  ideal k1=1;
479  list k2;
480  // computation of local invariants
481  for (i=1;i<=nvars(basering);i++)
482  {
483    karl=karl+localInvar(m,var(i),p,q);
484  }
485  if(bou==0)
486  {
487     "                     ";
488     "the local invariants:";
489     "                     ";
490     karl;
[e801fe]491    // pause;
[4b35a90]492     "                     ";
493  }
494  // computation of further invariants
495  it=0;
496  while (size(k1)!=0)
497 {
498    // test if the new invariants are already in the ring generated
499    // by the invariants we constructed already
500    it++;
501    karl=sortier(karl);
502    j=q;
503    for (i=1;i<=size(karl);i++)
504    {
505       j=j+ simplify(completeReduction(karl[i],j,q),1);
506    }
507    karl=j;
508    j[1]=0;
509    j=simplify(j,2);
510    k2=furtherInvar(m,j,karl,q);
511    k1=k2[1];
512    karl=k2[2];
513    k1=sortier(k1);
514    z=size(k1);   
515    for (i=1;i<=z;i++)
516    {
517      k1[i]= completeReduction(k1[i],karl,q);
518      if (k1[i]!=0)
519      {
520        karl=karl+simplify(k1[i],1);
521      }
522    }
523    if(bou==0)
524    {
525       "                                  ";
526       "the invariants after the iteration";
527       it;
528       "                                  ";
529       karl;
[e801fe]530      // pause;
[4b35a90]531       "                                  ";
532    }
533    if((bou>0) && (size(k1)>0))
534    {
535      if(deg(k1[size(k1)])>bou)
536      {
537         return(karl);
538      }
539    }
540  }
541  return(karl);
542}
543example
544{ "EXAMPLE:"; echo = 2;
545
546  //Winkelmann: free action but Spec k[x(1),...,x(5)]---> Spec In-
547  //variantring is not surjective
548 
549  ring rw=0,(x(1..5)),dp;
550  matrix m[5][1];
551  m[3,1]=x(1);
552  m[4,1]=x(2);
553  m[5,1]=1+x(1)*x(4)+x(2)*x(3);
554  ideal in=invariantRing(m,x(3),x(1),0);
555  in;
556 
557  //Deveney/Finston: The ring of invariants is not finitely generated
558 
559  ring rf=0,(x(1..7)),dp;
560  matrix m[7][1];
561  m[4,1]=x(1)^3;
562  m[5,1]=x(2)^3;
563  m[6,1]=x(3)^3;
564  m[7,1]=(x(1)*x(2)*x(3))^2;
565  ideal in=invariantRing(m,x(4),x(1),6);
566  in;
567 
568 
569  //Deveney/Finston:Proper Ga-action which is not locally trivial
570  //r[x(1),...,x(5)] is not flat over the ring of invariants
571 
572  ring rd=0,(x(1..5)),dp;
573  matrix m[5][1];
574  m[3,1]=x(1);
575  m[4,1]=x(2);
576  m[5,1]=1+x(1)*x(4)^2;
577  ideal in=invariantRing(m,x(3),x(1));
578  in;
579 
580  actionIsProper(m);
581 
582  //computes the relations between the invariants
583  int z=size(in);
584  ideal null;
585  ring r1=0,(y(1..z)),dp;
586  setring rd;
587  map phi=r1,in;
588  setring r1; 
589  ideal ker=preimage(rd,phi,null);
590  ker;
591 
592  //the discriminant
593 
594  ring r=0,(x(1..2),y(1..2),z,t),dp;
595  poly p=z+(1+x(1)*y(2)^2)*t+x(1)*y(1)*y(2)*t^2+(1/3)*x(1)*y(1)^2*t^3;
596 
597  matrix m[5][5];
598  m[1,1]=z;
599  m[1,2]=x(1)*y(2)^2+1;
600  m[1,3]=x(1)*y(1)*y(2);
601  m[1,4]=1/3*x(1)*y(1)^2;
602  m[1,5]=0;
603  m[2,1]=0;
604  m[2,2]=z;
605  m[2,3]=x(1)*y(2)^2+1;
606  m[2,4]=x(1)*y(1)*y(2);
607  m[2,5]=1/3*x(1)*y(1)^2;
608  m[3,1]=x(1)*y(2)^2+1;
609  m[3,2]=2*x(1)*y(1)*y(2);
610  m[3,3]=x(1)*y(1)^2;
611  m[3,4]=0;
612  m[3,5]=0;
613  m[4,1]=0;
614  m[4,2]=x(1)*y(2)^2+1;
615  m[4,3]=2*x(1)*y(1)*y(2);
616  m[4,4]=x(1)*y(1)^2;
617  m[4,5]=0;
618  m[5,1]=0;
619  m[5,2]=0;
620  m[5,3]=x(1)*y(2)^2+1;
621  m[5,4]=2*x(1)*y(1)*y(2);
622  m[5,5]=x(1)*y(1)^2;
623 
624  poly disc=9*det(m)/(x(1)^2*y(1)^4);
625 
626  LIB "invar.lib";
627  matrix n[6][1];
628  n[2,1]=x(1);
629  n[4,1]=y(1);
630  n[5,1]=1+x(1)*y(2)^2;
631 
632  der(n,disc);
633 
634  //x(1)^3*y(2)^6-6*x(1)^2*y(1)*y(2)^3*z+6*x(1)^2*y(2)^4+9*x(1)*y(1)^2*z^2-18*x(1)*y(1)*y(2)*z+9*x(1)*y(2)^2+4
635 
636 
637  //constructive approach to Weizenbcks theorem
638 
639  int n=5;
640 
641  ring w=0,(x(1..n)),wp(1..n);
642 
643  // definition of the vectorfield m=sum m[i]*d/dx(i)
644  matrix m[n][1];
645  int i;
646  for (i=1;i<=n-1;i=i+1)
647  {
648    m[i+1,1]=x(i);
649  }
650  ideal in=invariantRing(m,x(2),x(1),0);
651  in;
652 
653 
654 
655}
Note: See TracBrowser for help on using the repository browser.