Changeset 68e678 in git


Ignore:
Timestamp:
Jul 19, 1999, 4:07:41 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
92b2f3e2d00d6abe7a672fb181a8eb0c95c41b0f
Parents:
b00a82cbecb96fbd56a19be975fa94c5c6ee3016
Message:
* modifications to Libraries from GMG (plus bug fixes)


git-svn-id: file:///usr/local/Singular/svn/trunk@3294 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/all.lib

    rb00a82 r68e678  
    1 // $Id: all.lib,v 1.19 1999-07-07 14:39:05 obachman Exp $
     1// $Id: all.lib,v 1.20 1999-07-19 14:07:27 obachman Exp $
    22///////////////////////////////////////////////////////////////////////////////
    33
    4 version="$Id: all.lib,v 1.19 1999-07-07 14:39:05 obachman Exp $";
     4version="$Id: all.lib,v 1.20 1999-07-19 14:07:27 obachman Exp $";
    55info="
    66LIBRARY:  all.lib   Load all libraries
     
    3232  mondromy.lib  PROCEDURES TO COMPUTE THE MONODROMY OF A SINGULARITY
    3333  jordan.lib    PROCEDURES TO COMPUTE THE JORDAN NORMAL FORM
    34   spcurve.lib    PROCEDURES FOR CM CODIMENSION 2 SINGULARITIES
     34  spcurve.lib   PROCEDURES FOR CM CODIMENSION 2 SINGULARITIES
     35  algebra.lib    PROCEDURES FOR COMPUTING WITH ALGBRAS AND MAPS
    3536";
    3637
     
    6465LIB "jordan.lib";
    6566LIB "spcurve.lib";
    66 
     67LIB "algebra.lib";
    6768// LIB "tools.lib";
  • Singular/LIB/finvar.lib

    rb00a82 r68e678  
    1 // $Id: finvar.lib,v 1.16 1999-07-06 11:32:50 obachman Exp $
     1// $Id: finvar.lib,v 1.17 1999-07-19 14:07:31 obachman Exp $
    22// author: Agnes Eileen Heydtmann, email:agnes@math.uni-sb.de
    33// last change: 98/11/05
    44//////////////////////////////////////////////////////////////////////////////
    5 version="$Id: finvar.lib,v 1.16 1999-07-06 11:32:50 obachman Exp $"
     5version="$Id: finvar.lib,v 1.17 1999-07-19 14:07:31 obachman Exp $"
    66info="
    77LIBRARY:  finvar.lib       LIBRARY TO CALCULATE INVARIANT RINGS & MORE
     
    1010 A library for computing polynomial invariants of finite matrix groups and
    1111 generators of related varieties. The algorithms are based on B. Sturmfels,
    12  G. Kemper and Decker et al..
     12 G. Kemper and W. Decker et al..
    1313
    1414AUTHOR: Agnes E. Heydtmann, agnes@math.uni-sb.de
     
    4545 secondary_and_irreducibles_no_molien() s.i. & irreducible s.i., without M.s.
    4646 secondary_not_cohen_macaulay()    s.i. when invariant ring not Cohen-Macaulay
    47  algebra_containment()             query of algebra containment
    48  module_containment()              query of module containment
    4947 orbit_variety()                   ideal of the orbit variety
    5048 relative_orbit_variety()          ideal of a relative orbit variety
    5149 image_of_variety()                ideal of the image of a variety
    5250";
    53 ////////////////////////////////////////////////////////////////////////////////
     51///////////////////////////////////////////////////////////////////////////////
    5452// perhaps useful procedures (no help provided):
    5553// unique()                        is a matrix among other matrices?
     
    6361// p_search_random                 searches a # of p.i., char p, randomized
    6462// concat_intmat                   concatenates two integer matrices
    65 ////////////////////////////////////////////////////////////////////////////////
     63///////////////////////////////////////////////////////////////////////////////
     64
    6665LIB "matrix.lib";
    6766LIB "elim.lib";
    6867LIB "general.lib";
    69 ////////////////////////////////////////////////////////////////////////////////
    70 
    71 ////////////////////////////////////////////////////////////////////////////////
     68LIB "algebra.lib";
     69///////////////////////////////////////////////////////////////////////////////
    7270// Checks whether the last parameter, being a matrix, is among the previous
    7371// parameters, also being matrices
    74 ////////////////////////////////////////////////////////////////////////////////
     72///////////////////////////////////////////////////////////////////////////////
    7573proc unique (list #)
    7674{ for (int i=1;i<size(#);i=i+1)
     
    8179  return(1);
    8280}
     81//////////////////////////////////////////////////////////////////////////////
    8382
    8483proc cyclotomic (int i)
    85 "USAGE:   cyclotomic(i);
    86          i: an <int> > 0
     84"USAGE:   cyclotomic(i); i integer > 0
    8785RETURNS: the i-th cyclotomic polynomial (type <poly>) as one in the first ring
    8886         variable
     87THEORY:  x^i-1 is divided by the j-th cyclotomic polynomial where j takes on
     88         the value of proper divisors of i
    8989EXAMPLE: example cyclotomic; shows an example
    90 THEORY:  x^i-1 is divided by the j-th cyclotomic polynomial where j takes on the
    91          value of proper divisors of i
    9290"
    9391{ if (i<=0)
     
    127125}
    128126example
    129 { echo=2;
     127{ "EXAMPLE:"; echo=2;
    130128          ring R=0,(x,y,z),dp;
    131129          print(cyclotomic(25));
    132130}
     131//////////////////////////////////////////////////////////////////////////////
    133132
    134133proc group_reynolds (list #)
     
    145144         elements are nxn <matrices> listing all elements of the finite group
    146145DISPLAY: information if v does not equal 0
    147 EXAMPLE: example group_reynolds; shows an example
    148146THEORY:  The entire matrix group is generated by getting all left products of
    149          the generators with the new elements from the last run through the loop
     147         generators with the new elements from the last run through the loop
    150148         (or the generators themselves during the first run). All the ones that
    151149         have been generated before are thrown out and the program terminates
    152          when there are no new elements found in one run. Additionally each time
     150         when no new elements were found in one run. Additionally each time
    153151         a new group element is found the corresponding ring mapping of which
    154152         the Reynolds operator is made up is generated. They are stored in the
    155153         rows of the first return value.
     154EXAMPLE: example group_reynolds; shows an example
    156155"
    157 { int ch=char(basering);               // the existance of the Reynolds operator
    158                                        // is dependent on the characteristic of
    159                                        // the base field
    160   int gen_num;                         // number of generators
     156{ int ch=char(basering);            // the existance of the Reynolds operator
     157                                    // is dependent on the characteristic of
     158                                    // the base field
     159  int gen_num;                      // number of generators
    161160 //------------------------ making sure the input is okay ---------------------
    162161  if (typeof(#[size(#)])=="int")
     
    192191                                       // operator -
    193192  matrix G(1)=#[1];                    // G(k) are elements of the group -
    194   if (ch<>0 && minpoly==0 && gen_num<>1) // finding out of which order the group
     193  if (ch<>0 && minpoly==0 && gen_num<>1) //finding out of which order the group
    195194  { matrix I=diag(1,n);                // element is
    196195    matrix TEST=G(1);
     
    259258        g=g+1;
    260259        matrix G(g)=P(k);              // a new group element -
    261         if (ch<>0 && minpoly==0 && i<>1) // finding out of which order the group
     260        if (ch<>0 && minpoly==0 && i<>1) //finding out of which order the group
    262261        { TEST=G(g);                   // element is
    263262          o2=1;
     
    285284    "";
    286285  }
    287   REY=transpose(REY);                  // when we evaluate the Reynolds operator
     286  REY=transpose(REY);                  //when we evaluate the Reynolds operator
    288287                                       // later on, we actually want 1xn
    289288                                       // matrices
     
    319318}
    320319example
    321 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    322   echo=2;
     320{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";echo=2;
    323321         ring R=0,(x,y,z),dp;
    324322         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    328326}
    329327
    330 ////////////////////////////////////////////////////////////////////////////////
     328///////////////////////////////////////////////////////////////////////////////
    331329// Returns i such that root^i==n, i.e. it heavily relies on the right input.
    332 ////////////////////////////////////////////////////////////////////////////////
     330///////////////////////////////////////////////////////////////////////////////
    333331proc exponent(number n, number root)
    334332{ int i=0;
     
    338336   return(i);
    339337}
     338//////////////////////////////////////////////////////////////////////////////
    340339
    341340proc molien (list #)
     
    343342         G1,G2,...: nxn <matrices> generating a finite matrix group, ringname:
    344343         a <string> giving a name for a new ring of characteristic 0 for the
    345          Molien series in case of prime characteristic, lcm: an <int> giving the
    346          lowest common multiple of the elements' orders in case of prime
     344         Molien series in case of prime characteristic, lcm: an <int> giving
     345         the lowest common multiple of the elements' orders in case of prime
    347346         characteristic, minpoly==0 and a non-cyclic group, flags: an optional
    348347         <intvec> with three components: if the first element is not equal to 0
    349348         characteristic 0 is simulated, i.e. the Molien series is computed as
    350349         if the base field were characteristic 0 (the user must choose a field
    351          of large prime characteristic, e.g. 32003), the second component should
     350         of large characteristic, e.g. 32003), the second component should
    352351         give the size of intervals between canceling common factors in the
    353352         expansion of the Molien series, 0 (the default) means only once after
     
    364363         Molien series (named M) is stored
    365364DISPLAY: information if the third component of flags does not equal 0
     365THEORY:  In characteristic 0 the terms 1/det(1-xE) for all group elements of
     366         the Molien series are computed in a straight forward way. In prime
     367         characteristic a Brauer lift is involved. The returned matrix gives
     368         enumerator and denominator of the expanded version where common
     369         factors have been canceled.
    366370EXAMPLE: example molien; shows an example
    367 THEORY:  In characteristic 0 the terms 1/det(1-xE) for all group elements of the
    368          Molien series are computed in a straight forward way. In prime
    369          characteristic a Brauer lift is involved. The returned matrix gives
    370          enumerator and denominator of the expanded version where common factors
    371          have been canceled.
    372371"
    373372{ def br=basering;                     // the Molien series depends on the
     
    860859example
    861860{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    862   "         note the case of prime characteristic";
    863   echo=2;
     861  "         note the case of prime characteristic"; echo=2;
    864862         ring R=0,(x,y,z),dp;
    865863         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    877875         kill alksdfjlaskdjf;
    878876}
     877///////////////////////////////////////////////////////////////////////////////
    879878
    880879proc reynolds_molien (list #)
     
    901900         created where the same Molien series (named M) is stored
    902901DISPLAY: information if the third component of flags does not equal 0
    903 EXAMPLE: example reynolds_molien; shows an example
    904902THEORY:  The entire matrix group is generated by getting all left products of
    905          the generators with the new elements from the last run through the loop
     903         the generators with new elements from the last run through the loop
    906904         (or the generators themselves during the first run). All the ones that
    907905         have been generated before are thrown out and the program terminates
    908          when there are no new elements found in one run. Additionally each time
     906         when no new elements were found in one run. Additionally each time
    909907         a new group element is found the corresponding ring mapping of which
    910908         the Reynolds operator is made up is generated. They are stored in the
     
    915913         modular case). The returned matrix gives enumerator and denominator of
    916914         the expanded version where common factors have been canceled.
     915EXAMPLE: example reynolds_molien; shows an example
    917916"
    918917{ def br=basering;                     // the Molien series depends on the
     
    14061405example
    14071406{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    1408   "         note the case of prime characteristic";
    1409   echo=2;
     1407  "         note the case of prime characteristic"; echo=2;
    14101408         ring R=0,(x,y,z),dp;
    14111409         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    14231421         kill Qadjoint;
    14241422}
     1423///////////////////////////////////////////////////////////////////////////////
    14251424
    14261425proc partial_molien (matrix M, int n, list #)
     
    14341433         (first n if there is no third parameter given, otherwise the next n
    14351434         terms depending on a previous calculation) and an intermediate result
    1436          (type <poly>) of the calculation to be used as third parameter in a next
    1437          run of partial_molien
     1435         (type <poly>) of the calculation to be used as third parameter in a
     1436         next run of partial_molien
    14381437THEORY:  The following calculation is implemented:
    14391438         (1+a1x+a2x^2+...+anx^n)/(1+b1x+b2x^2+...+bmx^m)=(1+(a1-b1)x+...
     
    14991498}
    15001499example
    1501 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    1502   echo=2;
     1500{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    15031501         ring R=0,(x,y,z),dp;
    15041502         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    15101508         p(1);
    15111509}
     1510///////////////////////////////////////////////////////////////////////////////
    15121511
    15131512proc evaluate_reynolds (matrix REY, ideal I)
     
    15201519NOTE:    the characteristic of the coefficient field of the polynomial ring
    15211520         should not divide the order of the finite matrix group
    1522 EXAMPLE: example evaluate_reynolds; shows an example
    15231521THEORY:  REY has been constructed in such a way that each row serves as a ring
    15241522         mapping of which the Reynolds operator is made up.
     1523EXAMPLE: example evaluate_reynolds; shows an example
    15251524"
    15261525{ def br=basering;
     
    15511550}
    15521551example
    1553 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    1554   echo=2;
     1552{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    15551553         ring R=0,(x,y,z),dp;
    15561554         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    15591557         print(evaluate_reynolds(L[1],I));
    15601558}
     1559///////////////////////////////////////////////////////////////////////////////
    15611560
    15621561proc invariant_basis (int g,list #)
     
    15651564         shoud be, G1,G2,...: <matrices> generating a finite matrix group
    15661565RETURNS: the basis (type <ideal>) of the space of invariants of degree g
    1567 EXAMPLE: example invariant_basis; shows an example
    1568 THEORY:  A general polynomial of degree g is generated and the generators of the
    1569          matrix group applied. The difference ought to be 0 and this way a
     1566THEORY:  A general polynomial of degree g is generated and the generators of
     1567         the matrix group applied. The difference ought to be 0 and this way a
    15701568         system of linear equations is created. It is solved by computing
    15711569         syzygies.
     1570EXAMPLE: example invariant_basis; shows an example
    15721571"
    15731572{ if (g<=0)
     
    16431642}
    16441643example
    1645 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    1646   echo=2;
     1644{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    16471645           ring R=0,(x,y,z),dp;
    16481646           matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
    16491647           print(invariant_basis(2,A));
    16501648}
     1649///////////////////////////////////////////////////////////////////////////////
    16511650
    16521651proc invariant_basis_reynolds (matrix REY,int d,list #)
     
    16641663         and flags[1] given by partial_molien
    16651664RETURN:  the basis (type <ideal>) of the space of invariants of degree d
    1666 EXAMPLE: example invariant_basis_reynolds; shows an example
    16671665THEORY:  Monomials of degree d are mapped to invariants with the Reynolds
    16681666         operator. A linearly independent set is generated with the help of
    16691667         minbase.
     1668EXAMPLE: example invariant_basis_reynolds; shows an example
    16701669"
    16711670{
     
    17121711 //----------------------------------------------------------------------------
    17131712  ideal mon=sort(maxideal(d))[1];
     1713  int DEGB = degBound;
    17141714  degBound=d;
    17151715  int j=ncols(mon);
     
    17201720    { B=evaluate_reynolds(REY,mon);    // invariants at once
    17211721      B=minbase(B);
    1722       degBound=0;
     1722      degBound=DEGB;
    17231723      return(B);
    17241724    }
     
    17281728    { B=evaluate_reynolds(REY,mon);    // invariants at once
    17291729      B=minbase(B);
    1730       degBound=0;
     1730      degBound=DEGB;
    17311731      return(B);
    17321732    }
     
    17501750    B=minbase(B+evaluate_reynolds(REY,part_mon));
    17511751    if ((ncols(B)==cd and B[1]<>0) or upper_bound==j)
    1752     { degBound=0;
     1752    { degBound=DEGB;
    17531753      return(B);
    17541754    }
     
    17561756}
    17571757example
    1758 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    1759   echo=2;
    1760            ring R=0,(x,y,z),dp;
    1761            matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
    1762            intvec flags=0,1,0;
    1763            matrix REY,M=reynolds_molien(A,flags);
    1764            flags=8,6;
    1765            print(invariant_basis_reynolds(REY,6,flags));
     1758{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
     1759   ring R=0,(x,y,z),dp;
     1760   matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     1761   intvec flags=0,1,0;
     1762   matrix REY,M=reynolds_molien(A,flags);
     1763   flags=8,6;
     1764   print(invariant_basis_reynolds(REY,6,flags));
    17661765}
    17671766
    1768 ////////////////////////////////////////////////////////////////////////////////
    1769 // This procedure generates linearly independent invariant polynomials of degree
     1767///////////////////////////////////////////////////////////////////////////////
     1768//This procedure generates linearly independent invariant polynomials of degree
    17701769// d that do not reduce to 0 modulo the primary invariants. It does this by
    17711770// applying the Reynolds operator to the monomials returned by kbase(sP,d). The
    17721771// result is used when computing secondary invariants.
    1773 ////////////////////////////////////////////////////////////////////////////////
     1772///////////////////////////////////////////////////////////////////////////////
    17741773proc sort_of_invariant_basis (ideal sP,matrix REY,int d,int step_fac)
    17751774{ ideal mon=kbase(sP,d);
     1775  int DEGB = degBound;
    17761776  degBound=d;
    17771777  int j=ncols(mon);
     
    17871787    }
    17881788    B=minbase(B);                      // here are the linearly independent ones
    1789     degBound=0;
     1789    degBound=DEGB;
    17901790    return(B);
    17911791  }
     
    18081808    B=minbase(B+part_mon);             // here are the linearly independent ones
    18091809    if (upper_bound==j)
    1810     { degBound=0;
     1810    { degBound=DEGB;
    18111811      return(B);
    18121812    }
     
    18141814}
    18151815
    1816 ////////////////////////////////////////////////////////////////////////////////
     1816///////////////////////////////////////////////////////////////////////////////
    18171817// Procedure returning the succeeding vector after vec. It is used to list
    18181818// all the vectors of Z^n with first nonzero entry 1. They are listed by
    18191819// increasing sum of the absolute value of their entries.
    1820 ////////////////////////////////////////////////////////////////////////////////
     1820///////////////////////////////////////////////////////////////////////////////
    18211821proc next_vector(intmat vec)
    18221822{ int n=ncols(vec);                    // p: >0, n: <0, p0: >=0, n0: <=0
     
    18761876}
    18771877
    1878 ////////////////////////////////////////////////////////////////////////////////
     1878///////////////////////////////////////////////////////////////////////////////
    18791879// Maps integers to elements of the base field. It is only called if the base
    1880 // field is of prime characteristic. If the base field has q elements (depending
    1881 // on minpoly) 1..q is mapped to those q elements.
    1882 ////////////////////////////////////////////////////////////////////////////////
     1880// field is of prime characteristic. If the base field has q elements
     1881// (depending on minpoly) 1..q is mapped to those q elements.
     1882///////////////////////////////////////////////////////////////////////////////
    18831883proc int_number_map (int i)
    18841884{ int p=char(basering);
     
    19121912}
    19131913
    1914 ////////////////////////////////////////////////////////////////////////////////
     1914///////////////////////////////////////////////////////////////////////////////
    19151915// This procedure finds dif primary invariants in degree d. It returns all
    19161916// primary invariants found so far. The coefficients lie in a field of
    19171917// characteristic 0.
    1918 ////////////////////////////////////////////////////////////////////////////////
     1918///////////////////////////////////////////////////////////////////////////////
    19191919proc search (int n,int d,ideal B,int cd,ideal P,ideal sP,int i,int dif,int dB,ideal CI)
    19201920{ intmat vec[1][cd];                   // the coefficients for the next
     
    19611961}
    19621962
    1963 ////////////////////////////////////////////////////////////////////////////////
     1963///////////////////////////////////////////////////////////////////////////////
    19641964// This procedure finds at most dif primary invariants in degree d. It returns
    19651965// all primary invariants found so far. The coefficients lie in the field of
    19661966// characteristic p>0.
    1967 ////////////////////////////////////////////////////////////////////////////////
     1967///////////////////////////////////////////////////////////////////////////////
    19681968proc p_search (int n,int d,ideal B,int cd,ideal P,ideal sP,int i,int dif,int dB,ideal CI)
    19691969{ def br=basering;
     
    20492049  return(P,sP,CI,dB);
    20502050}
     2051///////////////////////////////////////////////////////////////////////////////
    20512052
    20522053proc primary_char0 (matrix REY,matrix M,list #)
     
    20592060         equal 0
    20602061RETURN:  primary invariants (type <matrix>) of the invariant ring
    2061 EXAMPLE: example primary_char0; shows an example
    20622062THEORY:  Bases of homogeneous invariants are generated successively and those
    20632063         are chosen as primary invariants that lower the dimension of the ideal
     
    20652065         Noetherian Normalization of the Invariant Ring of a Finite Group\" by
    20662066         Decker, Heydtmann, Schreyer (1997) to appear in JSC).
     2067EXAMPLE: example primary_char0; shows an example
    20672068"
    20682069{ degBound=0;
    20692070  if (char(basering)<>0)
    2070   { "ERROR:   primary_char0 should only be used with rings of characteristic 0.";
     2071  { "ERROR: primary_char0 should only be used with rings of characteristic 0.";
    20712072    return();
    20722073  }
     
    21822183}
    21832184example
    2184 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    2185   echo=2;
     2185{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    21862186         ring R=0,(x,y,z),dp;
    21872187         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    21902190         print(P);
    21912191}
     2192///////////////////////////////////////////////////////////////////////////////
    21922193
    21932194proc primary_charp (matrix REY,string ring_name,list #)
     
    22022203         equal 0
    22032204RETURN:  primary invariants (type <matrix>) of the invariant ring
    2204 EXAMPLE: example primary_charp; shows an example
    22052205THEORY:  Bases of homogeneous invariants are generated successively and those
    22062206         are chosen as primary invariants that lower the dimension of the ideal
     
    22082208         Noetherian Normalization of the Invariant Ring of a Finite Group\" by
    22092209         Decker, Heydtmann, Schreyer (1997) to appear in JSC).
     2210EXAMPLE: example primary_charp; shows an example
    22102211"
    22112212{ degBound=0;
     
    23312332}
    23322333example
    2333 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed into";
    2334   "         characteristic 3)";
    2335   echo=2;
     2334{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed to char 3)";  echo=2;
    23362335         ring R=3,(x,y,z),dp;
    23372336         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    23442343         print(P);
    23452344}
     2345///////////////////////////////////////////////////////////////////////////////
    23462346
    23472347proc primary_char0_no_molien (matrix REY, list #)
     
    23552355         <intvec> listing some of the degrees where no non-trivial homogeneous
    23562356         invariants are to be found
    2357 EXAMPLE: example primary_char0_no_molien; shows an example
    23582357THEORY:  Bases of homogeneous invariants are generated successively and those
    23592358         are chosen as primary invariants that lower the dimension of the ideal
     
    23612360         Noetherian Normalization of the Invariant Ring of a Finite Group\" by
    23622361         Decker, Heydtmann, Schreyer (1997) to appear in JSC).
     2362EXAMPLE: example primary_char0_no_molien; shows an example
    23632363"
    23642364{ degBound=0;
     
    24792479}
    24802480example
    2481 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    2482   echo=2;
     2481{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";echo=2;
    24832482         ring R=0,(x,y,z),dp;
    24842483         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    24872486         print(l[1]);
    24882487}
     2488///////////////////////////////////////////////////////////////////////////////
    24892489
    24902490proc primary_charp_no_molien (matrix REY, list #)
     
    24982498         <intvec> listing some of the degrees where no non-trivial homogeneous
    24992499         invariants are to be found
    2500 EXAMPLE: example primary_charp_no_molien; shows an example
    25012500THEORY:  Bases of homogeneous invariants are generated successively and those
    25022501         are chosen as primary invariants that lower the dimension of the ideal
     
    25042503         Noetherian Normalization of the Invariant Ring of a Finite Group\" by
    25052504         Decker, Heydtmann, Schreyer (1997) to appear in JSC).
     2505EXAMPLE: example primary_charp_no_molien; shows an example
    25062506"
    25072507{ degBound=0;
     
    26232623}
    26242624example
    2625 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed into";
    2626   "         characteristic 3)";
    2627   echo=2;
     2625{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed to char 3)"; echo=2;
    26282626         ring R=3,(x,y,z),dp;
    26292627         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    26322630         print(l[1]);
    26332631}
     2632///////////////////////////////////////////////////////////////////////////////
    26342633
    26352634proc primary_charp_without (list #)
     
    26402639         equal 0
    26412640RETURN:  primary invariants (type <matrix>) of the invariant ring
    2642 EXAMPLE: example primary_charp_without; shows an example
    26432641THEORY:  Bases of homogeneous invariants are generated successively and those
    26442642         are chosen as primary invariants that lower the dimension of the ideal
     
    26472645         Decker, Heydtmann, Schreyer (1997) to appear in JSC). No Reynolds
    26482646         operator or Molien series is used.
     2647EXAMPLE: example primary_charp_without; shows an example
    26492648"
    26502649{ degBound=0;
     
    27652764}
    27662765example
    2767 { echo=2;
     2766{"EXAMPLE:";echo=2;
    27682767         ring R=2,(x,y,z),dp;
    27692768         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    27712770         print(P);
    27722771}
     2772///////////////////////////////////////////////////////////////////////////////
    27732773
    27742774proc primary_invariants (list #)
     
    27882788         characteristic also a negative number can be given to indicate that
    27892789         common factors should always be canceled when the expansion is simple
    2790          (the root of the extension field does not occur among the coefficients)
     2790         (the root of the extension field occurs not among the coefficients)
    27912791DISPLAY: information about the various stages of the programme if the third
    27922792         flag does not equal 0
     
    27962796         then an <intvec> is returned giving some of the degrees where no
    27972797         non-trivial homogeneous invariants can be found
    2798 EXAMPLE: example primary_invariants; shows an example
    27992798THEORY:  Bases of homogeneous invariants are generated successively and those
    28002799         are chosen as primary invariants that lower the dimension of the ideal
     
    28022801         Noetherian Normalization of the Invariant Ring of a Finite Group\" by
    28032802         Decker, Heydtmann, Schreyer (1997) to appear in JSC).
     2803EXAMPLE: example primary_invariants; shows an example
    28042804"
    28052805{
     
    29702970}
    29712971
    2972 ////////////////////////////////////////////////////////////////////////////////
     2972///////////////////////////////////////////////////////////////////////////////
    29732973// This procedure finds dif primary invariants in degree d. It returns all
    29742974// primary invariants found so far. The coefficients lie in a field of
    29752975// characteristic 0.
    2976 ////////////////////////////////////////////////////////////////////////////////
     2976///////////////////////////////////////////////////////////////////////////////
    29772977proc search_random (int n,int d,ideal B,int cd,ideal P,int i,int dif,int dB,ideal CI,int max)
    29782978{ string answer;
     
    30663066}
    30673067
    3068 ////////////////////////////////////////////////////////////////////////////////
     3068///////////////////////////////////////////////////////////////////////////////
    30693069// This procedure finds at most dif primary invariants in degree d. It returns
    30703070// all primary invariants found so far. The coefficients lie in the field of
    30713071// characteristic p>0.
    3072 ////////////////////////////////////////////////////////////////////////////////
     3072///////////////////////////////////////////////////////////////////////////////
    30733073proc p_search_random (int n,int d,ideal B,int cd,ideal P,int i,int dif,int dB,ideal CI,int max)
    30743074{ string answer;
     
    31803180  return(P,CI,dB);
    31813181}
     3182///////////////////////////////////////////////////////////////////////////////
    31823183
    31833184proc primary_char0_random (matrix REY,matrix M,int max,list #)
     
    31923193         equal 0
    31933194RETURN:  primary invariants (type <matrix>) of the invariant ring
    3194 EXAMPLE: example primary_char0_random; shows an example
    31953195THEORY:  Bases of homogeneous invariants are generated successively and random
    31963196         linear combinations are chosen as primary invariants that lower the
    31973197         dimension of the ideal generated by the previously found invariants
    3198          (see paper \"Generating a Noetherian Normalization of the Invariant Ring
     3198         (see \"Generating a Noetherian Normalization of the Invariant Ring
    31993199         of a Finite Group\" by Decker, Heydtmann, Schreyer (1997) to appear in
    32003200         JSC).
     3201EXAMPLE: example primary_char0_random; shows an example
    32013202"
    32023203{ degBound=0;
     
    33193320}
    33203321example
    3321 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    3322   echo=2;
     3322{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";echo=2;
    33233323         ring R=0,(x,y,z),dp;
    33243324         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    33273327         print(P);
    33283328}
     3329///////////////////////////////////////////////////////////////////////////////
    33293330
    33303331proc primary_charp_random (matrix REY,string ring_name,int max,list #)
     
    33403341         equal 0
    33413342RETURN:  primary invariants (type <matrix>) of the invariant ring
    3342 EXAMPLE: example primary_charp_random; shows an example
    33433343THEORY:  Bases of homogeneous invariants are generated successively and random
    33443344         linear combinations are chosen as primary invariants that lower the
    33453345         dimension of the ideal generated by the previously found invariants
    3346          (see paper \"Generating a Noetherian Normalization of the Invariant Ring
     3346         (see \"Generating a Noetherian Normalization of the Invariant Ring
    33473347         of a Finite Group\" by Decker, Heydtmann, Schreyer (1997) to appear in
    33483348         JSC).
     3349EXAMPLE: example primary_charp_random; shows an example
    33493350"
    33503351{ degBound=0;
     
    34733474}
    34743475example
    3475 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed into";
    3476   "         characteristic 3)";
    3477   echo=2;
     3476{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed to char 3)"; echo=2;
    34783477         ring R=3,(x,y,z),dp;
    34793478         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    34863485         print(P);
    34873486}
     3487///////////////////////////////////////////////////////////////////////////////
    34883488
    34893489proc primary_char0_no_molien_random (matrix REY, int max, list #)
     
    34983498         <intvec> listing some of the degrees where no non-trivial homogeneous
    34993499         invariants are to be found
    3500 EXAMPLE: example primary_char0_no_molien_random; shows an example
    35013500THEORY:  Bases of homogeneous invariants are generated successively and random
    35023501         linear combinations are chosen as primary invariants that lower the
    35033502         dimension of the ideal generated by the previously found invariants
    3504          (see paper \"Generating a Noetherian Normalization of the Invariant Ring
     3503         (see \"Generating a Noetherian Normalization of the Invariant Ring
    35053504         of a Finite Group\" by Decker, Heydtmann, Schreyer (1997) to appear in
    35063505         JSC).
     3506EXAMPLE: example primary_char0_no_molien_random; shows an example
    35073507"
    35083508{ degBound=0;
     
    36263626}
    36273627example
    3628 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    3629   echo=2;
     3628{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";  echo=2;
    36303629         ring R=0,(x,y,z),dp;
    36313630         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    36343633         print(l[1]);
    36353634}
     3635///////////////////////////////////////////////////////////////////////////////
    36363636
    36373637proc primary_charp_no_molien_random (matrix REY, int max, list #)
     
    36463646         <intvec> listing some of the degrees where no non-trivial homogeneous
    36473647         invariants are to be found
    3648 EXAMPLE: example primary_charp_no_molien_random; shows an example
    36493648THEORY:  Bases of homogeneous invariants are generated successively and random
    36503649         linear combinations are chosen as primary invariants that lower the
    36513650         dimension of the ideal generated by the previously found invariants
    3652          (see paper \"Generating a Noetherian Normalization of the Invariant Ring
     3651         (see \"Generating a Noetherian Normalization of the Invariant Ring
    36533652         of a Finite Group\" by Decker, Heydtmann, Schreyer (1997) to appear in
    36543653         JSC).
     3654EXAMPLE: example primary_charp_no_molien_random; shows an example
    36553655"
    36563656{ degBound=0;
     
    37743774}
    37753775example
    3776 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed into";
    3777   "         characteristic 3)";
    3778   echo=2;
     3776{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed to char 3)"; echo=2;
    37793777         ring R=3,(x,y,z),dp;
    37803778         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    37833781         print(l[1]);
    37843782}
     3783///////////////////////////////////////////////////////////////////////////////
    37853784
    37863785proc primary_charp_without_random (list #)
     
    37923791         equal 0
    37933792RETURN:  primary invariants (type <matrix>) of the invariant ring
    3794 EXAMPLE: example primary_charp_without_random; shows an example
    37953793THEORY:  Bases of homogeneous invariants are generated successively and random
    37963794         linear combinations are chosen as primary invariants that lower the
    37973795         dimension of the ideal generated by the previously found invariants
    3798          (see paper \"Generating a Noetherian Normalization of the Invariant Ring
     3796         (see \"Generating a Noetherian Normalization of the Invariant Ring
    37993797         of a Finite Group\" by Decker, Heydtmann, Schreyer (1997) to appear in
    38003798         JSC). No Reynolds operator or Molien series is used.
     3799EXAMPLE: example primary_charp_without_random; shows an example
    38013800"
    38023801{ degBound=0;
     
    39273926}
    39283927example
    3929 { echo=2;
     3928{  "EXAMPLE:"; echo=2;
    39303929         ring R=2,(x,y,z),dp;
    39313930         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    39333932         print(P);
    39343933}
     3934///////////////////////////////////////////////////////////////////////////////
    39353935
    39363936proc primary_invariants_random (list #)
     
    39603960         then an <intvec> is returned giving some of the degrees where no
    39613961         non-trivial homogeneous invariants can be found
    3962 EXAMPLE: example primary_invariants_random; shows an example
    39633962THEORY:  Bases of homogeneous invariants are generated successively and random
    39643963         linear combinations are chosen as primary invariants that lower the
    39653964         dimension of the ideal generated by the previously found invariants
    3966          (see paper \"Generating a Noetherian Normalization of the Invariant Ring
     3965         (see \"Generating a Noetherian Normalization of the Invariant Ring
    39673966         of a Finite Group\" by Decker, Heydtmann, Schreyer (1997) to appear in
    39683967         JSC).
     3968EXAMPLE: example primary_invariants_random; shows an example
    39693969"
    39703970{
     
    41314131}
    41324132example
    4133 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    4134   echo=2;
     4133{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";  echo=2;
    41354134         ring R=0,(x,y,z),dp;
    41364135         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    41384137         print(L[1]);
    41394138}
     4139///////////////////////////////////////////////////////////////////////////////
    41404140
    41414141proc concat_intmat(intmat A,intmat B)
     
    41484148  return(C);
    41494149}
     4150///////////////////////////////////////////////////////////////////////////////
    41504151
    41514152proc power_products(intvec deg_vec,int d)
     
    41564157         containing the exponents of the corresponding polynomials. The product
    41574158         of the powers is then homogeneous of degree d.
    4158 EXAMPLE: example power_products; gives an example
     4159EXAMPLE: example power_products; shows an example
    41594160"
    41604161{ ring R=0,x,dp;
     
    42004201}
    42014202example
    4202 { echo=2;
     4203{  "EXAMPLE:"; echo=2;
    42034204         intvec dv=5,5,5,10,10;
    42044205         print(power_products(dv,10));
    42054206         print(power_products(dv,7));
    42064207}
     4208///////////////////////////////////////////////////////////////////////////////
    42074209
    42084210proc secondary_char0 (matrix P, matrix REY, matrix M, list #)
    42094211"USAGE:   secondary_char0(P,REY,M[,v]);
    42104212         P: a 1xn <matrix> with primary invariants, REY: a gxn <matrix>
    4211          representing the Reynolds operator, M: a 1x2 <matrix> giving enumerator
     4213         representing the Reynolds operator, M: a 1x2 <matrix> giving numerator
    42124214         and denominator of the Molien series, v: an optional <int>
    42134215ASSUME:  n is the number of variables of the basering, g the size of the group,
     
    42194221         irreducible secondary invariants (type <matrix>)
    42204222DISPLAY: information if v does not equal 0
    4221 EXAMPLE: example secondary_char0; shows an example
    4222 THEORY:  The secondary invariants are calculated by finding a basis (in terms of
    4223          monomials) of the basering modulo the primary invariants, mapping those
    4224          to invariants with the Reynolds operator and using these images or
    4225          their power products such that they are linearly independent modulo the
     4223THEORY:  The secondary invariants are calculated by finding a basis (in terms
     4224         of monomials) of the basering modulo the primary invariants, mapping
     4225         those to invariants with the Reynolds operator and using these images
     4226         or their power products s. t. they are linearly independent modulo
    42264227         primary invariants (see paper \"Some Algorithms in Invariant Theory of
    42274228         Finite Groups\" by Kemper and Steel (1997)).
     4229EXAMPLE: example secondary_char0; shows an example
    42284230"
    42294231{ def br=basering;
     
    44044406}
    44054407example
    4406 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    4407   echo=2;
     4408{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    44084409         ring R=0,(x,y,z),dp;
    44094410         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    44134414         print(IS);
    44144415}
     4416///////////////////////////////////////////////////////////////////////////////
    44154417
    44164418proc secondary_charp (matrix P, matrix REY, string ring_name, list #)
     
    44224424ASSUME:  n is the number of variables of the basering, g the size of the group,
    44234425         REY is the 1st return value of group_reynolds(), reynolds_molien() or
    4424          the second one of primary_invariants(), `ringname` is ring of
    4425          characteristic 0 that has been created by molien() or reynolds_molien()
     4426         the second one of primary_invariants(), `ringname` is a ring of
     4427         char 0 that has been created by molien() or reynolds_molien()
    44264428         or primary_invariants()
    44274429RETURN:  secondary invariants of the invariant ring (type <matrix>) and
    44284430         irreducible secondary invariants (type <matrix>)
    44294431DISPLAY: information if v does not equal 0
    4430 EXAMPLE: example secondary_charp; shows an example
    4431 THEORY:  The secondary invariants are calculated by finding a basis (in terms of
    4432          monomials) of the basering modulo the primary invariants, mapping those
     4432THEORY:  Secondary invariants are calculated by finding a basis (in terms of
     4433         monomials) of the basering modulo primary invariants, mapping those
    44334434         to invariants with the Reynolds operator and using these images or
    4434          their power products such that they are linearly independent modulo the
     4435         their power products s. t. they are linearly independent modulo the
    44354436         primary invariants (see paper \"Some Algorithms in Invariant Theory of
    44364437         Finite Groups\" by Kemper and Steel (1997)).
     4438EXAMPLE: example secondary_charp; shows an example
    44374439"
    44384440{ def br=basering;
     
    46274629}
    46284630example
    4629 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed into";
    4630   "         characteristic 3)";
    4631   echo=2;
     4631{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7 (changed to char 3)"; echo=2;
    46324632         ring R=3,(x,y,z),dp;
    46334633         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    46374637         print(IS);
    46384638}
     4639///////////////////////////////////////////////////////////////////////////////
    46394640
    46404641proc secondary_no_molien (matrix P, matrix REY, list #)
     
    46424643         P: a 1xn <matrix> with primary invariants, REY: a gxn <matrix>
    46434644         representing the Reynolds operator, deg_vec: an optional <intvec>
    4644          listing some degrees where no non-trivial homogeneous invariants can be
    4645          found, v: an optional <int>
     4645         listing some degrees where no non-trivial homogeneous invariants can
     4646         be found, v: an optional <int>
    46464647ASSUME:  n is the number of variables of the basering, g the size of the group,
    46474648         REY is the 1st return value of group_reynolds(), reynolds_molien() or
     
    46514652RETURN:  secondary invariants of the invariant ring (type <matrix>)
    46524653DISPLAY: information if v does not equal 0
    4653 EXAMPLE: example secondary_no_molien; shows an example
    4654 THEORY:  The secondary invariants are calculated by finding a basis (in terms of
    4655          monomials) of the basering modulo the primary invariants, mapping those
     4654THEORY:  Secondary invariants are calculated by finding a basis (in terms of
     4655         monomials) of the basering modulo primary invariants, mapping those
    46564656         to invariants with the Reynolds operator and using these images as
    46574657         candidates for secondary invariants.
     4658EXAMPLE: example secondary_no_molien; shows an example
    46584659"
    46594660{ int i;
     
    47884789}
    47894790example
    4790 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    4791   echo=2;
     4791{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    47924792         ring R=0,(x,y,z),dp;
    47934793         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    47964796         print(S);
    47974797}
     4798///////////////////////////////////////////////////////////////////////////////
    47984799
    47994800proc secondary_and_irreducibles_no_molien (matrix P, matrix REY, list #)
     
    48074808         irreducible secondary invariants (type <matrix>)
    48084809DISPLAY: information if v does not equal 0
    4809 EXAMPLE: example secondary_and_irreducibles_no_molien; shows an example
    4810 THEORY:  The secondary invariants are calculated by finding a basis (in terms of
    4811          monomials) of the basering modulo the primary invariants, mapping those
     4810THEORY:  Secondary invariants are calculated by finding a basis (in terms of
     4811         monomials) of the basering modulo primary invariants, mapping those
    48124812         to invariants with the Reynolds operator and using these images or
    4813          their power products such that they are linearly independent modulo the
     4813         their power products s.t. they are linearly independent modulo the
    48144814         primary invariants (see paper \"Some Algorithms in Invariant Theory of
    48154815         Finite Groups\" by Kemper and Steel (1997)).
     4816EXAMPLE: example secondary_and_irreducibles_no_molien; shows an example
    48164817"
    48174818{ int i;
     
    49844985}
    49854986example
    4986 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    4987   echo=2;
     4987{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    49884988         ring R=0,(x,y,z),dp;
    49894989         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    49934993         print(IS);
    49944994}
     4995///////////////////////////////////////////////////////////////////////////////
    49954996
    49964997proc secondary_not_cohen_macaulay (matrix P, list #)
     
    50015002RETURN:  secondary invariants of the invariant ring (type <matrix>)
    50025003DISPLAY: information if v does not equal 0
    5003 EXAMPLE: example secondary_not_cohen_macaulay; shows an example
    5004 THEORY:  The secondary invariants are generated following \"Generating Invariant
     5004THEORY:  Secondary invariants are generated following \"Generating Invariant
    50055005         Rings of Finite Groups over Arbitrary Fields\" by Kemper (1996, to
    50065006         appear in JSC).
     5007EXAMPLE: example secondary_not_cohen_macaulay; shows an example
    50075008"
    50085009{ int i, j;
     
    51545155}
    51555156example
    5156 { echo=2;
     5157{  "EXAMPLE:"; echo=2;
    51575158           ring R=2,(x,y,z),dp;
    51585159           matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    51615162           print(S);
    51625163}
     5164///////////////////////////////////////////////////////////////////////////////
    51635165
    51645166proc invariant_ring (list #)
     
    51755177         not even be attempted to compute the Reynolds operator or Molien
    51765178         series), the second component should give the size of intervals
    5177          between canceling common factors in the expansion of the Molien series,
     5179         between canceling common factors in the expansion of Molien series,
    51785180         0 (the default) means only once after generating all terms, in prime
    51795181         characteristic also a negative number can be given to indicate that
    51805182         common factors should always be canceled when the expansion is simple
    5181          (the root of the extension field does not occur among the coefficients)
    5182 RETURN:  primary and secondary invariants (both of type <matrix>) generating the
     5183         (the root of the extension field occurs not among the coefficients)
     5184RETURN:  primary and secondary invariants (both of type matrix) generating the
    51835185         invariant ring with respect to the matrix group generated by the
    51845186         matrices in the input and irreducible secondary invariants (type
     
    51865188DISPLAY: information about the various stages of the program if the third flag
    51875189         does not equal 0
    5188 EXAMPLE: example invariant_ring; shows an example
    51895190THEORY:  Bases of homogeneous invariants are generated successively and those
    51905191         are chosen as primary invariants that lower the dimension of the ideal
     
    51965197         invariants, mapping to invariants with the Reynolds operator and using
    51975198         those or their power products such that they are linearly independent
    5198          modulo the primary invariants (see paper \"Some Algorithms in Invariant
     5199         modulo the primary invariants (see \"Some Algorithms in Invariant
    51995200         Theory of Finite Groups\" by Kemper and Steel (1997)). In the modular
    52005201         case they are generated according to \"Generating Invariant Rings of
    52015202         Finite Groups over Arbitrary Fields\" by Kemper (1996, to appear in
    52025203         JSC).
     5204EXAMPLE: example invariant_ring; shows an example
    52035205"
    52045206{ if (size(#)==0)
     
    53675369         print(IS);
    53685370}
     5371///////////////////////////////////////////////////////////////////////////////
    53695372
    53705373proc invariant_ring_random (list #)
     
    53735376         where -|r| to |r| is the range of coefficients of random
    53745377         combinations of bases elements that serve as primary invariants,
    5375          flags: an optional <intvec> with three entries: if the first one equals
     5378         flags: an optional <intvec> with three entries: if the first equals
    53765379         0, the program attempts to compute the Molien series and Reynolds
    53775380         operator, if it equals 1, the program is told that the Molien series
     
    53805383         characteristic 0 (the user must choose a field of large prime
    53815384         characteristic, e.g.  32003) and if the first one is anything else, it
    5382          means that the characteristic of the base field divides the group order
    5383          (i.e. it will not even be attempted to compute the Reynolds operator or
     5385         then the characteristic of the base field divides the group order
     5386         (i.e. we will not even attempt to compute the Reynolds operator or
    53845387         Molien series), the second component should give the size of intervals
    5385          between canceling common factors in the expansion of the Molien series,
     5388         between canceling common factors in the expansion of the Molien
     5389         series,
    53865390         0 (the default) means only once after generating all terms, in prime
    53875391         characteristic also a negative number can be given to indicate that
    53885392         common factors should always be canceled when the expansion is simple
    5389          (the root of the extension field does not occur among the coefficients)
    5390 RETURN:  primary and secondary invariants (both of type <matrix>) generating the
     5393         (the root of the extension field occurs not among the coefficients)
     5394RETURN:  primary and secondary invariants (both of type matrix) generating the
    53915395         invariant ring with respect to the matrix group generated by the
    53925396         matrices in the input and irreducible secondary invariants (type
     
    53945398DISPLAY: information about the various stages of the program if the third flag
    53955399         does not equal 0
    5396 EXAMPLE: example invariant_ring_random; shows an example
    53975400THEORY:  is the same as for invariant_ring except that random combinations of
    53985401         basis elements are chosen as candidates for primary invariants and
    53995402         hopefully they lower the dimension of the previously found primary
    54005403         invariants by the right amount.
     5404EXAMPLE: example invariant_ring_random; shows an example
    54015405"
    54025406{ if (size(#)<2)
     
    55825586}
    55835587example
    5584 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    5585   echo=2;
     5588{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    55865589         ring R=0,(x,y,z),dp;
    55875590         matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
     
    55915594         print(IS);
    55925595}
    5593 
    5594 proc algebra_containment (poly p, matrix A)
    5595 "USAGE:   algebra_containment(p,A);
    5596          p: arbitrary <poly>, A: a 1xm <matrix> giving generators of a
    5597          subalgebra of the basering
    5598 RETURN:  1 (TRUE) (type <int>) if p is contained in the subalgebra
    5599          0 (FALSE) (type <int>) if <poly> is not contained
    5600 DISPLAY: a representation of p in terms of algebra generators A[1,i]=y(i) if p
    5601          is contained in the subalgebra
    5602 EXAMPLE: example algebra_containment; shows an example
    5603 THEORY:  The ideal of algebraic relations of the algebra generators f1,...,fm
    5604          given by A is computed introducing new variables y(i) and the product
    5605          order: x^a*y^b > y^d*y^e if x^a > x^d or else if y^b > y^e. p reduces
    5606          to a polynomial only in the y(i) <=> p is contained in the subring
    5607          generated by the polynomials in A.
    5608 "
    5609 { degBound=0;
    5610   if (nrows(A)==1)
    5611   { def br=basering;
    5612     int n=nvars(br);
    5613     int m=ncols(A);
    5614     string mp=string(minpoly);
    5615     execute "ring R=("+charstr(br)+"),(x(1..n),y(1..m)),(dp(n),dp(m));";
    5616     execute "minpoly=number("+mp+");";
    5617     ideal vars=x(1..n);
    5618     map emb=br,vars;
    5619     ideal A=ideal(emb(A));
    5620     ideal check=emb(p);
    5621     for (int i=1;i<=m;i=i+1)
    5622     { A[i]=A[i]-y(i);
    5623     }
    5624     A=std(A);
    5625     check[1]=reduce(check[1],A);
    5626     A=elim(check,1,n);
    5627     if (A[1]<>0)
    5628     { "\/\/ "+string(check);
    5629       return(1);
    5630     }
    5631     else
    5632     { return(0);
    5633     }
    5634   }
    5635   else
    5636   { "ERROR:   <matrix> may only have one row";
    5637     return();
    5638   }
    5639 }
    5640 example
    5641 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    5642   echo=2;
    5643          ring R=0,(x,y,z),dp;
    5644          matrix A[1][7]=x2+y2,z2,x4+y4,1,x2z-1y2z,xyz,x3y-1xy3;
    5645          poly p1=x10z3-x8y2z3+2x6y4z3-2x4y6z3+x2y8z3-y10z3+x6z4+3x4y2z4+3x2y4z4+y6z4;
    5646          algebra_containment(p1,A);
    5647          poly p2=z;
    5648          algebra_containment(p2,A);
    5649 }
    5650 
    5651 proc module_containment(poly p, matrix P, matrix S)
    5652 "USAGE:   module_containment(p,P,S);
    5653          p: arbitrary <poly>, P: a 1xn <matrix> giving generators of an algebra,
    5654          S: a 1xt <matrix> giving generators of a module over the algebra
    5655          generated by P
    5656 ASSUME:  n is the number of variables in the basering and the generators in P
    5657          are algebraically independent
    5658 RETURNS: 1 (TRUE) (type <int>) if p is contained in the ring
    5659          0 (FALSE) type <int>) if p is not contained
    5660 DISPLAY: the representation of p in terms of algebra generators P[1,i]=z(i) and
    5661          module generators S[1,j]=y(j) if p is contained in the module
    5662 EXAMPLE: example module_containment; shows an example
    5663 THEORY:  The ideal of algebraic relations of all the generators p1,...,pn,
    5664          s1,...,st given by P and S is computed introducing new variables y(j),
    5665          z(i) and the product order: x^a*y^b*z^c > x^d*y^e*z^f if x^a > x^d
    5666          with respect to the lp ordering or else if z^c > z^f with respect to
    5667          the dp ordering or else if y^b > y^e with respect to the lp ordering
    5668          again. p reduces to a polynomial only in the y(j) and z(i) linear in
    5669          the z(i)) <=> p is contained in the module.
    5670 "
    5671 { def br=basering;
    5672   degBound=0;
    5673   int n=nvars(br);
    5674   if (ncols(P)==n and nrows(P)==1 and nrows(S)==1)
    5675   { int m=ncols(S);
    5676     string mp=string(minpoly);
    5677     execute "ring R=("+charstr(br)+"),(x(1..n),y(1..m),z(1..n)),(lp(n),dp(m),lp(n));";
    5678     execute "minpoly=number("+mp+");";
    5679     ideal vars=x(1..n);
    5680     map emb=br,vars;
    5681     matrix P=emb(P);
    5682     matrix S=emb(S);
    5683     ideal check=emb(p);
    5684     ideal I;
    5685     for (int i=1;i<=m;i=i+1)
    5686     { I[i]=S[1,i]-y(i);
    5687     }
    5688     for (i=1;i<=n;i=i+1)
    5689     { I[m+i]=P[1,i]-z(i);
    5690     }
    5691     I=std(I);
    5692     check[1]=reduce(check[1],I);
    5693     I=elim(check,1,n);                 // checking whether all variables from
    5694     if (I[1]<>0)                       // the former ring have disappeared
    5695     { "\/\/ "+string(check);
    5696       return(1);
    5697     }
    5698     else
    5699     { return(0);
    5700     }
    5701   }
    5702   else
    5703   { "ERROR:   the first <matrix> must have the same number of columns as the";
    5704     "         basering and both <matrices> may only have one row";
    5705     return();
    5706   }
    5707 }
    5708 example
    5709 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    5710   echo=2;
    5711          ring R=0,(x,y,z),dp;
    5712          matrix P[1][3]=x2+y2,z2,x4+y4;
    5713          matrix S[1][4]=1,x2z-1y2z,xyz,x3y-1xy3;
    5714          poly p1=x10z3-x8y2z3+2x6y4z3-2x4y6z3+x2y8z3-y10z3+x6z4+3x4y2z4+3x2y4z4+y6z4;
    5715          module_containment(p1,P,S);
    5716          poly p2=z;
    5717          module_containment(p2,P,S);
    5718 }
     5596///////////////////////////////////////////////////////////////////////////////
    57195597
    57205598proc orbit_variety (matrix F,string newring)
     
    57245602RETURN:  a Groebner basis (type <ideal>, named G) for the ideal defining the
    57255603         orbit variety (i.e. the syzygy ideal) in the new ring (named `s`)
    5726 EXAMPLE: example orbit_variety; shows an example
    57275604THEORY:  The ideal of algebraic relations of the invariant ring generators is
    57285605         calculated, then the variables of the original ring are eliminated and
    57295606         the polynomials that are left over define the orbit variety
     5607EXAMPLE: example orbit_variety; shows an example
    57305608"
    57315609{ if (newring=="")
     
    57655643}
    57665644example
    5767 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:";
    5768   echo=2;
     5645{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    57695646         ring R=0,(x,y,z),dp;
    57705647         matrix F[1][7]=x2+y2,z2,x4+y4,1,x2z-1y2z,xyz,x3y-1xy3;
     
    57745651         basering;
    57755652}
     5653///////////////////////////////////////////////////////////////////////////////
    57765654
    57775655proc relative_orbit_variety(ideal I,matrix F,string newring)
     
    57825660RETURN:  a Groebner basis (type <ideal>, named G) for the ideal defining the
    57835661         relative orbit variety with respect to I in the new ring (named s)
    5784 EXAMPLE: example relative_orbit_variety; shows an example
    57855662THEORY:  A Groebner basis of the ideal of algebraic relations of the invariant
    57865663         ring generators is calculated, then one of the basis elements plus the
    5787          ideal generators. The variables of the original ring are eliminated and
    5788          the polynomials that are left over define thecrelative orbit variety
     5664         ideal generators. The variables of the original ring are eliminated
     5665         and the polynomials that are left define the relative orbit variety
    57895666         with respect to I.
     5667EXAMPLE: example relative_orbit_variety; shows an example
    57905668"
    57915669{ if (newring=="")
     
    58455723}
    58465724example
    5847 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.6.3:";
    5848   echo=2;
     5725{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.6.3:"; echo=2;
    58495726         ring R=0,(x,y,z),dp;
    58505727         matrix F[1][3]=x+y+z,xy+xz+yz,xyz;
     
    58555732         basering;
    58565733}
     5734///////////////////////////////////////////////////////////////////////////////
    58575735
    58585736proc image_of_variety(ideal I,matrix F)
     
    58625740RETURN:  the <ideal> defining the image under that group of the variety defined
    58635741         by I
    5864 EXAMPLE: example image_of_variety; shows an example
    58655742THEORY:  relative_orbit_variety(I,F,s) is called and the newly introduced
    58665743         variables in the output are replaced by the generators of the
    58675744         invariant ring. This ideal in the original variables defines the image
    58685745         of the variety defined by I
     5746EXAMPLE: example image_of_variety; shows an example
    58695747"
    58705748{ if (nrows(F)==1)
     
    58885766}
    58895767example
    5890 { "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.6.8:";
    5891   echo=2;
     5768{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.6.8:"; echo=2;
    58925769         ring R=0,(x,y,z),dp;
    58935770         matrix F[1][3]=x+y+z,xy+xz+yz,xyz;
     
    58955772         print(image_of_variety(I,F));
    58965773}
     5774///////////////////////////////////////////////////////////////////////////////
  • Singular/LIB/invar.lib

    rb00a82 r68e678  
    1 // $Id: invar.lib,v 1.12 1999-07-19 10:32:46 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 
    9 version="$Id: invar.lib,v 1.12 1999-07-19 10:32:46 obachman Exp $";
     1// $Id: invar.lib,v 1.13 1999-07-19 14:07:34 obachman Exp $
     2/////////////////////////////////////////////////////////////////////////////
     3
     4version="$Id: invar.lib,v 1.13 1999-07-19 14:07:34 obachman Exp $";
    105info="
    11 LIBRARY: invar.lib  PROCEDURES FOR COMPUTING INVARIANTS OF (C,+)-ACTIONS
     6LIBRARY: invar.lib   PROCEDURES FOR COMPUTING INVARIANTS OF (K,+)-ACTIONS
     7AUTHORS: Gerhard Pfister,  email: pfister@mathematik.uni-kl.de
     8         Gert-Martin Greuel,  email: greuel@mathematik.uni-kl.de
    129
    1310PROCEDURES:
    14  invariantRing(m,p,q[,i])  computes invariants of (C,+)-action
    15  actionIsProper(matrix m)  check for proper action
     11  invariantRing(m..);  compute ring of invariants of (K,+)-action given by m
     12  der(m,f);            derivation of f with respect to the vectorfield m
     13  actionIsProper(m);   tests whether action defined by m is proper
     14  reduction(p,I);      SAGBI reduction of p in the subring generated by I
     15  completeReduction(); complete SAGBI reduction
     16  localInvar(m,p..);   invariant polynomial under m computed from p,...
     17  furtherInvar(m..);   compute further inariants of m from the given ones
     18  sortier(id);         sorts generators of id by increasing leading terms
    1619";
    17 
    18 ///////////////////////////////////////////////////////////////////////////////
    1920
    2021LIB "inout.lib";
    2122LIB "general.lib";
    22 
    23 ///////////////////////////////////////////////////////////////////////////////
    24 
    25 
    26 proc sortier(ideal id)
     23LIB "algebra.lib";
     24///////////////////////////////////////////////////////////////////////////////
     25
     26proc sortier(id)
     27"USAGE:   sotier(id);  id ideal/module
     28RETURN:  the same ideal/module but with generators ordered by there
     29         leading term, starting with the smallest
     30EXAMPLE: example sortier; shows an example
     31"
    2732{
    2833  if(size(id)==0)
    29   {
    30      return(id);
     34  {return(id);
    3135  }
    3236  intvec i=sortvec(id);
    3337  int j;
    34   ideal m;
    35   for (j=1;j<=size(i);j++)
     38  if( typeof(id)=="ideal")
     39  { ideal m;
     40  }
     41  if( typeof(id)=="module")
     42  { module m;
     43  }
     44 if( typeof(id)!="ideal" and  typeof(id)!="module")
     45 { "// input must be of type ideal or module"
     46     return();
     47 }
     48 for (j=1;j<=size(i);j++)
    3649  {
    3750    m[j] = id[i[j]];
     
    4356   ring q=0,(x,y,z,u,v,w),dp;
    4457   ideal i=w,x,z,y,v;
    45    ideal j=sortier(i);
    46    j;
    47 }
    48 
    49 
    50 ///////////////////////////////////////////////////////////////////////////////
    51 
    52 
    53 proc der (matrix m, poly f)
    54 "USAGE:   der(m,f);  m matrix, f poly
    55 RETURN:  poly= application of the vectorfield m defined by the matrix m
    56          (m[i,1] are the coefficients of d/dx(i)) to f
    57 NOTE:
     58   sortier(i);
     59}
     60///////////////////////////////////////////////////////////////////////////////
     61
     62proc der (matrix m, id)
     63"USAGE:  der(m,id);  m matrix, id poly/vector/ideal
     64ASSUME:  m is a nx1 matrix, where n = number of variables of the basering
     65RETURN:  poly/vector/ideal (same type as input), result of applying the
     66         vectorfield by the matrix m componentwise to id;
     67NOTE:    the vectorfield is m[1,1]*d/dx(1) +...+ m[1,n]*d/dx(n)
    5868EXAMPLE: example der; shows an example
    5969"
    60 {
    61   matrix mh=matrix(jacob(f))*m;
    62   return(mh[1,1]);
     70{
     71  execute (typeof(id)+ " j;");
     72  ideal I = ideal(id);
     73  matrix mh=matrix(jacob(I))*m;
     74  if(typeof(j)=="poly")
     75  { j = mh[1,1];
     76  }
     77  else
     78  { j = mh[1];
     79  }
     80  return(j);
    6381}
    6482example
     
    6684   ring q=0,(x,y,z,u,v,w),dp;
    6785   poly f=2xz-y2;
    68    matrix m[6][1];
    69    m[2,1]=x;
    70    m[3,1]=y;
    71    m[5,1]=u;
    72    m[6,1]=v;
     86   matrix m[6][1] =x,y,0,u,v;
    7387   der(m,f);
    74 }
    75 
    76 ///////////////////////////////////////////////////////////////////////////////
    77 
     88   vector v = [2xz-y2,u6-3];
     89   der(m,v);
     90   der(m,ideal(2xz-y2,u6-3));
     91}
     92
     93///////////////////////////////////////////////////////////////////////////////
    7894
    7995proc actionIsProper(matrix m)
    8096"USAGE:  actionIsProper(m); m matrix
    81 RETURN:  1 if the action of the additive group defined by the matrix m is
    82          proper.
    83          0 if not proper.
     97ASSUME:  m is a nx1 matrix, where n = number of variables of the basering
     98RETURN:  int = 1, if the action defined by m is proper, 0 if not
     99NOTE:    m defines a group action which is the exponential of the vector
     100         field  m[1,1]*d/dx(1) +...+ m[1,n]*d/dx(n)
    84101EXAMPLE: example actionIsProper; shows an example
    85102"
     
    119136{ "EXAMPLE:"; echo = 2;
    120137
    121   ring rf=0,(x(1..7)),dp;
     138  ring rf=0,x(1..7),dp;
    122139  matrix m[7][1];
    123140  m[4,1]=x(1)^3;
     
    127144  actionIsProper(m);
    128145
    129   ring rd=0,(x(1..5)),dp;
     146  ring rd=0,x(1..5),dp;
    130147  matrix m[5][1];
    131148  m[3,1]=x(1);
     
    136153///////////////////////////////////////////////////////////////////////////////
    137154
    138 
    139155proc reduction(poly p, ideal dom, list #)
    140 "USAGE:   reduction(p,dom,q); p poly, dom ideal, q (optional) monomial
    141 RETURN:  poly= (p-H(f1,...,fr))/q^a, if Lt(p)=H(Lt(f1),...,Lt(fr)) for
    142                some polynomial H in r variables over the base field,
    143                a maximal such that q^a devides p-H(f1,...,fr),
    144                dom =(f1,...,fr)
     156"USAGE:   reduction(p,I[,q,n]); p poly, I ideal, [q monomial, n int (optional)]
     157RETURN:  a polynomial equal to  p-H(f1,...,fr), in case the leading
     158         term LT(p) of p is of the form H(LT(f1),...,LT(fr)) for some
     159         polynomial H in r variables over the base field, I=f1,...,fr;
     160         if q is given, a maximal power a is computed such that q^a devides
     161         p-H(f1,...,fr), and then (p-H(f1,...,fr))/q^a is returned;
     162         return p if no H is found
     163         if n=1, a different algorithm is choosen which is sometimes faster
     164         (default: n=0; q and n can be given (or not) in any order)
     165NOTE:    this is a kind of SAGBI reduction in the subalgebra K[f1,...,fr] of
     166         the basering
    145167EXAMPLE: example reduction; shows an example
    146168"
    147169{
    148   int i;
    149   int z=size(dom);
     170  int i,choose;
     171  int z=ncols(dom);
    150172  def bsr=basering;
    151 
    152   //arranges the monomial v for elimination
    153   poly v=var(1);
    154   for (i=2;i<=nvars(basering);i=i+1)
    155   {
    156     v=v*var(i);
    157   }
    158 
    159   //changes the basering bsr to bsr[@(0),...,@(z)]
    160   execute "ring s="+charstr(basering)+",("+varstr(basering)+",@(0..z)),dp;";
    161 
    162   //costructes the ideal dom=(p-@(0),dom[1]-@(1),...,dom[z]-@(z))
    163   ideal dom=imap(bsr,dom);
    164   for (i=1;i<=z;i++)
    165   {
    166     dom[i]=lead(dom[i])-var(nvars(bsr)+i+1);
    167   }
    168   dom=lead(imap(bsr,p))-@(0),dom;
    169 
    170   //eliminates the variables of the basering bsr
    171   //i.e. computes dom intersected with K[@(0),...,@(z)]
    172   ideal kern=eliminate(dom,imap(bsr,v));
    173 
    174   // test wether @(0)-h(@(1),...,@(z)) is in ker for some poly h
    175   poly h;
    176   z=size(kern);
    177   for (i=1;i<=z;i++)
    178   {
    179      h=kern[i]/@(0);
    180      if (deg(h)==0)
     173  if( size(#) >0 )
     174  { if( typeof(#[1]) == "int")
     175    { choose = #[1];
     176    }
     177    if( typeof(#[1]) == "poly")
     178    { poly q = #[1];
     179    }
     180    if( size(#)>1 )
     181    {  if( typeof(#[2]) == "poly")
     182       { poly q = #[2];
     183       }
     184       if( typeof(#[2]) == "int")
     185      { choose = #[2];
     186      }
     187    }
     188  }
     189  // -------------------- first algorithm (default) -----------------------
     190  if ( choose == 0 )
     191  {
     192     list L = algebra_containment(lead(p),lead(dom),1);
     193     if( L[1]==1 )
    181194     {
    182         h=(1/h)*kern[i];
    183         // defines the map psi : s ---> bsr defined by @(i) ---> p,dom[i]
    184         setring bsr;
    185         map psi=s,maxideal(1),p,dom;
    186         poly re=psi(h);
    187 
    188         // devides by the maximal power of #[1]
    189         if (size(#)>0)
    190         {
    191            while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0))
    192            {
    193              re=re/#[1];
     195  // the ring L[2] = char(bsr),(x(1..nvars(bsr)),y(1..z)),(dp(n),dp(m)),
     196  // contains poly check s.t. LT(p) is of the form check(LT(f1),...,LT(fr))
     197       def s1 = L[2];
     198       map psi = s1,maxideal(1),dom;
     199       poly re = p - psi(check);
     200       // devide by the maximal power of #[1]
     201          if ( defined(q) == voice )
     202          {  while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0))
     203             {  re=re/#[1];
     204             }
     205          }
     206          return(re);
     207     }
     208  return(p);
     209  } 
     210  // ------------------------- second algorithm ---------------------------
     211  else
     212  {
     213  //----------------- arranges the monomial v for elimination -------------
     214     poly v=product(maxideal(1));
     215
     216  //------------- changes the basering bsr to bsr[@(0),...,@(z)] ----------
     217     execute "ring s="+charstr(basering)+",("+varstr(basering)+",@(0..z)),dp;";
     218
     219  //constructs the leading ideal of dom=(p-@(0),dom[1]-@(1),...,dom[z]-@(z))
     220     ideal dom=imap(bsr,dom);
     221     for (i=1;i<=z;i++)
     222     {
     223        dom[i]=lead(dom[i])-var(nvars(bsr)+i+1);
     224     }
     225     dom=lead(imap(bsr,p))-@(0),dom;
     226
     227  //---------- eliminates the variables of the basering bsr --------------
     228  //i.e. computes dom intersected with K[@(0),...,@(z)] (this is hard)
     229  //### hier Variante analog zu algebra_containment einbauen!
     230     ideal kern=eliminate(dom,imap(bsr,v));
     231
     232  //---------  test wether @(0)-h(@(1),...,@(z)) is in ker ---------------
     233  // for some poly h and divide by maximal power of q=#[1]
     234     poly h;
     235     z=size(kern);
     236     for (i=1;i<=z;i++)
     237     {
     238        h=kern[i]/@(0);
     239        if (deg(h)==0)
     240        {  h=(1/h)*kern[i];
     241        // define the map psi : s ---> bsr defined by @(i) ---> p,dom[i]
     242           setring bsr;
     243           map psi=s,maxideal(1),p,dom;
     244           poly re=psi(h);
     245           // devide by the maximal power of #[1]
     246           if (size(#)>0)
     247           {  while ((re!=0) && (re!=#[1]) &&(subst(re,#[1],0)==0))
     248              {  re=re/#[1];
     249              }
    194250           }
     251           return(re);
    195252        }
    196 
    197         return(re);
    198253     }
    199   }
    200   setring bsr;
    201   return(p);
     254     setring bsr;
     255     return(p);
     256  }
    202257}
    203258example
     
    213268
    214269proc completeReduction(poly p, ideal dom, list #)
    215 "USAGE:   completeReduction(p,dom,q); p poly, dom ideal,
    216                                      q (optional) monomial
    217 RETURN:  poly= the polynomial p reduced with dom via the procedure
    218                reduction as long as possible
    219 NOTE:
     270"USAGE:   completeReduction(p,I[,q,n]); p poly, I ideal, [q monomial, n int]
     271RETURN:  a polynomial, the SAGBI reduction of the polynomial p with I
     272         via the procedure 'reduction' as long as possible
     273         if n=1, a different algorithm is choosen which is sometimes faster
     274         (default: n=0; q and n can be given (or not) in any order)
     275NOTE:    help reduction; shows an explanation of SAGBI reduction
    220276EXAMPLE: example completeReduction; shows an example
    221277"
     
    238294   completeReduction(p,dom,w);
    239295}
    240 ///////////////////////////////////////////////////////////////////////////////
    241 
    242 proc inSubring(poly p, ideal dom)
    243 "USAGE:   inSubring(p,dom); p poly, dom ideal
    244 RETURN:  list= 1,string(@(0)-h(@(1),...,@(size(dom)))) :if p = h(dom[1],...,dom[size(dom)])
    245               0,string(h(@(0),...,@(size(dom)))) :if there is only a nonlinear relation
    246               h(p,dom[1],...,dom[size(dom)])=0.
    247 NOTE:
    248 EXAMPLE: example inSubring; shows an example
    249 "
    250 {
    251   int z=size(dom);
    252   int i;
    253   def gnir=basering;
    254   list l;
    255   poly mile=var(1);
    256   for (i=2;i<=nvars(basering);i++)
    257   {
    258     mile=mile*var(i);
    259   }
    260   string eli=string(mile);
    261   // the intersection of ideal nett=(p-@(0),dom[1]-@(1),...)
    262   // with the ring k[@(0),...,@(n)] is computed, the result is ker
    263   execute "ring r1="+charstr(basering)+",("+varstr(basering)+",@(0..z)),dp;";
    264   ideal nett=imap(gnir,dom);
    265   poly p;
    266   for (i=1;i<=z;i++)
    267   {
    268     execute "p=@("+string(i)+");";
    269     nett[i]=nett[i]-p;
    270   }
    271   nett=imap(gnir,p)-@(0),nett;
    272   execute "ideal ker=eliminate(nett,"+eli+");";
    273   // test wether @(0)-h(@(1),...,@(z)) is in ker
    274   l[1]=0;
    275   l[2]="";
    276   for (i=1;i<=size(ker);i++)
    277   {
    278      if (deg(ker[i]/@(0))==0)
    279      {
    280         string str=string(ker[i]);
    281         setring gnir;
    282         l[1]=1;
    283         l[2]=str;
    284         return(l);
    285      }
    286      if (deg(ker[i]/@(0))>0)
    287      {
    288         l[2]=l[2]+string(ker[i]);
    289      }
    290   }
    291   setring gnir;
    292   return(l);
    293 }
    294 example
    295 { "EXAMPLE:"; echo = 2;
    296    ring q=0,(x,y,z,u,v,w),dp;
    297    poly p=xyzu2w-1yzu2w2+u4w2-1xu2vw+u2vw2+xyz-1yzw+2u2w-1xv+vw+2;
    298    ideal dom =x-w,u2w+1,yz-v;
    299    inSubring(p,dom);
    300 }
    301296
    302297///////////////////////////////////////////////////////////////////////////////
    303298
    304299proc localInvar(matrix m, poly p, poly q, poly h)
    305 "USAGE:   localInvar(m,p,q,h); m matrix, p,q,h poly
    306 RETURN:  poly= the invariant of the vectorfield m=Sum m[i,1]*d/dx(i) with respect
    307                to p,q,h, i.e.
    308                Sum (-1)^v*(1/v!)*m^v(p)*(q/m(q))^v)*m(q)^N, m^N(q)=0, m^(N-1)(q)<>0
    309                it is assumed that m(q) and h are invariant
    310                the sum above is divided by h as much as possible
    311 NOTE:
     300"USAGE:   localInvar(m,p,q,h); m matrix, p,q,h polynomials
     301ASSUME:  m(q) and h are invariant under the vectorfield m, i.e. m(m(q))=m(h)=0
     302         h must be a ring variable
     303RETURN:  a polynomial, the invariant polynomial of the vectorfield
     304                m = m[1,1]*d/dx(1) +...+ m[n,1]*d/dx(n) 
     305         with respect to p,q,h. It is defined as follows: set inv = p if p is
     306         invariant, and else as
     307         inv = m(q)^N * sum_i=1..N-1{ (-1)^i*(1/i!)*m^i(p)*(q/m(q))^i }
     308         where m^N(p) = 0,  m^(N-1)(p) != 0;
     309         the result is inv divided by h as much as possible
    312310EXAMPLE: example localInvar; shows an example
    313311"
     
    315313  if ((der(m,h) !=0) || (der(m,der(m,q)) !=0))
    316314  {
    317     "the last variable defines not an invariant function ";
     315    "//the last two polynomials of the input must be invariant functions";
    318316    return(q);
    319317  }
     318  int ii,k;
     319  for ( k=1; k <= nvars(basering); k++  )
     320  {  if (h == var(k))
     321     { ii=1;
     322     }
     323  }
     324  if( ii==0 )
     325  {  "// the last argument must be a ring variable";
     326     return(q);
     327  }
     328   
    320329  poly inv=p;
    321330  poly dif= der(m,inv);
     
    323332  poly sgn=-1;
    324333  poly coeff=sgn*q;
    325   int k=1;
     334  k=1;
    326335  if (dif==0)
    327336  {
     
    352361///////////////////////////////////////////////////////////////////////////////
    353362
    354 
    355 
    356 proc furtherInvar(matrix m, ideal id, ideal karl, poly q)
    357 "USAGE:   furtherInvar(m,id,karl,q); m matrix, id,karl ideal,q poly
    358 RETURN:  ideal= further invariants of the vectorfield m=Sum m[i,1]*d/dx(i) with respect
    359                to id,p,q, i.e.
    360                the ideal id contains invariants of m and we are looking for elements
    361                in the subring generated by id which are divisible by q
    362                it is assumed that m(p) and q are invariant
    363                the elements mentioned  above are computed and divided by q
    364                as much as possible
    365                the ideal karl contains all invariants computed yet
     363proc furtherInvar(matrix m, ideal id, ideal karl, poly q, list #)
     364"USAGE:   furtherInvar(m,id,karl,q); m matrix, id,karl ideals, q poly, n int
     365ASSUME:  karl,id,q are invariant under the vectorfield m,
     366         moreover, q must be a variable
     367RETURN:  list of two ideals, the first ideal contains further invariants of
     368         the vectorfield
     369              m = sum m[i,1]*d/dx(i) with respect to id,p,q,
     370         i.e. we compute elements in the (invariant) subring generated by id
     371         which are divisible by q and divde them by q as much as possible
     372         the second ideal contains all invariants given before
     373         if n=1, a different algorithm is choosen which is sometimes faster
     374         (default: n=0)
    366375EXAMPLE: example furtherInvar; shows an example
    367376"
    368377{
     378  list ll = q;
     379  if ( size(#)>0 )
     380  {  ll = ll+list(#[1]);
     381  } 
    369382  int i;
    370383  ideal null;
    371   int z=size(id);
     384  int z=ncols(id);
    372385  intvec v;
    373   def @r=basering;
     386  def br=basering;
    374387  ideal su;
    375   for (i=1;i<=z;i++)
    376   {
    377     su[i]=subst(id[i],q,0);
    378   }
    379   // defines the map phi : r1 ---> @r defined by
    380   // y(i) ---> id[i](q=0)
    381   execute "ring r1="+charstr(basering)+",(y(1..z)),dp";
    382   setring @r;
     388  for (i=1; i<=z; i++)
     389  {
     390    su[i]=subst(id[i],q,0);
     391  }
     392  // -- define the map phi : r1 ---> br defined by y(i) ---> id[i](q=0) --
     393  execute ("ring r1="+charstr(basering)+",(y(1..z)),dp;");
     394  setring br;
    383395  map phi=r1,su;
    384396  setring r1;
    385   // computes the kernel of phi
    386   execute "ideal ker=preimage(@r,phi,null)";
    387   // defines the map psi : r1 ---> @r defined by y(i) ---> id[i]
    388   setring @r;
     397  // --------------- compute the kernel of phi ---------------------------
     398  ideal ker=preimage(br,phi,null);
     399  // ---- define the map psi : r1 ---> br defined by y(i) ---> id[i] -----
     400  setring br;
    389401  map psi=r1,id;
    390   // computes psi(ker(phi))
     402  // -------------------  compute psi(ker(phi)) --------------------------
    391403  ideal rel=psi(ker);
    392   // devides by the maximal power of q
    393   // and tests wether we really obtain invariants
     404  // devide by maximal power of q, test wether we really obtain invariants
    394405  for (i=1;i<=size(rel);i++)
    395406  {
     
    399410      if (der(m,rel[i])!=0)
    400411      {
    401          "error in furtherInvar, function not invariant";
     412         "// error in furtherInvar, function not invariant:";
    402413         rel[i];
    403414      }
     
    405416    rel[i]=simplify(rel[i],1);
    406417  }
    407   // test whether some variables occur linearly
    408   // and deletes the corresponding invariant function
     418  // ---------------------------------------------------------------------
     419  // test whether some variables occur linearly and then delete the
     420  // corresponding invariant function
    409421  setring r1;
    410422  int j;
     
    415427        if (deg(ker[i]/y(j))==0)
    416428        {
    417            setring @r;
    418            rel[i]= completeReduction(rel[i],karl,q);
     429           setring br;
     430           rel[i]= completeReduction(rel[i],karl,ll);
    419431           if(rel[i]!=0)
    420432           {
     
    427439
    428440  }
    429   setring @r;
     441  setring br;
    430442  list l=rel+null,karl;
    431443  return(l);
     
    445457///////////////////////////////////////////////////////////////////////////////
    446458
    447 
    448 
    449 proc invariantRing(matrix m, poly p, poly q,list #)
    450 "USAGE:   invariantRing(m,p,q[,choose]); m matrix; p,q poly; choose integer
    451 RETURN:   ideal which holds invariants of the action of the additive group
    452           defined by the vectorfield corresponding to the matrix m
    453           (m[i,1] are the coefficients of d/dx(i)).
    454           The polys p and q are assumed to be variables x(i) and x(j)
    455           such that m[j,1]=0 and m[i,1]=x(j)
    456           If choose=0 the computation stops if generators of the ring
    457           of invariants are computed (to be used only if you know that
    458           the ring of invariants is finitey generated).
    459           If choose<>0 it computes invariants up to degree choosen.
    460          
    461 EXAMPLE: example furtherInvar; shows an example
     459proc invariantRing(matrix m, poly p, poly q, int b, list #)
     460"USAGE:   invariantRing(m,p,q,b[,r,pa]); m matrix, p,q poly, b,r int, pa string
     461ASSUME:  p,q variables with m(p)=q and q invariant under m
     462         i.e. if p=x(i) and q=x(j) then m[j,1]=0 and m[i,1]=x(j)
     463RETURN:  ideal, containing generators of the ring of invariants of the
     464         additive gropup (K,+) given by the vectorfield
     465              m = m[1,1]*d/dx(1) +...+ m[n,1]*d/dx(n).
     466         If b>0 the computation stops after all invariants of degree <= b
     467         (and at least one of higher degree) are found or when all invariants
     468         are computed.
     469         If b<=0, the computation continues until all generators
     470         of the ring of invariants are computed (should be used only if the
     471         ring of invariants is known to be finitey generated otherwise the
     472         algorithm might not stop).
     473         If r=1 a different reduction is used which is sometimes faster
     474         (default r=0).
     475DISPLAY: if pa is given (any string as 5th or 6th argument), the computation
     476         pauses whenever new invariants are found and displays them
     477THEORY:  The algoritm to compute the ring of invariants works in char 0
     478         or big enough characteristic. (K,+) acts as the exponential of the
     479         vectorfield defined by the matrix m. For background see G.-M. Greuel,
     480         G. Pfister, Geometric quotients of unipotent group actions, Proc.
     481         London Math. Soc. ??,???,1993?
     482EXAMPLE: example invariantRing; shows an example     
    462483"
    463484{
    464485  ideal j;
    465486  int i,it;
    466   int bou=-1;
    467   if(size(#)>0)
    468   {
    469      bou=#[1];
     487  list ll=q;
     488  int bou=b;
     489  if( size(#) >0 )
     490  { if( typeof(#[1]) == "int")
     491    { ll=ll+list(#[1]);
     492    }
     493    if( typeof(#[1]) == "string")
     494    { string pau=#[1];
     495    }
     496    if( size(#)>1 )
     497    {  if( typeof(#[2]) == "string")
     498       { string pau=#[2];
     499       }
     500       if( typeof(#[2]) == "int")
     501      { ll=ll+list(#[2]);
     502      }
     503    }
    470504  }
    471505  int z;
     
    473507  ideal k1=1;
    474508  list k2;
    475   // computation of local invariants
     509  //------------------ computation of local invariants ------------------
    476510  for (i=1;i<=nvars(basering);i++)
    477511  {
    478512    karl=karl+localInvar(m,var(i),p,q);
    479513  }
    480   if(bou==0)
    481   {
    482      "                     ";
    483      "the local invariants:";
    484      "                     ";
     514  if( defined(pau) == voice)
     515  {  "";
     516     "// local invariants computed:";
     517     "";
    485518     karl;
    486      "                     ";
    487   }
    488   // computation of further invariants
     519     "";
     520     "// hit return key to continue!";
     521     pause;
     522     " ";
     523  }
     524  //------------------ computation of further invariants ----------------
    489525  it=0;
    490526  while (size(k1)!=0)
    491  {
     527  {
    492528    // test if the new invariants are already in the ring generated
    493     // by the invariants we constructed already
     529    // by the invariants we constructed so far
    494530    it++;
    495531    karl=sortier(karl);
     
    497533    for (i=1;i<=size(karl);i++)
    498534    {
    499        j=j+ simplify(completeReduction(karl[i],j,q),1);
     535       j=j + simplify(completeReduction(karl[i],j,ll),1);
    500536    }
    501537    karl=j;
     
    509545    for (i=1;i<=z;i++)
    510546    {
    511       k1[i]= completeReduction(k1[i],karl,q);
     547      k1[i]= completeReduction(k1[i],karl,ll);
    512548      if (k1[i]!=0)
    513549      {
     
    515551      }
    516552    }
    517     if(bou==0)
     553    if( defined(pau) == voice)
     554    { 
     555       "// the invariants after",it,"iteration(s):"; "";
     556       karl;"";
     557       "// hit return key to continue!";
     558       pause;
     559       "";
     560    }
     561    if( (bou>0) && (size(k1)>0) )
    518562    {
    519        "                                  ";
    520        "the invariants after the iteration";
    521        it;
    522        "                                  ";
    523        karl;
    524        "                                  ";
    525     }
    526     if((bou>0) && (size(k1)>0))
    527     {
    528       if(deg(k1[size(k1)])>bou)
     563      if( deg(k1[size(k1)])>bou )
    529564      {
    530565         return(karl);
     
    537572{ "EXAMPLE:"; echo = 2;
    538573
    539   //Winkelmann: free action but Spec k[x(1),...,x(5)]---> Spec In-
    540   //variantring is not surjective
     574  //Winkelmann: free action but Spec(k[x(1),..,x(5)])-->Spec(invariant ring)
     575  //is not surjective
    541576
    542577  ring rw=0,(x(1..5)),dp;
     
    545580  m[4,1]=x(2);
    546581  m[5,1]=1+x(1)*x(4)+x(2)*x(3);
    547   ideal in=invariantRing(m,x(3),x(1),0);
     582  ideal in=invariantRing(m,x(3),x(1),0);   //compute full invarint ring
    548583  in;
    549584
     
    556591  m[6,1]=x(3)^3;
    557592  m[7,1]=(x(1)*x(2)*x(3))^2;
    558   ideal in=invariantRing(m,x(4),x(1),6);
     593  ideal in=invariantRing(m,x(4),x(1),6);      //all invariants up to degree 6
    559594  in;
    560 
    561 
    562   //Deveney/Finston:Proper Ga-action which is not locally trivial
     595}
     596
     597///////////////////////////////////////////////////////////////////////////////
     598/*             Further examplex
     599       
     600  //Deveney/Finston: Proper Ga-action which is not locally trivial
    563601  //r[x(1),...,x(5)] is not flat over the ring of invariants
    564 
     602  LIB "invar.lib";
    565603  ring rd=0,(x(1..5)),dp;
    566604  matrix m[5][1];
     
    568606  m[4,1]=x(2);
    569607  m[5,1]=1+x(1)*x(4)^2;
    570   ideal in=invariantRing(m,x(3),x(1));
     608  ideal in=invariantRing(m,x(3),x(1),0,1);
    571609  in;
    572610
    573611  actionIsProper(m);
    574612
    575   //computes the relations between the invariants
     613  //compute the algebraic relations between the invariants
    576614  int z=size(in);
    577615  ideal null;
     
    617655  poly disc=9*det(m)/(x(1)^2*y(1)^4);
    618656
     657  LIB "invar.lib";
    619658  matrix n[6][1];
    620659  n[2,1]=x(1);
     
    624663  der(n,disc);
    625664
    626   //constructive approach to Weizenbcks theorem
    627 
    628   kill n;
     665//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
     666
     667//////////////////////////////////////////////////////////////////////////////
     668//constructive approach to Weizenboecks theorem
     669
    629670  int n=5;
    630 
    631   ring w=0,(x(1..n)),wp(1..n);
     671  // int n=6;  //limit
     672  ring w=32003,(x(1..n)),wp(1..n);
    632673
    633674  // definition of the vectorfield m=sum m[i]*d/dx(i)
     
    638679    m[i+1,1]=x(i);
    639680  }
    640   ideal in=invariantRing(m,x(2),x(1),0);
     681  ideal in=invariantRing(m,x(2),x(1),0,"");
    641682  in;
    642 
    643 }
     683*/
Note: See TracChangeset for help on using the changeset viewer.