Changeset 43d23c in git for Singular/LIB/tropical.lib
- Timestamp:
- Aug 15, 2019, 1:45:11 PM (5 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 40b65a33b8f97714b624e53cd7ece1518afa831b
- Parents:
- 6481efa31c6cdd77d94b8f54fe37cf6832effd6b3370016501d46485e4e45a46cb16fcdfc088fdd9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/tropical.lib
r6481ef r43d23c 338 338 // we change to a ring where the variables have names t and x(1),...,x(n) 339 339 def ALTERRING=basering; 340 list RL=ringlist(ALTERRING); 340 341 if (nvars(basering)==2) 341 342 { 342 execute("ring BASERING=("+charstr(ALTERRING)+"),(t,x(1)),("+ordstr(ALTERRING)+");"); 343 RL[2]=list("t","x(1)"); 344 ring BASERING = ring(RL); 343 345 } 344 346 else 345 347 { 346 execute("ring BASERING=("+charstr(ALTERRING)+"),(t,x(1.."+string(nvars(ALTERRING)-1)+")),("+ordstr(ALTERRING)+");"); 348 list V = "t"; 349 for (int ii = nvars(ALTERRING)-1; ii > 0; ii--) 350 { 351 V[ii+1] = "x("+string(ii)+")"; 352 } 353 RL[2]=V; 354 ring BASERING = ring(RL); 347 355 } 348 356 map altphi=ALTERRING,maxideal(1); … … 466 474 // for this, unfortunately, t has to be the last variable !!! 467 475 ideal variablen; 476 list RL=ringlist(basering); 468 477 for (j=2;j<=nvars(basering);j++) 469 478 { 470 479 variablen=variablen+var(j); 471 } 472 execute("ring GRUNDRING=("+charstr(basering)+"),("+string(variablen)+",t),(dp("+string(nvars(basering)-1)+"),lp(1));"); 480 RL[2][j-1]=RL[2][j]; 481 } 482 RL[2][size(RL[2])]="t"; 483 RL[3]=list(list("dp",1:(nvars(basering)-1)),list("lp",1)); 484 ring GRUNDRING = ring(RL); 485 list RL=ringlist(GRUNDRING); 486 list VARIABLEN; 473 487 ideal variablen; 474 488 for (j=1;j<=nvars(basering)-1;j++) 475 489 { 476 490 variablen=variablen+var(j); 491 VARIABLEN[j]=RL[2][j]; 477 492 } 478 493 map GRUNDPHI=BASERING,t,variablen; … … 497 512 if (iszerodim==0) // do so only if is_dim_zero is not set 498 513 { 499 execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;"); 514 RL=ringlist(basering); 515 RL[1]=list(RL[1],list("t"),list(list("lp",1)),ideal(0)); 516 RL[2]=VARIABLEN; 517 RL[3]=list(list("dp",1:size(VARIABLEN))); 518 ring QUOTRING = ring(RL); 500 519 ideal i=groebner(imap(GRUNDRING,i)); 501 520 int dd=dim(i); … … 573 592 // from LIFTRING are present, 574 593 // and where also the variables of CUTDOWNRING live 575 execute("ring REPLACEMENTRING=("+charstr(LIFTRING)+"),("+varstr(CUTDOWNRING)+"),dp;"); 594 list RL=ringlist(LIFTRING); 595 list RL2=ringlist(CUTDOWNRING); 596 RL[2]=RL2[2]; 597 RL[3]=list(list("dp",1:nvars(CUTDOWNRING))); 598 ring REPLACEMENTRING = ring(RL); 576 599 list repl=imap(CUTDOWNRING,repl); // get the replacement rules 577 600 // from CUTDOWNRING … … 1069 1092 poly mp=minpoly; 1070 1093 def OLDRING=basering; 1071 execute("ring NEWRING=0,("+varstr(basering)+","+parstr(basering)+"),ds;"); 1094 list RL=ringlist(OLDRING); 1095 RL[2]=RL[2]+RL[1][2]; 1096 RL[1]=RL[1][1]; 1097 RL[3]=list(list("ds",1:size(RL[2]))); 1098 ring NEWRING=ring(RL); 1072 1099 ideal I=imap(OLDRING,mp),imap(OLDRING,f); 1073 1100 } … … 1717 1744 { 1718 1745 string polynomstring=string(f); 1719 execute("ring drawring=(0,"+parstr(basering)+"),("+varstr(basering)+"),dp;"); 1746 list RL=ringlist(basering); 1747 RL[1][1]=0; 1748 RL[3]=list(list("dp",1:nvars(basering))); 1749 ring drawring = ring(RL); 1720 1750 execute("poly f="+polynomstring+";"); 1721 1751 } … … 2637 2667 // THIS IS NOT DOCUMENTED FOR THE GENERAL USER!!!! 2638 2668 def BASERING=basering; 2669 list RL=ringlist(BASERING); 2670 list VARIABLEN; 2639 2671 int j; 2640 2672 if (size(#)>0) … … 2642 2674 // we first have to move the variable t to the front again 2643 2675 ideal variablen=var(nvars(basering)); 2676 VARIABLEN[1]=RL[2][nvars(basering)]; 2644 2677 for (j=1;j<nvars(basering);j++) 2645 2678 { 2646 2679 variablen=variablen+var(j); 2680 VARIABLEN[j+1]=RL[2][j]; 2647 2681 } 2648 2682 } … … 2650 2684 { 2651 2685 ideal variablen=maxideal(1); 2686 VARIABLEN=RL[2]; 2652 2687 } 2653 2688 // we want to homogenise the ideal i .... 2654 execute("ring HOMOGRING=("+charstr(basering)+"),(@s,"+string(variablen)+"),dp;"); 2689 RL=ringlist(basering); 2690 RL[2]=list("@s")+RL[2]; 2691 RL[3]=list(list("dp",1:size(RL[2]))); 2692 ring HOMOGRING = ring(RL); 2655 2693 ideal i=homog(std(imap(BASERING,i)),@s); 2656 2694 // ... and compute a standard basis with … … 2667 2705 } 2668 2706 intmat O=weightVectorToOrderMatrix(whomog); 2669 execute("ring WEIGHTRING=("+charstr(basering)+"),("+varstr(basering)+"),(M("+string(O)+"));"); 2707 list RL=ringlist(basering); 2708 RL[3]=list(list("M",O)); 2709 ring WEIGHTRING = ring(RL); 2670 2710 // map i to the new ring and compute a GB of i, then dehomogenise i, 2671 2711 // so that we can be sure, that the … … 2674 2714 // compute the w-initial ideal with the help of the procedure tInitialForm; 2675 2715 setring BASERING; 2676 execute("ring COMPINIRING=("+charstr(basering)+"),("+string(variablen)+"),dp;"); 2716 RL[2]=VARIABLEN; 2717 RL[3]=list(list("dp",1:size(VARIABLEN))); 2718 ring COMPINIRING = ring(RL); 2677 2719 ideal i=imap(WEIGHTRING,i); 2678 2720 ideal ini; … … 2711 2753 def BASERING=basering; 2712 2754 intmat O=weightVectorToOrderMatrix(w); 2713 execute("ring INITIALRING=("+charstr(BASERING)+"),("+varstr(basering)+"),M("+string(O)+");"); 2755 list RL=ringlist(basering); 2756 RL[3]=list(list("M",O)); 2757 ring INITIALRING = ring(RL); 2714 2758 poly f=imap(BASERING,f); 2715 2759 int GRAD=deg(f); … … 2784 2828 def BASERING=basering; 2785 2829 intmat O=weightVectorToOrderMatrix(w); 2786 execute("ring INITIALRING=("+charstr(BASERING)+"),("+varstr(basering)+"),M("+string(O)+");"); 2830 list RL=ringlist(BASERING); 2831 RL[3]=list(list("M",O)); 2832 ring INITIALRING = ring(RL); 2787 2833 ideal i=imap(BASERING,i); 2788 2834 i=std(i); … … 2834 2880 } 2835 2881 def BASERING=basering; 2836 execute("ring PARAMETERRING=("+string(char(basering))+"),("+parstr(basering)+"),ds;");2882 ring PARAMETERRING = create_ring("("+string(char(basering))+")", "("+parstr(basering)+")", "ds"); 2837 2883 poly den=imap(BASERING,den); 2838 2884 poly num=imap(BASERING,num); … … 3493 3539 { 3494 3540 def BASERING=basering; 3495 execute("ring RADRING=("+charstr(basering)+"),(@T,"+varstr(basering)+"),(dp(1),"+ordstr(basering)+");"); 3541 list RL=ringlist(BASERING); 3542 RL[2]=list("@T")+RL[2]; 3543 RL[3]=list(list("dp",1:1))+RL[3]; 3544 ring RADRING = ring(RL); 3496 3545 ideal I=ideal(imap(BASERING,i))+ideal(1-@T*imap(BASERING,f)); 3497 3546 if (reduce(1,std(I))==0) … … 3644 3693 CHARAKTERISTIK=CHARAKTERISTIK[1..size(CHARAKTERISTIK)-2]; 3645 3694 def BASERING=basering; 3646 execute("ring INITIALRING=("+CHARAKTERISTIK+"),("+varstr(basering)+"),("+ordstr(basering)+");");3695 ring INITIALRING = create_ring("("+CHARAKTERISTIK+")", "("+varstr(basering)+")", "("+ordstr(basering)+")"); 3647 3696 list l=solve(imap(BASERING,i)); 3648 3697 l; … … 3952 4001 } 3953 4002 def BASERING=basering; 3954 execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;");4003 ring QUOTRING = create_ring("("+charstr(basering)+",t)", "("+string(variablen)+")", "dp"); 3955 4004 ideal i=subst(imap(BASERING,i),var(j-1),t^(-wj)*var(j-1)); 3956 4005 for (k=1;k<=size(i);k++) … … 4007 4056 list erglini; 4008 4057 list ergl; 4058 list VARIABLEN; 4059 list RL=ringlist(BASERING); 4009 4060 for (j1=1;j1<=nvars(basering)-1;j1++) 4010 4061 { … … 4013 4064 product=product*var(j1); // make product of all variables 4014 4065 // (needed for the initial-monomial-check later 4015 } 4016 execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;"); 4066 VARIABLEN[j1]=RL[2][j1]; 4067 } 4068 RL[1]=list(RL[1],list("t"),list(list("lp",1:1)),ideal(0)); 4069 RL[2]=VARIABLEN; 4070 RL[3]=list(list("dp",1:size(VARIABLEN))); 4071 ring QUOTRING = ring(RL); 4017 4072 setring BASERING; 4018 4073 // change to quotring where we want to compute the primary decomposition of i … … 4201 4256 variablen=0; 4202 4257 j2=0; 4258 VARIABLEN=list(); 4203 4259 for(j1=1;j1<=nvars(basering)-1;j1++) 4204 4260 { … … 4214 4270 variablen=variablen+var(j1); // read the set of remaining variables 4215 4271 // (needed to make quotring later) 4272 VARIABLEN=VARIABLEN+list(RL[2][j1]); 4216 4273 } 4217 4274 } 4218 4275 // return pideal, the initial and the list ergl which tells us 4219 4276 // which variables we replaced by which form 4220 execute("ring BASERINGLESS1=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));"); 4277 RL=ringlist(BASERING); 4278 RL[2]=VARIABLEN+list("t"); 4279 RL[3]=list(list("dp",1:size(VARIABLEN)),list("lp",1:1)); 4280 ring BASERINGLESS1 = ring(RL); 4221 4281 ideal i=imap(BASERING,pideal); 4222 4282 ideal ini=imap(BASERING,pini); //ideal ini2=tInitialIdeal(i,wvecp,1); … … 4295 4355 } 4296 4356 setring BASERING; 4297 execute("ring BASERINGLESS2=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));");4357 ring BASERINGLESS2 = create_ring(ringlist(BASERING)[1], "("+string(variablen)+",t)", "(dp("+string(ncols(variablen))+"),lp(1))", "no_minpoly"); 4298 4358 // using the 0/1-vector which tells us which variables belong 4299 4359 // to the set of smallest entries of wvec … … 4643 4703 if ((numberdeletedvariables>0) and (anzahlvariablen>1)) // if only t remains, 4644 4704 { // all true variables are gone 4645 execute("ring NEURING=("+charstr(basering)+"),("+string(variablen)+"),(dp("+string(size(variablen)-1)+"),lp(1));");4705 ring NEURING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "(dp("+string(size(variablen)-1)+"),lp(1))", "no_minpoly"); 4646 4706 ideal i=imap(BASERING,i); 4647 4707 ideal gesamt_m=imap(BASERING,gesamt_m); … … 4659 4719 { 4660 4720 // pass to a ring which has variables which are suitable for gfan 4661 execute("ring GFANRING=("+charstr(basering)+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;");4721 ring GFANRING = create_ring(ringlist(basering)[1], "(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)", "dp", "no_minpoly"); 4662 4722 ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 4663 4723 phiideal[nvars(PREGFANRING)]=a; // map t to a … … 4829 4889 else 4830 4890 { 4831 execute("ring PARARing=("+charstr(basering)+"),t,ls;");4891 ring PARARing = create_ring(ringlist(basering)[1], "t", "ls", "no_minpoly"); 4832 4892 } 4833 4893 ideal PARA; // will contain the parametrisation … … 4917 4977 variablen=variablen+var(j); 4918 4978 } 4919 execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");4979 ring INITIALRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly"); 4920 4980 ideal ini=imap(BASERING,ini); 4921 4981 // compute the associated primes of the initialideal … … 5160 5220 if (anzahlvariablen<nvars(basering)) 5161 5221 { 5162 execute("ring TINRING=("+charstr(basering)+","+string(Parameter)+"),("+string(variablen)+"),dp;");5222 ring TINRING = create_ring("("+charstr(basering)+","+string(Parameter)+")", "("+string(variablen)+")", "dp"); 5163 5223 } 5164 5224 else 5165 5225 { 5166 execute("ring TINRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");5226 ring TINRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly"); 5167 5227 } 5168 5228 ideal tin=imap(BASERING,tin); … … 5185 5245 string PMet=string(par(1)); 5186 5246 def BASERING=basering; 5187 execute("ring r=0,"+PMet+",ls;");5247 ring r = create_ring(0, PMet, "ls"); 5188 5248 execute("poly denomi="+denom+";"); 5189 5249 execute("poly numer="+num+";"); … … 5543 5603 if (size(#)>0) // noAbs was used 5544 5604 { 5545 execute("ring NOQRing=("+string(char(LIFTRing))+"),("+varstr(basering)+","+parstr(LIFTRing)+"),dp;");5605 ring NOQRing = create_ring("("+string(char(LIFTRing))+")", "("+varstr(basering)+","+parstr(LIFTRing)+")", "dp"); 5546 5606 execute("qring TESTRing=std("+#[1]+");"); 5547 5607 ideal i=imap(BASERING,i); … … 5551 5611 setring LIFTRing; 5552 5612 poly mp=minpoly; 5553 execute("ring TESTRing=("+charstr(LIFTRing)+"),("+varstr(BASERING)+"),dp;");5613 ring TESTRing = create_ring(ringlist(LIFTRing)[1], "("+varstr(BASERING)+")", "dp", "no_minpoly"); 5554 5614 minpoly=number(imap(LIFTRing,mp)); 5555 5615 ideal i=imap(BASERING,i); … … 5718 5778 { 5719 5779 // pass to a ring which has variables which are suitable for gfan 5720 execute("ring GFANRING=("+string(char(basering))+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;");5780 ring GFANRING = create_ring(string(char(basering)), "(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z)", "dp"); 5721 5781 ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 5722 5782 phiideal[nvars(PREGFANRING)]=a; // map t to a … … 5934 5994 if (anzahlvariablen<nvars(basering)) 5935 5995 { 5936 execute("ring PARARing=("+string(char(basering))+",@a),t,ls;");5996 ring PARARing = create_ring("("+string(char(basering))+",@a)", "t", "ls"); 5937 5997 minpoly=number(imap(PREGFANRING,m)); 5938 5998 } 5939 5999 else 5940 6000 { 5941 execute("ring PARARing=("+charstr(basering)+"),t,ls;");6001 ring PARARing = create_ring(ringlist(basering)[1], "t", "ls", "no_minpoly"); 5942 6002 } 5943 6003 ideal PARA; // will contain the parametrisation … … 6200 6260 else 6201 6261 { 6202 execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");");6262 ring SATURATERING = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "("+ordstr(basering)+")", "no_minpoly"); 6203 6263 ideal i=imap(BASERING,i); 6204 6264 export(i); … … 6308 6368 def BASERING=basering; 6309 6369 string tvar=string(var(nvars(basering))); 6370 list RL_BASERING=ringlist(BASERING); 6371 list TVAR=RL_BASERING[2]; 6310 6372 int j,k,l; // indices 6311 6373 // store the weighted degrees of the elements of i in an integer vector … … 6334 6396 // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING 6335 6397 ideal variablen; 6398 list VARIABLEN; 6399 list RL=ringlist(basering); 6336 6400 for (j=1;j<=nvars(basering)-1;j++) 6337 6401 { 6338 6402 variablen=variablen+var(j); 6403 VARIABLEN[j]=RL[2][j]; 6339 6404 } 6340 6405 // move to a polynomial ring with global monomial ordering 6341 6406 // - the variable t is superflous, 6342 6407 // the variable @a is not if it was already present 6343 execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;"); 6408 RL[2]=VARIABLEN; 6409 RL[3]=list(list("dp",1:size(VARIABLEN))); 6410 ring INITIALRING = ring(RL); 6344 6411 ideal ini=imap(BASERING,ini); 6345 6412 // compute the minimal associated primes of the … … 6357 6424 } 6358 6425 list extensionringlist; // contains the rings which are to be returned 6426 list RL; 6359 6427 for (j=1;j<=size(maximalideals);j++) 6360 6428 { … … 6363 6431 // if some of the maximal ideals needs a field extension, 6364 6432 // then everything will live in this ring 6433 RL=ringlist(BASERING); 6365 6434 if ((maximalideals[j][1]!=0) and (nvars(BASERING)==anzahlvariablen)) 6366 6435 { 6367 6436 // define the extension ring which contains 6368 6437 // the new variable @a, if it is not yet present 6369 execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+string(imap(BASERING,variablen))+",@a,"+tvar+"),(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1));"); 6438 RL[2]=VARIABLEN+list("@a")+TVAR; 6439 RL[3]=list(list("dp",1:(anzahlvariablen-1)),list("dp",1:1),list("lp",1:1)); 6440 ring EXTENSIONRING = ring(RL); 6370 6441 // phi maps x_i to x_i, @a to @a (if present in the ring), 6371 6442 // and the additional variable … … 6378 6449 else // @a was already present in the BASERING or no 6379 6450 { // field extension is necessary 6380 execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+varstr(BASERING)+"),("+ordstr(BASERING)+");");6451 ring EXTENSIONRING = ring(RL); 6381 6452 // phi maps x_i to x_i, @a to @a (if present in the ring), 6382 6453 // and the additional variable … … 7255 7326 { 7256 7327 def BASERING=basering; 7257 execute("ring INTERRING=0,("+varstr(basering)+"),("+ordstr(basering)+");");7328 ring INTERRING = create_ring(0, "("+varstr(basering)+")", "("+ordstr(basering)+")"); 7258 7329 poly n=imap(BASERING,n); 7259 execute("ring REALRING=(real,50,100),("+varstr(basering)+"),("+ordstr(basering)+");");7330 ring REALRING = create_ring("(real,50,100)", "("+varstr(basering)+")", "("+ordstr(basering)+")"); 7260 7331 map phi=INTERRING,maxideal(1); 7261 7332 string s=string(phi(n)); … … 7873 7944 { 7874 7945 def BASERING=basering; 7875 execute("ring TRING="+string(char(BASERING))+",t,ds;");7946 ring TRING = create_ring(string(char(BASERING)), "t", "ds"); 7876 7947 poly hn=imap(BASERING,hn); 7877 7948 poly c4=imap(BASERING,c4);
Note: See TracChangeset
for help on using the changeset viewer.