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

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