Changeset 337001 in git
- Timestamp:
- Aug 15, 2019, 1:43:56 PM (4 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 43d23c46c518748a9f4fa43d4d8d51ff7fe69354
- Parents:
- 5718c92447c4b2fbefa062bd04f7931fa74f74f8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/tropical.lib
r5718c9 r337001 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 ring BASERING = create_ring(ringlist(ALTERRING)[1], "(t,x(1))", "("+ordstr(ALTERRING)+")", "no_minpoly"); 343 RL[2]=list("t","x(1)"); 344 ring BASERING = ring(RL); 343 345 } 344 346 else … … 349 351 V[ii+1] = "x("+string(ii)+")"; 350 352 } 351 ring BASERING = create_ring(ringlist(ALTERRING)[1], V, "("+ordstr(ALTERRING)+")", "no_minpoly"); 353 RL[2]=V; 354 ring BASERING = ring(RL); 352 355 } 353 356 map altphi=ALTERRING,maxideal(1); … … 471 474 // for this, unfortunately, t has to be the last variable !!! 472 475 ideal variablen; 476 list RL=ringlist(basering); 473 477 for (j=2;j<=nvars(basering);j++) 474 478 { 475 479 variablen=variablen+var(j); 476 } 477 ring GRUNDRING = create_ring(ringlist(basering)[1], "("+string(variablen)+",t)", "(dp("+string(nvars(basering)-1)+"),lp(1))", "no_minpoly"); 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; 478 487 ideal variablen; 479 488 for (j=1;j<=nvars(basering)-1;j++) 480 489 { 481 490 variablen=variablen+var(j); 491 VARIABLEN[j]=RL[2][j]; 482 492 } 483 493 map GRUNDPHI=BASERING,t,variablen; … … 502 512 if (iszerodim==0) // do so only if is_dim_zero is not set 503 513 { 504 ring QUOTRING = create_ring("("+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); 505 519 ideal i=groebner(imap(GRUNDRING,i)); 506 520 int dd=dim(i); … … 578 592 // from LIFTRING are present, 579 593 // and where also the variables of CUTDOWNRING live 580 ring REPLACEMENTRING = create_ring(ringlist(LIFTRING)[1], "("+varstr(CUTDOWNRING)+")", "dp", "no_minpoly"); 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); 581 599 list repl=imap(CUTDOWNRING,repl); // get the replacement rules 582 600 // from CUTDOWNRING … … 1074 1092 poly mp=minpoly; 1075 1093 def OLDRING=basering; 1076 ring NEWRING = create_ring(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); 1077 1099 ideal I=imap(OLDRING,mp),imap(OLDRING,f); 1078 1100 } … … 1722 1744 { 1723 1745 string polynomstring=string(f); 1724 ring drawring = create_ring("(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); 1725 1750 execute("poly f="+polynomstring+";"); 1726 1751 } … … 2642 2667 // THIS IS NOT DOCUMENTED FOR THE GENERAL USER!!!! 2643 2668 def BASERING=basering; 2669 list RL=ringlist(BASERING); 2670 list VARIABLEN; 2644 2671 int j; 2645 2672 if (size(#)>0) … … 2647 2674 // we first have to move the variable t to the front again 2648 2675 ideal variablen=var(nvars(basering)); 2676 VARIABLEN[1]=RL[2][nvars(basering)]; 2649 2677 for (j=1;j<nvars(basering);j++) 2650 2678 { 2651 2679 variablen=variablen+var(j); 2680 VARIABLEN[j+1]=RL[2][j]; 2652 2681 } 2653 2682 } … … 2655 2684 { 2656 2685 ideal variablen=maxideal(1); 2686 VARIABLEN=RL[2]; 2657 2687 } 2658 2688 // we want to homogenise the ideal i .... 2659 ring HOMOGRING = create_ring(ringlist(basering)[1], "(@s,"+string(variablen)+")", "dp", "no_minpoly"); 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); 2660 2693 ideal i=homog(std(imap(BASERING,i)),@s); 2661 2694 // ... and compute a standard basis with … … 2672 2705 } 2673 2706 intmat O=weightVectorToOrderMatrix(whomog); 2674 ring WEIGHTRING = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "(M("+string(O)+"))", "no_minpoly"); 2707 list RL=ringlist(basering); 2708 RL[3]=list(list("M",O)); 2709 ring WEIGHTRING = ring(RL); 2675 2710 // map i to the new ring and compute a GB of i, then dehomogenise i, 2676 2711 // so that we can be sure, that the … … 2679 2714 // compute the w-initial ideal with the help of the procedure tInitialForm; 2680 2715 setring BASERING; 2681 ring COMPINIRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly"); 2716 RL[2]=VARIABLEN; 2717 RL[3]=list(list("dp",1:size(VARIABLEN))); 2718 ring COMPINIRING = ring(RL); 2682 2719 ideal i=imap(WEIGHTRING,i); 2683 2720 ideal ini; … … 2716 2753 def BASERING=basering; 2717 2754 intmat O=weightVectorToOrderMatrix(w); 2718 ring INITIALRING = create_ring(ringlist(BASERING)[1], "("+varstr(basering)+")", "M("+string(O)+")", "no_minpoly"); 2755 list RL=ringlist(basering); 2756 RL[3]=list(list("M",O)); 2757 ring INITIALRING = ring(RL); 2719 2758 poly f=imap(BASERING,f); 2720 2759 int GRAD=deg(f); … … 2789 2828 def BASERING=basering; 2790 2829 intmat O=weightVectorToOrderMatrix(w); 2791 ring INITIALRING = create_ring(ringlist(BASERING)[1], "("+varstr(basering)+")", "M("+string(O)+")", "no_minpoly"); 2830 list RL=ringlist(BASERING); 2831 RL[3]=list(list("M",O)); 2832 ring INITIALRING = ring(RL); 2792 2833 ideal i=imap(BASERING,i); 2793 2834 i=std(i); … … 3498 3539 { 3499 3540 def BASERING=basering; 3500 ring RADRING = create_ring(ringlist(basering)[1], "(@T,"+varstr(basering)+")", "(dp(1),"+ordstr(basering)+")", "no_minpoly"); 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); 3501 3545 ideal I=ideal(imap(BASERING,i))+ideal(1-@T*imap(BASERING,f)); 3502 3546 if (reduce(1,std(I))==0) … … 4012 4056 list erglini; 4013 4057 list ergl; 4058 list VARIABLEN; 4059 list RL=ringlist(BASERING); 4014 4060 for (j1=1;j1<=nvars(basering)-1;j1++) 4015 4061 { … … 4018 4064 product=product*var(j1); // make product of all variables 4019 4065 // (needed for the initial-monomial-check later 4020 } 4021 ring QUOTRING = create_ring("("+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); 4022 4072 setring BASERING; 4023 4073 // change to quotring where we want to compute the primary decomposition of i … … 4206 4256 variablen=0; 4207 4257 j2=0; 4258 VARIABLEN=list(); 4208 4259 for(j1=1;j1<=nvars(basering)-1;j1++) 4209 4260 { … … 4219 4270 variablen=variablen+var(j1); // read the set of remaining variables 4220 4271 // (needed to make quotring later) 4272 VARIABLEN=VARIABLEN+list(RL[2][j1]); 4221 4273 } 4222 4274 } 4223 4275 // return pideal, the initial and the list ergl which tells us 4224 4276 // which variables we replaced by which form 4225 ring BASERINGLESS1 = create_ring(ringlist(BASERING)[1], "("+string(variablen)+",t)", "(dp("+string(ncols(variablen))+"),lp(1))", "no_minpoly"); 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); 4226 4281 ideal i=imap(BASERING,pideal); 4227 4282 ideal ini=imap(BASERING,pini); //ideal ini2=tInitialIdeal(i,wvecp,1); … … 6313 6368 def BASERING=basering; 6314 6369 string tvar=string(var(nvars(basering))); 6370 list RL_BASERING=ringlist(BASERING); 6371 list TVAR=RL_BASERING[2]; 6315 6372 int j,k,l; // indices 6316 6373 // store the weighted degrees of the elements of i in an integer vector … … 6339 6396 // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING 6340 6397 ideal variablen; 6398 list VARIABLEN; 6399 list RL=ringlist(basering); 6341 6400 for (j=1;j<=nvars(basering)-1;j++) 6342 6401 { 6343 6402 variablen=variablen+var(j); 6403 VARIABLEN[j]=RL[2][j]; 6344 6404 } 6345 6405 // move to a polynomial ring with global monomial ordering 6346 6406 // - the variable t is superflous, 6347 6407 // the variable @a is not if it was already present 6348 ring INITIALRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly"); 6408 RL[2]=VARIABLEN; 6409 RL[3]=list(list("dp",1:size(VARIABLEN))); 6410 ring INITIALRING = ring(RL); 6349 6411 ideal ini=imap(BASERING,ini); 6350 6412 // compute the minimal associated primes of the … … 6362 6424 } 6363 6425 list extensionringlist; // contains the rings which are to be returned 6426 list RL; 6364 6427 for (j=1;j<=size(maximalideals);j++) 6365 6428 { … … 6368 6431 // if some of the maximal ideals needs a field extension, 6369 6432 // then everything will live in this ring 6433 RL=ringlist(BASERING); 6370 6434 if ((maximalideals[j][1]!=0) and (nvars(BASERING)==anzahlvariablen)) 6371 6435 { 6372 6436 // define the extension ring which contains 6373 6437 // the new variable @a, if it is not yet present 6374 ring EXTENSIONRING = create_ring(ringlist(BASERING)[1], "("+string(imap(BASERING,variablen))+",@a,"+tvar+")", "(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1))", "no_minpoly"); 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); 6375 6441 // phi maps x_i to x_i, @a to @a (if present in the ring), 6376 6442 // and the additional variable … … 6383 6449 else // @a was already present in the BASERING or no 6384 6450 { // field extension is necessary 6385 ring EXTENSIONRING = create_ring(ringlist(BASERING)[1], "("+varstr(BASERING)+")", "("+ordstr(BASERING)+")", "no_minpoly");6451 ring EXTENSIONRING = ring(RL); 6386 6452 // phi maps x_i to x_i, @a to @a (if present in the ring), 6387 6453 // and the additional variable
Note: See TracChangeset
for help on using the changeset viewer.