Changeset 591ca8 in git


Ignore:
Timestamp:
May 27, 2013, 7:06:17 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a16793b8c82de22d65f5e6bed4ae31dc3f0abaf4
Parents:
55150e5fbf40e9e0fa5d2c2fe5efd309f4ab2e12
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-05-27 19:06:17+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-05-27 19:06:57+02:00
Message:
chg: new version of grobcov.lib, add: locusdg

from master
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/grobcov.lib

    r55150e r591ca8  
    1616          published in a forthcoming paper by Abanades, Botana, Montes, Recio:
    1717          \''Geometrical locus of points using the Groebner cover\''.
     18
    1819
    1920          The central routine is grobcov. Given a parametric
     
    127128                   ''Geometrical locus of points using the Groebner cover''
    128129
    129 locusto:    Transforms the output of locus to a string that
     130locusdg(G):  Is a special routine for computing the locus in dinamical geometry.
     131                    It detects automatically a possible point that is to be avoided by the mover,
     132                    whose coordinates must be the last two coordinates in the definition of the ring.
     133                    If such a point is detected, then it eliminates the segments of the grobcov
     134                    depending on the point that is to be avoided.
     135                    Then it calls locus.
     136
     137locusto(L):  Transforms the output of locus to a string that
    130138                  can be reed from different computational systems.
    131139
     
    37393747//******************** Begin locus ******************************
    37403748
     3749
    37413750// indepparameters
    37423751// Auxiliary routine to detect "Special" components of the locus
     
    37483757{
    37493758  def R=basering;
    3750   ideal B0; ideal B00;
     3759  ideal v=variables(B);
     3760  setring @RP;
     3761  def BP=imap(R,B);
     3762  def vp=imap(R,v);
     3763  ideal varpar=variables(BP);
    37513764  int te;
    3752   int i; int j;
    3753   list s;
    3754   poly t;
    3755   ideal v=variables(B); // all the variables on B but not the parameters
    3756   setring(@RP);
    3757   ideal vv=imap(R,v);
    3758   def BP=imap(R,B);
    3759   option(redSB);
    3760   BP=std(BP);
     3765  te=equalideals(vp,varpar);
    37613766  setring(R);
    3762   B0=imap(@RP,BP);
    3763   for(i=1;i<=size(B0);i++)
    3764   {
    3765     if (equalideals(variables(B0[i]),ideal(0))){;}
    3766     else {B00[size(B00)+1]=B0[i];}
    3767   }
    3768   for(i=1;i<=size(B00);i++)
    3769   {
    3770     s=factorize(B00[i]);
    3771     for(j=1;j<=size(s[1]);j++)
    3772     {
    3773       if (equalideals(variables(s[1][j]),ideal(0))){;}
    3774       else{B00[i]=s[1][j];}
    3775     }
    3776   }
    3777   setring(@RP);
    3778   BP=imap(R,B00);
    3779   ideal vp=variables(BP);
    3780   if(equalideals(vv,vp)){te=1;} else{te=0;}
    3781   setring(R);
    3782   return(te);
    3783 }
     3767  if(te){return(1);}
     3768  else{return(0);}
     3769}
     3770
    37843771
    37853772// dimP0: Auxiliar routine
     
    40374024
    40384025// input:      The output G of the grobcov (in generic representation, which is the default)
    4039 //                It allows an extra  pair of arguments as option: locus(G,"minus",N)
    4040 //                where N is the ideal representing some excluded point of the mover
    4041 //                if there is some point that the mover should avoid.
    40424026// output:
    40434027//         list, the canonical P-representation of the Normal and Non-Normal locus:
     
    40604044//              If all levels of a class of locus are 1, then the set is locally closed. Otherwise the level
    40614045//              gives the depth of the component.
    4062 proc locus(list GG,list #)
     4046proc locus(list GG)
    40634047"USAGE:   locus(G);
    40644048               The input must be the grobcov  of a parametrical ideal
     
    40784062{
    40794063  int t1=1; int t2=1;
    4080   list Opc=#;
    40814064  def R=basering;
    40824065  setglobalrings();
    4083   string ty;
    40844066  list G1; list G2;
    4085   int i; int d; int j; int k; int i0=1; ideal minu; int te;
    4086   for(i=1;i<=size(Opc) div 2;i++)
    4087   {
    4088       if(Opc[2*i-1]=="minus")
    4089       {
    4090         minu=Opc[2*i];
    4091         setring(@RP);
    4092         list nGP;
    4093         def GP=imap(R,GG);
    4094         ideal BP;
    4095         def minup=imap(R,minu);
    4096         for(j=1;j<=size(GP);j++)
    4097         {
    4098           te=1; k=1;
    4099           BP=std(GP[j][2]);
    4100           while((te==1) and (k<=size(minup)))
    4101           {
    4102             if((reduce(minup[k],BP))!=0){te=0;}
    4103             k++;
    4104           }
    4105           if(te==0){nGP[size(nGP)+1]=GP[j];}
    4106         }
    4107         setring(R);
    4108         GG=imap(@RP,nGP);
    4109      }
    4110   }
    4111   list G;
    4112   for(i=i0;i<=size(GG);i++)
    4113   {
    4114     G[i+1-i0]=GG[i];
    4115   }
     4067  def G=GG;
     4068  int i; int d; int j; int k;
     4069  t1=1;
    41164070  for(i=1;i<=size(G);i++)
    41174071  {
     
    41504104  }
    41514105  setring(R);
     4106  ideal h;
    41524107  if(t1)
    41534108  {
    41544109    def P1=imap(@RP,P1RP);
     4110    for(i=1;i<=size(P1);i++)
     4111    {
     4112      for(j=1;j<=size(P1[i][3]);j++)
     4113      {
     4114        h=factorize(P1[i][3][j],1);
     4115        P1[i][3][j]=h[1];
     4116        for(k=2;k<=size(h);k++)
     4117        {
     4118          P1[i][3][j]=P1[i][3][j]*h[k];
     4119        }
     4120        //P1[i][3][j]=normalize(P1[i][3][j]);
     4121      }
     4122    }
    41554123  }
    41564124  else{list P1;}
     
    41654133    for(k=1;k<=size(G2[i][3]);k++)
    41664134    {
    4167       P2[size(P2)+1]=list(G2[i][3][k][1],G2[i][3][k][2]); // ,ty
     4135      P2[size(P2)+1]=list(G2[i][3][k][1],G2[i][3][k][2]);
    41684136    }
    41694137  }
     
    42104178  ring R=(0,a,b),(x,y),dp;
    42114179  short=0;
    4212   ideal H=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1;
    4213   "System H = "; H; " ";
    4214   def G=grobcov(H);
    4215   //"grobcov(H)="; G; " ";
    4216   def L=locus(G);
    4217   "locus(G)="; L; " ";
    4218   kill R;
    4219   ring R=(0,x5,x6),(x1,x2,x3,x4),dp;
    4220   ideal S=(x1-3)^2+(x2-1)^2-9,
    4221              (4-x2)*(x3-3)+(x1-3)*(x4-1),
    4222              (3-x1)*(x3-x1)+(4-x2)*(x4-x2),
    4223              (4-x4)*x5+(x3-3)*x6+3*x4-4*x3,
    4224              (x5-x1)^2+(x6-x2)^2-(x1-x3)^2-(x2-x4)^2;
    4225  "System S="; S;" ";
    4226  def G=grobcov(S);
    4227 // "grobcov(S)="; G;
    4228  ideal N=x1-3,x2-4;
    4229  "N="; N;" ";
    4230   def L=locus(G,"minus",N);
    4231  "locus(G,minus,N)="; L;" ";
     4180  "Concoid";
     4181  ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1;
     4182  "System="; S96; " ";
     4183  locus(grobcov(S96));
    42324184}
    42334185
     
    42474199RETURN: The locus in string standard form
    42484200NOTE:     It can only be called after computing the locus(grobcov(F)) of the
    4249           parametrical ideal.
    4250           The basering R, must be of the form Q[a,b,..][x,y,..].
     4201              parametrical ideal.
     4202              The basering R, must be of the form Q[a,b,..][x,y,..].
    42514203KEYWORDS: geometrical locus, locus, loci.
    42524204EXAMPLE:  locusto; shows an example"
     
    42984250  ring R=(0,a,b),(x,y),dp;
    42994251  short=0;
    4300   ideal H=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1;
    4301   def G=grobcov(H);
    4302   "grobcov(H)="; G; " ";
    4303   def Gp=locus(G);
    4304   "locus(G)="; Gp;
    4305   def L=locusto(Gp); " ";
    4306   "locusto(Gp)="; L;
    4307 }
     4252  ideal S96=x^2+y^2-4,(b-2)*x-a*y+2*a,(a-x)^2+(b-y)^2-1;
     4253  "System="; S96; " ";
     4254  locusto(locus(grobcov(S96)));
     4255}
     4256
     4257// locusdg is the routine for computing the locus in dinamical geometry.
     4258//    It detects automatically a possible point that is to be avoided by the mover,
     4259//    whose coordinates must be the last two coordinates in the definition of the ring.
     4260//    If such a point is detected, then it eliminates the segments of the grobcov that
     4261//    have this point as solution.
     4262//    Then it calls locus.
     4263proc locusdg(list GG)
     4264"USAGE:  locusdg(GG) ;
     4265          The argument must be the output of grobcov
     4266RETURN:  The  components of the locus of points in dinamical geometry
     4267NOTE:  The basering R, must be of the form Q[a][x], a=parameters,
     4268          x=variables, and the mover coordinates must be the two last variables in the
     4269          definition of the ring.
     4270KEYWORDS: ring, locus, grobcov
     4271EXAMPLE:  locusdg(GG); shows an example"
     4272{
     4273  def R=basering;
     4274  int i; int j; int k;
     4275  def B0=GG[1][2];
     4276  if (equalideals(B0,ideal(1)))
     4277  {
     4278    return(locus(GG));
     4279  }
     4280  else
     4281  {
     4282    int n=nvars(R);
     4283    ideal vmov=var(n-1),var(n);
     4284    ideal N;
     4285    intvec xw; intvec yw;
     4286    for(i=1;i<=n-1;i++){xw[i]=0;}
     4287    xw[n]=1;
     4288    for(i=1;i<=n;i++){yw[i]=0;}
     4289    yw[n-1]=1;
     4290    poly px; poly py;
     4291    int te=1;
     4292    i=1;
     4293    while( te and i<=size(B0))
     4294    {
     4295      if((deg(B0[i],xw)==1) and (deg(B0[i])==1)){px=B0[i]; te=0;}
     4296      i++;
     4297    }
     4298    i=1; te=1;
     4299    while( te and i<=size(B0))
     4300    {
     4301      if((deg(B0[i],yw)==1) and (deg(B0[i])==1)){py=B0[i]; te=0;}
     4302      i++;
     4303    }
     4304    N=px,py;
     4305    setglobalrings();
     4306    te=indepparameters(N);
     4307    if(te)
     4308    {
     4309      //"T_N="; N;
     4310      // eliminate segments of GG where N is contained in the basis
     4311      list nGP;
     4312      def GP=GG;
     4313      ideal BP;
     4314      for(j=1;j<=size(GP);j++)
     4315      {
     4316        te=1; k=1;
     4317        BP=GP[j][2];
     4318        while((te==1) and (k<=size(N)))
     4319        {
     4320          if(pdivi(N[k],BP)[1]!=0){te=0;}
     4321          k++;
     4322        }
     4323        if(te==0){nGP[size(nGP)+1]=GP[j];}
     4324      }
     4325      //"T_nGP="; nGP;
     4326      // Now eliminate components for which the basis has dim>0, and all elements non reducing to 0
     4327      // modulo N do not contain the mover coordinates
     4328      list nnGP; poly r;
     4329      for(j=1; j<=size(nGP);j++)
     4330      {
     4331        if(not(indepparameters(nGP[j][2])))
     4332        {
     4333          if(dim(std(nGP[j][1]))==0){nnGP[size(nnGP)+1]=nGP[j];}
     4334          else
     4335          {
     4336            te=1; k=1;
     4337            while(te and k<=size(nGP[2]))
     4338            {
     4339              r=pdivi(nGP[j][2][k],N)[1];
     4340              if(r==0){k++;}
     4341              else
     4342              {
     4343                if(not(subset(variables(nGP[j][2][k]),vmov )))
     4344                {
     4345                  te=0;
     4346                }
     4347                else{k++;}
     4348              }
     4349            }
     4350            if(te==1){nnGP[size(nnGP)+1]=nGP[j];}
     4351          }
     4352        }
     4353      }
     4354      G=nnGP;
     4355    }
     4356    kill @RP; kill @P; kill @R;
     4357    return(locus(G));
     4358  }
     4359}
     4360example
     4361{"EXAMPLE:"; echo = 2;
     4362  ring R=(0,a,b),(x4,x3,x2,x1),dp;
     4363  ideal S=(x1-3)^2+(x2-1)^2-9,
     4364             (4-x2)*(x3-3)+(x1-3)*(x4-1),
     4365             (3-x1)*(x3-x1)+(4-x2)*(x4-x2),
     4366             (4-x4)*a+(x3-3)*b+3*x4-4*x3,
     4367             (a-x1)^2+(b-x2)^2-(x1-x3)^2-(x2-x4)^2;
     4368  short=0;
     4369  locusdg(grobcov(S));
     4370}
     4371
    43084372
    43094373//********************* End locus ****************************
Note: See TracChangeset for help on using the changeset viewer.