Changeset 18bd9c in git for Singular/LIB/finvar.lib


Ignore:
Timestamp:
Jul 21, 1999, 6:52:04 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
f92cf85a06c9548f084c06b5adcdb9808ec2c69b
Parents:
1f75da5a9bbe84595567f0e42d2bca935d67bbce
Message:
*hannes: fixed finvar*-tests


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/finvar.lib

    r1f75da r18bd9c  
    1 // $Id: finvar.lib,v 1.17 1999-07-19 14:07:31 obachman Exp $
     1// $Id: finvar.lib,v 1.18 1999-07-21 16:52:00 Singular 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.17 1999-07-19 14:07:31 obachman Exp $"
     5version="$Id: finvar.lib,v 1.18 1999-07-21 16:52:00 Singular Exp $"
    66info="
    77LIBRARY:  finvar.lib       LIBRARY TO CALCULATE INVARIANT RINGS & MORE
     
    7272///////////////////////////////////////////////////////////////////////////////
    7373proc unique (list #)
    74 { for (int i=1;i<size(#);i=i+1)
     74{ for (int i=1;i<size(#);i++)
    7575  { if (#[i]==#[size(#)])
    7676    { return(0);
     
    8585RETURNS: the i-th cyclotomic polynomial (type <poly>) as one in the first ring
    8686         variable
    87 THEORY:  x^i-1 is divided by the j-th cyclotomic polynomial where j takes on 
     87THEORY:  x^i-1 is divided by the j-th cyclotomic polynomial where j takes on
    8888         the value of proper divisors of i
    8989EXAMPLE: example cyclotomic; shows an example
     
    119119    { break;
    120120    }
    121     j=j+1;
     121    j++;
    122122  }
    123123  min=min/leadcoef(min);               // making sure that the leading
     
    154154EXAMPLE: example group_reynolds; shows an example
    155155"
    156 { int ch=char(basering);            // the existance of the Reynolds operator 
     156{ int ch=char(basering);            // the existance of the Reynolds operator
    157157                                    // is dependent on the characteristic of
    158158                                    // the base field
     
    198198    while (TEST<>I)
    199199    { TEST=TEST*G(1);
    200       o1=o1+1;
     200      o1++;
    201201    }
    202202  }
    203203  int i=1;
    204204 // -------------- doubles among the generators should be avoided -------------
    205   for (int j=2;j<=gen_num;j=j+1)       // this loop adds the parameters to the
     205  for (int j=2;j<=gen_num;j++)         // this loop adds the parameters to the
    206206  {                                    // group, leaving out doubles and
    207207                                       // checking whether the parameters are
     
    217217    }
    218218    if (unique(G(1..i),#[j]))
    219     { i=i+1;
     219    { i++;
    220220      matrix G(i)=#[j];
    221221      if (ch<>0 && minpoly==0)         // finding out of which order the group
     
    224224        while (TEST<>I)
    225225        { TEST=TEST*G(i);
    226           o2=o2+1;
     226          o2++;
    227227        }
    228228        o1=o1*o2/gcd(o1,o2);           // lowest common multiple of the element
     
    246246  { l=0;                               // l is the number of products we get in
    247247                                       // one going
    248     for (m=g-j+1;m<=g;m=m+1)
    249     { for (k=1;k<=i;k=k+1)
    250       { l=l+1;
     248    for (m=g-j+1;m<=g;m++)
     249    { for (k=1;k<=i;k++)
     250      { l++;
    251251        matrix P(l)=G(k)*G(m);         // possible new element
    252252      }
    253253    }
    254254    j=0;
    255     for (k=1;k<=l;k=k+1)
     255    for (k=1;k<=l;k++)
    256256    { if (unique(G(1..g),P(k)))
    257       { j=j+1;                         // a new factor for next run
    258         g=g+1;
     257      { j++;                           // a new factor for next run
     258        g++;
    259259        matrix G(g)=P(k);              // a new group element -
    260260        if (ch<>0 && minpoly==0 && i<>1) //finding out of which order the group
     
    263263          while (TEST<>I)
    264264          { TEST=TEST*G(g);
    265             o2=o2+1;
     265            o2++;
    266266          }
    267267          o1=o1*o2/gcd(o1,o2);         // lowest common multiple of the element
     
    332332{ int i=0;
    333333   while((n/root^i)<>1)
    334    { i=i+1;
     334   { i++;
    335335   }
    336336   return(i);
     
    342342         G1,G2,...: nxn <matrices> generating a finite matrix group, ringname:
    343343         a <string> giving a name for a new ring of characteristic 0 for the
    344          Molien series in case of prime characteristic, lcm: an <int> giving 
     344         Molien series in case of prime characteristic, lcm: an <int> giving
    345345         the lowest common multiple of the elements' orders in case of prime
    346346         characteristic, minpoly==0 and a non-cyclic group, flags: an optional
     
    363363         Molien series (named M) is stored
    364364DISPLAY: information if the third component of flags does not equal 0
    365 THEORY:  In characteristic 0 the terms 1/det(1-xE) for all group elements of 
     365THEORY:  In characteristic 0 the terms 1/det(1-xE) for all group elements of
    366366         the Molien series are computed in a straight forward way. In prime
    367367         characteristic a Brauer lift is involved. The returned matrix gives
    368          enumerator and denominator of the expanded version where common 
     368         enumerator and denominator of the expanded version where common
    369369         factors have been canceled.
    370370EXAMPLE: example molien; shows an example
     
    538538                                       // new term of the Molien series
    539539 //------------ computing 1/det(1+xE) for all E in the group ------------------
    540     for (int j=1;j<=g;j=j+1)
     540    for (int j=1;j<=g;j++)
    541541    { if (not(typeof(#[j])=="matrix"))
    542542      { "ERROR:   the parameters must be a list of matrices and maybe an <intvec>";
     
    634634      int i, j, k;
    635635 // -------------- finding all the terms of the Molien series -----------------
    636       for (i=1;i<=g;i=i+1)
     636      for (i=1;i<=g;i++)
    637637      { setring br;
    638638        if (not(typeof(#[i])=="matrix"))
     
    649649        F=L[1];
    650650        C=L[2];
    651         for (j=2;j<=ncols(F);j=j+1)
     651        for (j=2;j<=ncols(F);j++)
    652652        { F[j]=-1*(F[j]-x);            // F[j] is now an eigenvalue of G(i),
    653653                                       // it is a power of a primitive r-th root
     
    672672//           { break;
    673673//           }
    674 //           k=k+1;
     674//           k++;
    675675//         }
    676676        setring `newring`;
     
    680680        { if (i<>g)
    681681          { Mstring=string(M);
    682             for (j=1;j<=size(Mstring);j=j+1)
     682            for (j=1;j<=size(Mstring);j++)
    683683            { if (Mstring[j]=="e")
    684684              { interval=0;
     
    758758 //----------------------- simulating characteristic 0 ------------------------
    759759    string chst=charstr(br);
    760     for (int i=1;i<=size(chst);i=i+1)
     760    for (int i=1;i<=size(chst);i++)
    761761    { if (chst[i]==",")
    762762      { break;
     
    794794    string links, rechts;
    795795 //----------------- finding all terms of the Molien series -------------------
    796     for (i=1;i<=g;i=i+1)
     796    for (i=1;i<=g;i++)
    797797    { setring br;
    798798      if (not(typeof(#[i])=="matrix"))
     
    805805      }
    806806      string stM(i)=string(#[i]);
    807       for (j=1;j<=size(stM(i));j=j+1)
     807      for (j=1;j<=size(stM(i));j++)
    808808      { if (stM(i)[j]=="
    809809")
     
    10481048                                       // new term of the Molien series
    10491049    int i=1;
    1050     for (int j=2;j<=gen_num;j=j+1)     // this loop adds the parameters to the
     1050    for (int j=2;j<=gen_num;j++)       // this loop adds the parameters to the
    10511051    {                                  // group, leaving out doubles and
    10521052                                       // checking whether the parameters are
     
    10621062      }
    10631063      if (unique(G(1..i),#[j]))
    1064       { i=i+1;
     1064      { i++;
    10651065        matrix G(i)=#[j];
    10661066        A(1)=concat(A(1),#[j]*vars);   // adding ring homomorphisms to A(1) -
     
    10981098    { l=0;                             // l is the number of products we get in
    10991099                                       // one going
    1100       for (m=g-j+1;m<=g;m=m+1)
    1101       { for (k=1;k<=i;k=k+1)
    1102         { l=l+1;
     1100      for (m=g-j+1;m<=g;m++)
     1101      { for (k=1;k<=i;k++)
     1102        { l++;
    11031103          matrix P(l)=G(k)*G(m);       // possible new element
    11041104        }
    11051105      }
    11061106      j=0;
    1107       for (k=1;k<=l;k=k+1)
     1107      for (k=1;k<=l;k++)
    11081108      { if (unique(G(1..g),P(k)))
    1109         { j=j+1;                       // a new factor for next run
    1110           g=g+1;
     1109        { j++;                         // a new factor for next run
     1110          g++;
    11111111          matrix G(g)=P(k);            // a new group element -
    11121112          A(1)=concat(A(1),P(k)*vars); // adding new mapping to A(1)
     
    11961196                                       // operator
    11971197    string chst=charstr(br);
    1198     for (int i=1;i<=size(chst);i=i+1)
     1198    for (int i=1;i<=size(chst);i++)
    11991199    { if (chst[i]==",")
    12001200      { break;
     
    12261226    string links, rechts;
    12271227    string stM(1)=string(#[1]);
    1228     for (o=1;o<=size(stM(1));o=o+1)
     1228    for (o=1;o<=size(stM(1));o++)
    12291229    { if (stM(1)[o]=="
    12301230")
     
    12441244                                       // new term of the Molien series
    12451245    i=1;
    1246     for (int j=2;j<=gen_num;j=j+1)     // this loop adds the parameters to the
     1246    for (int j=2;j<=gen_num;j++)     // this loop adds the parameters to the
    12471247    {                                  // group, leaving out doubles and
    12481248                                       // checking whether the parameters are
     
    12591259      }
    12601260      if (unique(G(1..i),#[j]))
    1261       { i=i+1;
     1261      { i++;
    12621262        matrix G(i)=#[j];
    12631263        A(1)=concat(A(1),G(i)*vars);   // adding ring homomorphisms to A(1)
    12641264        string stM(i)=string(G(i));
    1265         for (o=1;o<=size(stM(i));o=o+1)
     1265        for (o=1;o<=size(stM(i));o++)
    12661266        { if (stM(i)[o]=="
    12671267")
     
    13081308    { l=0;                             // l is the number of products we get in
    13091309                                       // one going
    1310       for (m=g-j+1;m<=g;m=m+1)
    1311       { for (k=1;k<=i;k=k+1)
    1312         { l=l+1;
     1310      for (m=g-j+1;m<=g;m++)
     1311      { for (k=1;k<=i;k++)
     1312        { l++;
    13131313          matrix P(l)=G(k)*G(m);       // possible new element
    13141314        }
    13151315      }
    13161316      j=0;
    1317       for (k=1;k<=l;k=k+1)
     1317      for (k=1;k<=l;k++)
    13181318      { if (unique(G(1..g),P(k)))
    1319         { j=j+1;                       // a new factor for next run
    1320           g=g+1;
     1319        { j++;                         // a new factor for next run
     1320          g++;
    13211321          matrix G(g)=P(k);            // a new group element -
    13221322          A(1)=concat(A(1),G(g)*vars); // adding new mapping to A(1)
    13231323          string stM(g)=string(G(g));
    1324           for (o=1;o<=size(stM(g));o=o+1)
     1324          for (o=1;o<=size(stM(g));o++)
    13251325          { if (stM(g)[o]=="
    13261326")
     
    14331433         (first n if there is no third parameter given, otherwise the next n
    14341434         terms depending on a previous calculation) and an intermediate result
    1435          (type <poly>) of the calculation to be used as third parameter in a 
     1435         (type <poly>) of the calculation to be used as third parameter in a
    14361436         next run of partial_molien
    14371437THEORY:  The following calculation is implemented:
     
    14801480    poly A(2)=fetch(br,A(2));          // fetching A(2) and M[1,2] into R
    14811481    poly den=fetch(br,A(1));
    1482     for (int i=1; i<=n; i=i+1)         // getting n terms and adding them up
     1482    for (int i=1; i<=n; i++)         // getting n terms and adding them up
    14831483    { min=lead(A(2));
    14841484      A(1)=A(1)+min;
     
    15341534    map pREY;
    15351535    matrix rowREY[1][n];
    1536     for (int i=1;i<=m;i=i+1)
     1536    for (int i=1;i<=m;i++)
    15371537    { rowREY=REY[i,1..n];
    15381538      pREY=br,ideal(rowREY);           // f is now the i-th ring homomorphism
     
    15641564         shoud be, G1,G2,...: <matrices> generating a finite matrix group
    15651565RETURNS: the basis (type <ideal>) of the space of invariants of degree g
    1566 THEORY:  A general polynomial of degree g is generated and the generators of 
     1566THEORY:  A general polynomial of degree g is generated and the generators of
    15671567         the matrix group applied. The difference ought to be 0 and this way a
    15681568         system of linear equations is created. It is solved by computing
     
    15821582  int n=nvars(br);
    15831583 //---------------------- checking that the input is ok -----------------------
    1584   for (i=1;i<=a;i=i+1)
     1584  for (i=1;i<=a;i++)
    15851585  { if (typeof(#[i])=="matrix")
    15861586    { if (nrows(#[i])==n && ncols(#[i])==n)
     
    16151615  int j,k;
    16161616 //------------------- building the system of linear equations ----------------
    1617   for (i=1;i<=a;i=i+1)
     1617  for (i=1;i<=a;i++)
    16181618  { I=ideal(matrix(vars)*transpose(imap(br,G(i))));
    16191619    I=I,p(1..m);
    16201620    f=T,I;
    16211621    Pnew=f(P);
    1622     for (j=1;j<=m;j=j+1)
     1622    for (j=1;j<=m;j++)
    16231623    { temp=P/mon[j]-Pnew/mon[j];
    1624       for (k=1;k<=m;k=k+1)
     1624      for (k=1;k<=m;k++)
    16251625      { S[m*(i-1)+j,k]=temp/p(k);
    16261626      }
     
    16351635  ideal I=ideal(matrix(mon)*s);        // I contains a basis of homogeneous
    16361636  if (I[1]<>0)                         // invariants of degree d
    1637   { for (i=1;i<=ncols(I);i=i+1)
     1637  { for (i=1;i<=ncols(I);i++)
    16381638    { I[i]=I[i]/leadcoef(I[i]);        // setting leading coefficients to 1
    16391639    }
     
    17581758{ "EXAMPLE: Sturmfels: Algorithms in Invariant Theory 2.3.7:"; echo=2;
    17591759   ring R=0,(x,y,z),dp;
    1760    matrix A[3][3]=0,1,0,-1,0,0,0,0,-1; 
     1760   matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
    17611761   intvec flags=0,1,0;
    17621762   matrix REY,M=reynolds_molien(A,flags);
     
    17811781  if (step_fac>j)
    17821782  { B=compress(evaluate_reynolds(REY,mon));
    1783     for (i=1;i<=ncols(B);i=i+1)        // those are taken our that are o mod sP
     1783    for (i=1;i<=ncols(B);i++)          // those are taken our that are o mod sP
    17841784    { if (reduce(B[i],sP)==0)
    17851785      { B[i]=0;
     
    18011801    part_mon=mon[lower_bound..upper_bound];
    18021802    part_mon=compress(evaluate_reynolds(REY,part_mon));
    1803     for (i=1;i<=ncols(part_mon);i=i+1)
     1803    for (i=1;i<=ncols(part_mon);i++)
    18041804    { if (reduce(part_mon[i],sP)==0)
    18051805      { part_mon[i]=0;
     
    18211821proc next_vector(intmat vec)
    18221822{ int n=ncols(vec);                    // p: >0, n: <0, p0: >=0, n0: <=0
    1823   for (int i=1;i<=n;i=i+1)             // finding out which is the first
     1823  for (int i=1;i<=n;i++)               // finding out which is the first
    18241824  { if (vec[1,i]<>0)                   // component <>0
    18251825    { break;
     
    18531853    return(new);
    18541854  }                                    // case left: 1,*,...,*
    1855   for (i=2;i<=n;i=i+1)
     1855  for (i=2;i<=n;i++)
    18561856  { if (vec[1,i]>0)                    // make first positive negative and
    18571857    { vec[1,i]=-vec[1,i];              // return
     
    18621862    }                                  // positive
    18631863  }
    1864   for (i=2;i<=n-1;i=i+1)               // case: 1,p,...,p after 1,n,...,n
     1864  for (i=2;i<=n-1;i++)                 // case: 1,p,...,p after 1,n,...,n
    18651865  { if (vec[1,i]>0)
    18661866    { vec[1,2]=vec[1,i]-1;             // shuffleing things around...
     
    18781878///////////////////////////////////////////////////////////////////////////////
    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 
     1880// field is of prime characteristic. If the base field has q elements
    18811881// (depending on minpoly) 1..q is mapped to those q elements.
    18821882///////////////////////////////////////////////////////////////////////////////
     
    18991899  while (1)
    19001900  { if (i<p^j)                         // finding an upper bound on i
    1901     { for (k=0;k<j-1;k=k+1)
     1901    { for (k=0;k<j-1;k++)
    19021902      { out=out+((i/p^k)%p)*a^k;       // finding how often p^k is contained in
    19031903      }                                // i
     
    19081908      return(out);
    19091909    }
    1910     j=j+1;
     1910    j++;
    19111911  }
    19121912}
     
    19561956    }
    19571957    P[j]=test_poly;                    // test_poly ist added to primary
    1958     j=j+1;                             // invariants
     1958    j++;                               // invariants
    19591959  }
    19601960  return(P,sP,CI,dB);
     
    20052005    { setring br;
    20062006      new=next_vector(new);
    2007       for (j=1;j<=cd;j=j+1)
     2007      for (j=1;j<=cd;j++)
    20082008      { pnew[1,j]=int_number_map(new[1,j]); // mapping an integer into br
    20092009      }
    20102010      if (unique(vec(1..counter),pnew)) // checking whether we tried pnew before
    2011       { counter=counter+1;
     2011      { counter++;
    20122012        matrix vec(counter)=pnew;      // keeping track of the ones we tried -
    20132013        test_poly=(vec(counter)*tB)[1,1]; // linear combination -
     
    20452045      return(P,sP,CI,dB-d+1);
    20462046    }
    2047     k=k+1;
     2047    k++;
    20482048  }
    20492049  return(P,sP,CI,dB);
     
    21582158      }                                // i.e. we can take all of B
    21592159      else
    2160       { for(j=i+1;j>i+dif;j=j+1)
     2160      { for(j=i+1;j>i+dif;j++)
    21612161        { CI=CI+ideal(var(j)^d);
    21622162        }
     
    21662166      }
    21672167      if (v)
    2168       { for (j=1;j<=dif;j=j+1)
     2168      { for (j=1;j<=dif;j++)
    21692169        { "  We find: "+string(P[i+j]);
    21702170        }
     
    23072307      }
    23082308      else                             // i.e. we can take all of B
    2309       { for(j=i+1;j>i+dif;j=j+1)
     2309      { for(j=i+1;j>i+dif;j++)
    23102310        { CI=CI+ideal(var(j)^d);
    23112311        }
     
    23152315      }
    23162316      if (v)
    2317       { for (j=1;j<=size(P)-i;j=j+1)
     2317      { for (j=1;j<=size(P)-i;j++)
    23182318        { "  We find: "+string(P[i+j]);
    23192319        }
     
    24222422  while(1)                             // repeat until n primary invariants are
    24232423  {                                    // found -
    2424     d=d+1;                             // degree where we'll search
     2424    d++;                               // degree where we'll search
    24252425    if (v)
    24262426    { "  Computing primary invariants in degree "+string(d)+":";
     
    24442444      }
    24452445      else                             // i.e. we can take all of B
    2446       { for(j=i+1;j<=i+dif;j=j+1)
     2446      { for(j=i+1;j<=i+dif;j++)
    24472447        { CI=CI+ideal(var(j)^d);
    24482448        }
     
    24522452      }
    24532453      if (v)
    2454       { for (j=1;j<=dif;j=j+1)
     2454      { for (j=1;j<=dif;j++)
    24552455        { "  We find: "+string(P[i+j]);
    24562456        }
     
    25652565  while(1)                             // repeat until n primary invariants are
    25662566  {                                    // found -
    2567     d=d+1;                             // degree where we'll search
     2567    d++;                               // degree where we'll search
    25682568    if (v)
    25692569    { "  Computing primary invariants in degree "+string(d)+":";
     
    25882588      }
    25892589      else                             // i.e. we can take all of B
    2590       { for(j=i+1;j<=i+dif;j=j+1)
     2590      { for(j=i+1;j<=i+dif;j++)
    25912591        { CI=CI+ideal(var(j)^d);
    25922592        }
     
    25962596      }
    25972597      if (v)
    2598       { for (j=1;j<=size(P)-i;j=j+1)
     2598      { for (j=1;j<=size(P)-i;j++)
    25992599        { "  We find: "+string(P[i+j]);
    26002600        }
     
    26742674                                       // as the number of primary invariants,
    26752675                                       // we should get
    2676   for (int i=1;i<=gen_num;i=i+1)
     2676  for (int i=1;i<=gen_num;i++)
    26772677  { if (typeof(#[i])=="matrix")
    26782678    { if (nrows(#[i])<>n or ncols(#[i])<>n)
     
    27122712  while(1)                             // repeat until n primary invariants are
    27132713  {                                    // found -
    2714     d=d+1;                             // degree where we'll search
     2714    d++;                               // degree where we'll search
    27152715    if (v)
    27162716    { "  Computing primary invariants in degree "+string(d)+":";
     
    27342734      }
    27352735      else                             // i.e. we can take all of B
    2736       { for(j=i+1;j<=i+dif;j=j+1)
     2736      { for(j=i+1;j<=i+dif;j++)
    27372737        { CI=CI+ideal(var(j)^d);
    27382738        }
     
    27422742      }
    27432743      if (v)
    2744       { for (j=1;j<=size(P)-i;j=j+1)
     2744      { for (j=1;j<=size(P)-i;j++)
    27452745        { "  We find: "+string(P[i+j]);
    27462746        }
     
    28412841    v=0;
    28422842  }
    2843   for (int i=1;i<=gen_num;i=i+1)
     2843  for (int i=1;i<=gen_num;i++)
    28442844  { if (typeof(#[i])=="matrix")
    28452845    { if (nrows(#[i])<>n or ncols(#[i])<>n)
     
    29812981  matrix test_matrix[1][dif];          // the linear combination to test
    29822982  intvec h;                            // Hilbert series
    2983   for (j=i+1;j<=i+dif;j=j+1)
     2983  for (j=i+1;j<=i+dif;j++)
    29842984  { CI=CI+ideal(var(j)^d);             // homogeneous polynomial of the same
    29852985                                       // degree as the one we're looking for
     
    30353035        { "         Give a new <int> > "+string(max)+" that bounds the range of coefficients:";
    30363036          answer=read("");
    3037           for (j=1;j<=size(answer)-1;j=j+1)
    3038           { for (k=0;k<=9;k=k+1)
     3037          for (j=1;j<=size(answer)-1;j++)
     3038          { for (k=0;k<=9;k++)
    30393039            { if (answer[j]==string(k))
    30403040              { break;
     
    30793079  ideal TEST;
    30803080  while (dif>0)
    3081   { for (j=i+1;j<=i+dif;j=j+1)
     3081  { for (j=i+1;j<=i+dif;j++)
    30823082    { CI=CI+ideal(var(j)^d);           // homogeneous polynomial of the same
    30833083                                       // degree as the one we're looking for
     
    31443144          { "         Give a new <int> > "+string(max)+" that bounds the range of coefficients:";
    31453145            answer=read("");
    3146             for (j=1;j<=size(answer)-1;j=j+1)
    3147             { for (k=0;k<=9;k=k+1)
     3146            for (j=1;j<=size(answer)-1;j++)
     3147            { for (k=0;k<=9;k++)
    31483148              { if (answer[j]==string(k))
    31493149                { break;
     
    32913291      }                                // dif invariants -
    32923292      else                             // i.e. we can take all of B
    3293       { for(j=i+1;j>i+dif;j=j+1)
     3293      { for(j=i+1;j>i+dif;j++)
    32943294        { CI=CI+ideal(var(j)^d);
    32953295        }
     
    33033303      }
    33043304      if (v)
    3305       { for (j=1;j<=dif;j=j+1)
     3305      { for (j=1;j<=dif;j++)
    33063306        { "  We find: "+string(P[i+j]);
    33073307        }
     
    34453445      }
    34463446      else                             // i.e. we can take all of B
    3447       { for(j=i+1;j>i+dif;j=j+1)
     3447      { for(j=i+1;j>i+dif;j++)
    34483448        { CI=CI+ideal(var(j)^d);
    34493449        }
     
    34573457      }
    34583458      if (v)
    3459       { for (j=1;j<=size(P)-i;j=j+1)
     3459      { for (j=1;j<=size(P)-i;j++)
    34603460        { "  We find: "+string(P[i+j]);
    34613461        }
     
    35653565  while(1)                             // repeat until n primary invariants are
    35663566  {                                    // found -
    3567     d=d+1;                             // degree where we'll search
     3567    d++;                               // degree where we'll search
    35683568    if (v)
    35693569    { "  Computing primary invariants in degree "+string(d)+":";
     
    35873587      }
    35883588      else                             // i.e. we can take all of B
    3589       { for(j=i+1;j<=i+dif;j=j+1)
     3589      { for(j=i+1;j<=i+dif;j++)
    35903590        { CI=CI+ideal(var(j)^d);
    35913591        }
     
    35993599      }
    36003600      if (v)
    3601       { for (j=1;j<=dif;j=j+1)
     3601      { for (j=1;j<=dif;j++)
    36023602        { "  We find: "+string(P[i+j]);
    36033603        }
     
    37133713  while(1)                             // repeat until n primary invariants are
    37143714  {                                    // found -
    3715     d=d+1;                             // degree where we'll search
     3715    d++;                               // degree where we'll search
    37163716    if (v)
    37173717    { "  Computing primary invariants in degree "+string(d)+":";
     
    37353735      }
    37363736      else                             // i.e. we can take all of B
    3737       { for(j=i+1;j<=i+dif;j=j+1)
     3737      { for(j=i+1;j<=i+dif;j++)
    37383738        { CI=CI+ideal(var(j)^d);
    37393739        }
     
    37473747      }
    37483748      if (v)
    3749       { for (j=1;j<=size(P)-i;j=j+1)
     3749      { for (j=1;j<=size(P)-i;j++)
    37503750        { "  We find: "+string(P[i+j]);
    37513751        }
     
    38343834                                       // as the number of primary invariants,
    38353835                                       // we should get
    3836   for (int i=1;i<=gen_num;i=i+1)
     3836  for (int i=1;i<=gen_num;i++)
    38373837  { if (typeof(#[i])=="matrix")
    38383838    { if (nrows(#[i])<>n or ncols(#[i])<>n)
     
    38713871  while(1)                             // repeat until n primary invariants are
    38723872  {                                    // found -
    3873     d=d+1;                             // degree where we'll search
     3873    d++;                               // degree where we'll search
    38743874    if (v)
    38753875    { "  Computing primary invariants in degree "+string(d)+":";
     
    38923892      }
    38933893      else                             // i.e. we can take all of B
    3894       { for(j=i+1;j<=i+dif;j=j+1)
     3894      { for(j=i+1;j<=i+dif;j++)
    38953895        { CI=CI+ideal(var(j)^d);
    38963896        }
     
    39043904      }
    39053905      if (v)
    3906       { for (j=1;j<=size(P)-i;j=j+1)
     3906      { for (j=1;j<=size(P)-i;j++)
    39073907        { "  We find: "+string(P[i+j]);
    39083908        }
     
    40154015    }
    40164016  }
    4017   for (int i=1;i<=gen_num;i=i+1)
     4017  for (int i=1;i<=gen_num;i++)
    40184018  { if (typeof(#[i])=="matrix")
    40194019    { if (nrows(#[i])<>n or ncols(#[i])<>n)
     
    41684168  intmat PP[s][1];
    41694169  intmat TEST[s][1];
    4170   for (int i=1;i<=s;i=i+1)
     4170  for (int i=1;i<=s;i++)
    41714171  { if (i<0)
    41724172    { "ERROR:   The entries of <intvec> may not be <= 0";
     
    41804180        intmat PPd_neu_gross[s][nc];
    41814181        PPd_neu_gross[i..s,1..nc]=PPd_neu[1..s-i+1,1..nc];
    4182         for (j=1;j<=nc;j=j+1)
     4182        for (j=1;j<=nc;j++)
    41834183        { PPd_neu_gross[i,j]=PPd_neu_gross[i,j]+1;
    41844184        }
     
    42214221         irreducible secondary invariants (type <matrix>)
    42224222DISPLAY: information if v does not equal 0
    4223 THEORY:  The secondary invariants are calculated by finding a basis (in terms 
    4224          of monomials) of the basering modulo the primary invariants, mapping 
     4223THEORY:  The secondary invariants are calculated by finding a basis (in terms
     4224         of monomials) of the basering modulo the primary invariants, mapping
    42254225         those to invariants with the Reynolds operator and using these images
    42264226         or their power products s. t. they are linearly independent modulo
     
    42714271 //- finding the polynomial giving number and degrees of secondary invariants -
    42724272  poly p=1;
    4273   for (j=1;j<=n;j=j+1)                 // calculating the denominator of the
     4273  for (j=1;j<=n;j++)                   // calculating the denominator of the
    42744274  { p=p*(1-var(1)^deg(P[j]));          // Hilbert series of the ring generated
    42754275  }                                    // by the primary invariants -
     
    43024302  ideal S=1;                           // 1 is the first secondary invariant -
    43034303 //--------------------- generating secondary invariants ----------------------
    4304   for (i=2;i<=m;i=i+1)                 // going through dimmat -
     4304  for (i=2;i<=m;i++)                   // going through dimmat -
    43054305  { if (int(dimmat[i,1])<>0)           // when it is == 0 we need to find 0
    43064306    {                                  // elements in the current degree (i-1)
     
    43144314      }                                // secondary invariants
    43154315      if (size(ideal(PP))<>0)
    4316       { for (j=1;j<=ncols(PP);j=j+1)   // going through all the power products
     4316      { for (j=1;j<=ncols(PP);j++)     // going through all the power products
    43174317        { pp=1;
    4318           for (k=1;k<=nrows(PP);k=k+1)
     4318          for (k=1;k<=nrows(PP);k++)
    43194319          { pp=pp*IS[1,k]^PP[k,j];
    43204320          }
    43214321          if (reduce(pp,TEST)<>0)
    43224322          { S=S,pp;
    4323             counter=counter+1;
     4323            counter++;
    43244324            if (v)
    43254325            { "  We find: "+string(pp);
     
    43504350            { "  We find: "+string(B[1]);
    43514351            }
    4352             for (j=2;j<=int(dimmat[i,1]);j=j+1)
     4352            for (j=2;j<=int(dimmat[i,1]);j++)
    43534353            { deg_vec=deg_vec,i-1;
    43544354              if (v)
     
    43584358          }
    43594359          else
    4360           { for (j=1;j<=int(dimmat[i,1]);j=j+1)
     4360          { for (j=1;j<=int(dimmat[i,1]);j++)
    43614361            { deg_vec=deg_vec,i-1;
    43624362              if (v)
     
    43714371          {                            // invariants that are linearly
    43724372                                       // independent modulo TEST
    4373             j=j+1;
     4373            j++;
    43744374            if (reduce(B[j],TEST)<>0)  // B[j] should be added
    43754375            { S=S,B[j];
     
    43814381              { deg_vec=deg_vec,i-1;
    43824382              }
    4383               counter=counter+1;
     4383              counter++;
    43844384              if (v)
    43854385              { "  We find: "+string(B[j]);
     
    44814481  intvec deg_dim_vec;
    44824482 //- finding the polynomial giving number and degrees of secondary invariants -
    4483   for (j=1;j<=n;j=j+1)
     4483  for (j=1;j<=n;j++)
    44844484  { deg_dim_vec[j]=deg(P[j]);
    44854485  }
    44864486  setring `ring_name`;
    44874487  poly p=1;
    4488   for (j=1;j<=n;j=j+1)                 // calculating the denominator of the
     4488  for (j=1;j<=n;j++)                   // calculating the denominator of the
    44894489  { p=p*(1-var(1)^deg_dim_vec[j]);     // Hilbert series of the ring generated
    44904490  }                                    // by the primary invariants -
     
    45054505  m=nrows(dimmat);                     // m-1 is the highest degree
    45064506  deg_dim_vec=1;
    4507   for (j=2;j<=m;j=j+1)
     4507  for (j=2;j<=m;j++)
    45084508  { deg_dim_vec=deg_dim_vec,int(dimmat[j,1]);
    45094509  }
     
    45224522  ideal S=1;                           // 1 is the first secondary invariant
    45234523 //------------------- generating secondary invariants ------------------------
    4524   for (i=2;i<=m;i=i+1)                 // going through deg_dim_vec -
     4524  for (i=2;i<=m;i++)                   // going through deg_dim_vec -
    45254525  { if (deg_dim_vec[i]<>0)             // when it is == 0 we need to find 0
    45264526    {                                  // elements in the current degree (i-1)
     
    45344534      }                                // irreducible secondary invariants
    45354535      if (size(ideal(PP))<>0)
    4536       { for (j=1;j<=ncols(PP);j=j+1)   // going through all of those
     4536      { for (j=1;j<=ncols(PP);j++)     // going through all of those
    45374537        { pp=1;
    4538           for (k=1;k<=nrows(PP);k=k+1)
     4538          for (k=1;k<=nrows(PP);k++)
    45394539          { pp=pp*IS[1,k]^PP[k,j];
    45404540          }
    45414541          if (reduce(pp,TEST)<>0)
    45424542          { S=S,pp;
    4543             counter=counter+1;
     4543            counter++;
    45444544            if (v)
    45454545            { "  We find: "+string(pp);
     
    45704570            { "  We find: "+string(B[1]);
    45714571            }
    4572             for (j=2;j<=deg_dim_vec[i];j=j+1)
     4572            for (j=2;j<=deg_dim_vec[i];j++)
    45734573            { deg_vec=deg_vec,i-1;
    45744574              if (v)
     
    45784578          }
    45794579          else
    4580           { for (j=1;j<=deg_dim_vec[i];j=j+1)
     4580          { for (j=1;j<=deg_dim_vec[i];j++)
    45814581            { deg_vec=deg_vec,i-1;
    45824582              if (v)
     
    45914591          {                            // invariants that are linearly
    45924592                                       // independent modulo TEST
    4593             j=j+1;
     4593            j++;
    45944594            if (reduce(B[j],TEST)<>0)   // B[j] should be added
    45954595            { S=S,B[j];
     
    46014601              { deg_vec=deg_vec,i-1;
    46024602              }
    4603               counter=counter+1;
     4603              counter++;
    46044604              if (v)
    46054605              { "  We find: "+string(B[j]);
     
    46434643         P: a 1xn <matrix> with primary invariants, REY: a gxn <matrix>
    46444644         representing the Reynolds operator, deg_vec: an optional <intvec>
    4645          listing some degrees where no non-trivial homogeneous invariants can 
     4645         listing some degrees where no non-trivial homogeneous invariants can
    46464646         be found, v: an optional <int>
    46474647ASSUME:  n is the number of variables of the basering, g the size of the group,
     
    47164716  int j, m, d;
    47174717  int max=1;
    4718   for (j=1;j<=n;j=j+1)
     4718  for (j=1;j<=n;j++)
    47194719  { max=max*deg(P[j]);
    47204720  }
     
    47384738 //--------------------- generating secondary invariants ----------------------
    47394739  while (counter<>max)
    4740   { i=i+1;
     4740  { i++;
    47414741    if (deg_vec[k]<>i)
    47424742    { if (v)
     
    47484748                                       // and that don't reduce to 0 modulo sP
    47494749      TEST=sP;
    4750       for (j=1;j<=ncols(B);j=j+1)
     4750      for (j=1;j<=ncols(B);j++)
    47514751      {                                // that are linearly independent modulo
    47524752                                       // TEST
    47534753        if (reduce(B[j],TEST)<>0)      // B[j] should be added
    47544754        { S=S,B[j];
    4755           counter=counter+1;
     4755          counter++;
    47564756          if (v)
    47574757          { "  We find: "+string(B[j]);
     
    47754775      }
    47764776      else
    4777       { k=k+1;
     4777      { k++;
    47784778      }
    47794779    }
     
    48744874  int j, m, d;
    48754875  int max=1;
    4876   for (j=1;j<=n;j=j+1)
     4876  for (j=1;j<=n;j++)
    48774877  { max=max*deg(P[j]);
    48784878  }
     
    49004900 //------------------- generating secondary invariants ------------------------
    49014901  while (counter<>max)
    4902   { i=i+1;
     4902  { i++;
    49034903    if (deg_vec[l]<>i)
    49044904    { if (v)
     
    49114911                                       // invariants
    49124912      if (size(ideal(PP))<>0)
    4913       { for (j=1;j<=ncols(PP);j=j+1)   // going through all those power products
     4913      { for (j=1;j<=ncols(PP);j++)     // going through all those power products
    49144914        { pp=1;
    4915           for (k=1;k<=nrows(PP);k=k+1)
     4915          for (k=1;k<=nrows(PP);k++)
    49164916          { pp=pp*IS[1,k]^PP[k,j];
    49174917          }
    49184918          if (reduce(pp,TEST)<>0)
    49194919          { S=S,pp;
    4920             counter=counter+1;
     4920            counter++;
    49214921            if (v)
    49224922            { "  We find: "+string(pp);
     
    49384938                                       // operator that are linearly independent
    49394939                                       // and that don't reduce to 0 modulo sP
    4940         for (j=1;j<=ncols(B);j=j+1)
     4940        for (j=1;j<=ncols(B);j++)
    49414941        { if (reduce(B[j],TEST)<>0)    // B[j] should be added
    49424942          { S=S,B[j];
     
    49484948            { irreducible_deg_vec=irreducible_deg_vec,i;
    49494949            }
    4950             counter=counter+1;
     4950            counter++;
    49514951            if (v)
    49524952            { "  We find: "+string(B[j]);
     
    49714971      }
    49724972      else
    4973       { l=l+1;
     4973      { l++;
    49744974      }
    49754975    }
     
    50225022      }
    50235023      int v=#[size(#)];
    5024       for (i=1;i<=gen_num;i=i+1)
     5024      for (i=1;i<=gen_num;i++)
    50255025      { if (typeof(#[i])<>"matrix")
    50265026        { "ERROR:   These parameters should be generators of the finite matrix group.";
     
    50365036    { int v=0;
    50375037      int gen_num=size(#);
    5038       for (i=1;i<=gen_num;i=i+1)
     5038      for (i=1;i<=gen_num;i++)
    50395039      { if (typeof(#[i])<>"matrix")
    50405040        { "ERROR:   These parameters should be generators of the finite matrix group.";
     
    50955095  matrix M(1)[gen_num][k];             // M(1) will contain a module
    50965096  ideal B;
    5097   for (i=1;i<=gen_num;i=i+1)
     5097  for (i=1;i<=gen_num;i++)
    50985098  { B=ideal(matrix(maxideal(1))*transpose(#[i]));   // image of the various
    50995099                                       // variables under the i-th generator -
     
    51165116  M[1..k,1..m]=matrix(f(M(2)));        // will contain a module -
    51175117  matrix P=f(P);                       // primary invariants in the new ring
    5118   for (i=1;i<=n;i=i+1)
    5119   { for (j=1;j<=k;j=j+1)
     5118  for (i=1;i<=n;i++)
     5119  { for (j=1;j<=k;j++)
    51205120    { M[j,m+(i-1)*k+j]=y(i)-P[1,i];
    51215121    }
     
    51345134  S=matrix(trivialS)*matrix(M(2));     // S now contains the secondary
    51355135                                       // invariants
    5136   for (i=1; i<=m;i=i+1)
     5136  for (i=1; i<=m;i++)
    51375137  { S[1,i]=S[1,i]/leadcoef(S[1,i]); // making elements nice
    51385138  }
     
    51405140  if (v)
    51415141  { "  These are the secondary invariants: ";
    5142     for (i=1;i<=m;i=i+1)
     5142    for (i=1;i<=m;i++)
    51435143    { "   "+string(S[1,i]);
    51445144    }
     
    53865386         (i.e. we will not even attempt to compute the Reynolds operator or
    53875387         Molien series), the second component should give the size of intervals
    5388          between canceling common factors in the expansion of the Molien 
     5388         between canceling common factors in the expansion of the Molien
    53895389         series,
    53905390         0 (the default) means only once after generating all terms, in prime
     
    54505450    }
    54515451  }
    5452   for (int i=1;i<=gen_num;i=i+1)
     5452  for (int i=1;i<=gen_num;i++)
    54535453  { if (typeof(#[i])=="matrix")
    54545454    { if (nrows(#[i])<>n or ncols(#[i])<>n)
     
    56195619    execute "minpoly=number("+mp+");";
    56205620    ideal I=ideal(imap(br,F));
    5621     for (int i=1;i<=m;i=i+1)
     5621    for (int i=1;i<=m;i++)
    56225622    { I[i]=I[i]-y(i);
    56235623    }
     
    56265626    execute "minpoly=number("+mp+");";
    56275627    ideal vars;
    5628     for (i=2;i<=n;i=i+1)
     5628    for (i=2;i<=n;i++)
    56295629    { vars[i]=0;
    56305630    }
     
    56625662THEORY:  A Groebner basis of the ideal of algebraic relations of the invariant
    56635663         ring generators is calculated, then one of the basis elements plus the
    5664          ideal generators. The variables of the original ring are eliminated 
     5664         ideal generators. The variables of the original ring are eliminated
    56655665         and the polynomials that are left define the relative orbit variety
    56665666         with respect to I.
     
    56815681    ideal J=ideal(imap(br,F));
    56825682    ideal I=imap(br,I);
    5683     for (int i=1;i<=m;i=i+1)
     5683    for (int i=1;i<=m;i++)
    56845684    { J[i]=J[i]-y(i);
    56855685    }
     
    56895689    J=std(J);
    56905690    ideal vars;
    5691     //for (i=1;i<=n;i=i+1)
     5691    //for (i=1;i<=n;i++)
    56925692    //{ vars[i]=0;
    56935693    //}
     
    56975697    ideal G=emb(J);
    56985698    J=J-G;
    5699     for (i=1;i<=ncols(G);i=i+1)
     5699    for (i=1;i<=ncols(G);i++)
    57005700    { if (J[i]<>0)
    57015701      { G[i]=0;
     
    57065706    execute "minpoly=number("+mp+");";
    57075707    ideal vars;
    5708     for (i=2;i<=n;i=i+1)
     5708    for (i=2;i<=n;i++)
    57095709    { vars[i]=0;
    57105710    }
     
    57535753    execute "ring R=("+charstr(br)+"),("+varstr(br)+","+varstr(E)+"),lp;";
    57545754    ideal F=imap(br,F);
    5755     for (int i=1;i<=n;i=i+1)
     5755    for (int i=1;i<=n;i++)
    57565756    { F=0,F;
    57575757    }
Note: See TracChangeset for help on using the changeset viewer.