Changeset 7d56875 in git
- Timestamp:
- Oct 9, 2008, 11:31:58 AM (15 years ago)
- Branches:
- (u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
- Children:
- 7f1f2a45aaa4363f5fb9be8996b78121813f7ef5
- Parents:
- fba86f89b3458187b40c5f0d5f6408412d98d295
- Location:
- Singular/LIB
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/atkins.lib
rfba86f8 r7d56875 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: atkins.lib,v 1. 4 2007-07-20 11:26:46Singular Exp $";2 version="$Id: atkins.lib,v 1.5 2008-10-09 09:31:57 Singular Exp $"; 3 3 category="Teaching"; 4 4 info=" … … 776 776 K is input for the procedure "HilbertClassPolynomial", 777 777 B describes the number of recursions being calculated 778 - The basis of the thealgorithm is the following theorem:778 - The basis of the algorithm is the following theorem: 779 779 Let N be an integer coprime to 6 and different from 1 and E be an 780 780 ellipic curve modulo N. Assume that we know an integer m and a -
Singular/LIB/crypto.lib
rfba86f8 r7d56875 1 1 //GP, last modified 28.6.06 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: crypto.lib,v 1. 5 2008-08-07 16:00:50Singular Exp $";3 version="$Id: crypto.lib,v 1.6 2008-10-09 09:31:57 Singular Exp $"; 4 4 category="Teaching"; 5 5 info=" … … 1906 1906 m,q integers 1907 1907 ASSUME: gcd(N,6)=1 1908 NOTE: The basis of the thealgorithm is the following theorem:1908 NOTE: The basis of the algorithm is the following theorem: 1909 1909 Given C, an elliptic curve over Z/N, P a point of C(Z/N), 1910 1910 m an integer, q a prime with the following properties: -
Singular/LIB/dmodapp.lib
rfba86f8 r7d56875 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: dmodapp.lib,v 1. 9 2008-10-06 17:04:26Singular Exp $";2 version="$Id: dmodapp.lib,v 1.10 2008-10-09 09:31:57 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 75 75 @* graded ring while the Groebner basis is a subset of D. 76 76 @* If s<>0, @code{std} is used for Groebner basis computations, otherwise, 77 @* and by default, @code{slimgb} is used. 77 @* and by default, @code{slimgb} is used. 78 78 @* If t<>0, a matrix ordering is used for Groebner basis computations, 79 79 @* otherwise, and by default, a block ordering is used. … … 124 124 NOTE: Activate the output ring with the @code{setring} command. 125 125 @* Varnames of the basering should not include t and Dt. 126 @* In the ouput ring, inF is isthe initial Malgrange ideal.126 @* In the ouput ring, inF is the initial Malgrange ideal. 127 127 @* If s<>0, @code{std} is used for Groebner basis computations, otherwise, 128 @* and by default, @code{slimgb} is used. 128 @* and by default, @code{slimgb} is used. 129 129 @* If t<>0, a matrix ordering is used for Groebner basis computations, 130 130 @* otherwise, and by default, a block ordering is used. … … 136 136 EXAMPLE: example initialmalgrange; shows examples 137 137 " 138 { 138 { 139 139 int ppl = printlevel - voice +2; 140 140 def save = basering; … … 161 161 { 162 162 reversevars = int(#[3]); 163 163 } 164 164 if (size(#)>3) 165 165 { … … 167 167 { 168 168 u0 = #[4]; 169 170 169 } 170 } 171 171 } 172 172 } … … 272 272 if (calledfrom == "initialideal") 273 273 { 274 274 ring Dh = 0,(x(1..n),D(1..n),h),(a(@a),dp(noofvars-1),lp(1)); 275 275 } 276 276 else // bfctonestep 277 277 { 278 278 ring Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),a(uv),dp(noofvars-1),lp(1)); 279 279 } 280 280 } … … 299 299 if (calledfrom == "initialideal") 300 300 { 301 301 ring Dh = 0,(x(1..n),D(1..n),h),(a(@a),M(@Ord)); 302 302 } 303 303 else // bfctonestep 304 304 { 305 305 ring Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),M(@Ord)); 306 306 } 307 307 } … … 323 323 for (i=1; i<=n; i++) 324 324 { 325 325 @relD[i,n+i] = h^2; 326 326 } 327 327 } … … 333 333 for (i=1; i<=n; i++) 334 334 { 335 335 @relD[i+2,n+3+i] = h^2; 336 336 } 337 337 } … … 361 361 I = I,t*Dt-s; 362 362 } 363 } 363 } 364 364 dbprint(ppl, "starting Groebner basis computation with engine:", whichengine); 365 365 I = engine(I, whichengine); … … 379 379 if (varnames[i] == "t") 380 380 { 381 381 ERROR("Variable names should not include t"); 382 382 } 383 383 } … … 403 403 for (i=1; i<=n; i++) 404 404 { 405 406 405 newvarnames[i+1] = varnames[i]; 406 newvarnames[i+n+2] = "D"+varnames[i]; 407 407 } 408 408 rl[2] = newvarnames; … … 490 490 } 491 491 } 492 J[j] = g; 492 J[j] = g; 493 493 } 494 494 if (typeof(#[1])=="poly") … … 537 537 list LL = ringlist(save); 538 538 list L; 539 int i; 539 int i; 540 540 for(i=1;i<=4;i++) 541 541 { … … 562 562 matrix @D = ncr[2]; 563 563 def @U = ring(L); 564 // 2. create the commutative ring 564 // 2. create the commutative ring 565 565 setring save; 566 566 list CL; … … 606 606 // TODO 607 607 static proc charInfo(ideal I) 608 "USAGE: charInfo(I); I an ideal 608 "USAGE: charInfo(I); I an ideal 609 609 RETURN: ring 610 610 STATUS: experimental, todo … … 740 740 proc isFsat(ideal I, poly F) 741 741 "USAGE: isFsat(I, F); I an ideal, F a poly 742 RETURN: int 742 RETURN: int 743 743 PURPOSE: check whether the ideal I is F-saturated 744 744 NOTE: 1 is returned if I is F-saturated, otherwise 0 is returned … … 815 815 def R = Weyl(); setring R; 816 816 poly F = x2-y3; 817 ideal I = (y^3 - x^2)*Dx - 2*x, (y^3 - x^2)*Dy + 3*y^2; // I = Dx*F, Dy*F; 817 ideal I = (y^3 - x^2)*Dx - 2*x, (y^3 - x^2)*Dy + 3*y^2; // I = Dx*F, Dy*F; 818 818 DLoc(I, x2-y3); 819 LD0; 819 LD0; 820 820 BS; 821 821 } … … 871 871 ideal bbs; int srat=0; int HasRatRoots = 0; 872 872 int sP; 873 for (i=1; i<= size(bs); i++) 873 for (i=1; i<= size(bs); i++) 874 874 { 875 875 if (deg(bs[i]) == 1) … … 920 920 // no roots! 921 921 dbprint(ppl,"// -2-4- no integer root, setting s0 = -1"); 922 sP = -1; 922 sP = -1; 923 923 // HasRatRoots = 0; // older stuff, here we do substitution 924 924 HasRatRoots = 1; … … 1017 1017 kill @R3; 1018 1018 setring @R4; 1019 ideal bs = imap(@R2,bs); // only rationals are the entries 1019 ideal bs = imap(@R2,bs); // only rationals are the entries 1020 1020 list BS; BS[1] = bs; BS[2] = m; 1021 1021 export BS; … … 1026 1026 ideal LD0 = K4; 1027 1027 export LD0; 1028 return(@R4); 1028 return(@R4); 1029 1029 } 1030 1030 else 1031 { 1031 { 1032 1032 /* SHOULD NEVER GET THERE */ 1033 1033 /* no rational/integer roots */ … … 1039 1039 export BS; 1040 1040 return(@R2); 1041 } 1041 } 1042 1042 } 1043 1043 example; … … 1047 1047 def R = Weyl(); setring R; 1048 1048 poly F = x2-y3; 1049 ideal I = (y^3 - x^2)*Dx - 2*x, (y^3 - x^2)*Dy + 3*y^2; // I = Dx*F, Dy*F; 1049 ideal I = (y^3 - x^2)*Dx - 2*x, (y^3 - x^2)*Dy + 3*y^2; // I = Dx*F, Dy*F; 1050 1050 def W = SDLoc(I,F); setring W; // creates ideal LD 1051 1051 def U = DLoc0(LD, x2-y3); setring U; 1052 LD0; 1052 LD0; 1053 1053 BS; 1054 1054 } … … 1435 1435 def R = Weyl(); setring R; 1436 1436 poly F = x2-y3; 1437 ideal I = (y^3 - x^2)*Dx - 2*x, (y^3 - x^2)*Dy + 3*y^2; // I = Dx*F, Dy*F; 1437 ideal I = (y^3 - x^2)*Dx - 2*x, (y^3 - x^2)*Dy + 3*y^2; // I = Dx*F, Dy*F; 1438 1438 def W = SDLoc(I,F); 1439 1439 setring W; … … 1442 1442 setring U; 1443 1443 LD0; 1444 BS; 1444 BS; 1445 1445 // the same with DLoc: 1446 1446 setring R; -
Singular/LIB/gmssing.lib
rfba86f8 r7d56875 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: gmssing.lib,v 1.1 1 2007-01-23 15:03:30Singular Exp $";2 version="$Id: gmssing.lib,v 1.12 2008-10-09 09:31:57 Singular Exp $"; 3 3 category="Singularities"; 4 4 … … 8 8 AUTHOR: Mathias Schulze, email: mschulze@mathematik.uni-kl.de 9 9 10 OVERVIEW: A library to compute invariants related to the theGauss-Manin system10 OVERVIEW: A library to compute invariants related to the Gauss-Manin system 11 11 of an isolated hypersurface singularity 12 12 -
Singular/LIB/homolog.lib
rfba86f8 r7d56875 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: homolog.lib,v 1.2 6 2008-09-09 09:54:30Singular Exp $";2 version="$Id: homolog.lib,v 1.27 2008-10-09 09:31:57 Singular Exp $"; 3 3 category="Commutative Algebra"; 4 4 info=" … … 137 137 dbprint(p-1,"// kbase of Ext^2(M,M)", 138 138 "// - the columns present the kbase elements in Hom(F(2),F(0))", 139 "// - F(*) is a afree resolution of M ",kb2);139 "// - F(*) is a free resolution of M ",kb2); 140 140 //------- compute: cup-products of base-elements ----------------------------- 141 141 for (i=1;i<=e1;i=i+1) -
Singular/LIB/phindex.lib
rfba86f8 r7d56875 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: phindex.lib,v 1. 2 2008-08-18 10:42:27 Singular Exp $";2 version="$Id: phindex.lib,v 1.3 2008-10-09 09:31:57 Singular Exp $"; 3 3 category=" "; 4 4 info=" … … 495 495 static proc SigntL(poly M) //static procedure to compute the signature of any quadratic form. 496 496 "USAGE: SigntL(M); M is a quadratic form. 497 RETURN: The signature of ofM of type int.497 RETURN: The signature of M of type int. 498 498 ASSUME: M is a quadratic form (ply type). 499 499 " -
Singular/LIB/primdec.lib
rfba86f8 r7d56875 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: primdec.lib,v 1.1 39 2008-03-19 17:44:38Singular Exp $";2 version="$Id: primdec.lib,v 1.140 2008-10-09 09:31:57 Singular Exp $"; 3 3 category="Commutative Algebra"; 4 4 info=" … … 5606 5606 // 5607 5607 // Computes the radical of I using KL algorithm. 5608 // The only difference with the theprevious implementation of KL algorithm is5608 // The only difference with the previous implementation of KL algorithm is 5609 5609 // that now it uses block dp instead of lp ordering for the reduction to the 5610 5610 // zerodimensional case. … … 5730 5730 // 0 -> Otherwise 5731 5731 // ideal ser Only for radicalKL. (Same as in radicalKL) 5732 // list # Only for radicalKL (If #[1] = 1, 5732 // list # Only for radicalKL (If #[1] = 1, 5733 5733 // only equiradical is required. 5734 5734 // It is used to set the value of done.) -
Singular/LIB/redcgs.lib
rfba86f8 r7d56875 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: redcgs.lib,v 1. 2 2008-08-18 10:42:50Singular Exp $";2 version="$Id: redcgs.lib,v 1.3 2008-10-09 09:31:58 Singular Exp $"; 3 3 category="General purpose"; 4 4 info=" … … 6 6 PURPOSE: Comprehensive Groebner Systems. Canonical Forms. 7 7 The library contains Monte's algorithms to compute disjoint, reduced 8 Comprehensive Groebner Systems (CGS). A CGS is a set of pairs of 9 (segment,basis). The segments S_i are subsets of the parameter space, 10 and the bases B_i are sets of polynomials specializing to Groebner 8 Comprehensive Groebner Systems (CGS). A CGS is a set of pairs of 9 (segment,basis). The segments S_i are subsets of the parameter space, 10 and the bases B_i are sets of polynomials specializing to Groebner 11 11 bases of the specialized ideal for every point in S_i. 12 12 13 13 The purpose of the routines in this library is to obtain CGS with 14 14 better properties, namely disjoint segments forming a partition of 15 the parameter space and reduced bases. Reduced bases are sets of 16 polynomials that specialize to the reduced Groebner basis of the 17 specialized ideal preserving the leading power products (lpp). 15 the parameter space and reduced bases. Reduced bases are sets of 16 polynomials that specialize to the reduced Groebner basis of the 17 specialized ideal preserving the leading power products (lpp). 18 18 The lpp characterize the type of solution in each segment. 19 19 20 20 A further objective is to summarize as much as possible the segments 21 21 with the same lpp into a single segment, and if possible to obtain 22 22 a final result that is canonical, i.e. independent of the algorithm 23 23 and only attached to the given ideal. 24 25 There are three fundamental routines in the library: mrcgs, rcgs and 26 crcgs. mrcgs (Minimal Reduced CGS) is an algorithm that packs so 27 much as it is able to do (using algorithms adhoc) the segments with 28 the same lpp, obtaining the minimal number of segments. The hypothesis 29 is that the result is also canonical, but for the moment there is no 30 proof of the uniqueness of this minimal packing. Moreover, the 31 segments that are obtained are not locally closed, i.e. there are not 24 25 There are three fundamental routines in the library: mrcgs, rcgs and 26 crcgs. mrcgs (Minimal Reduced CGS) is an algorithm that packs so 27 much as it is able to do (using algorithms adhoc) the segments with 28 the same lpp, obtaining the minimal number of segments. The hypothesis 29 is that the result is also canonical, but for the moment there is no 30 proof of the uniqueness of this minimal packing. Moreover, the 31 segments that are obtained are not locally closed, i.e. there are not 32 32 difference of two varieties. 33 33 34 34 On the other side, Michael Wibmer has proved that for homogeneous ideals, 35 35 all the segments with reduced bases having the same lpp admit a unique 36 36 basis specializing well. For this purpose it is necessary to extend the 37 37 description of the elements of the bases to functions, forming sheaves 38 of polynomials instead of simple polynomials, so that the polynomials in 39 a sheaf either preserve the lpp of the corresponding polynomial of 38 of polynomials instead of simple polynomials, so that the polynomials in 39 a sheaf either preserve the lpp of the corresponding polynomial of 40 40 the specialized Groebner basis (and then it specializes well) or 41 41 it specializes to 0. Moreover, in a sheaf, for every point in the … … 44 44 segments are locally closed, that is can be described as the difference of 45 45 two varieties. 46 46 47 47 Using Wibmer's Theorem we proved that an affine ideal can be homogenized, 48 48 than discussed by mrcgs and finally de-homogenized. The bases so obtained 49 49 can be reduced and specialize well in the segment. If the theoretic 50 objective is reached, and all the segments of the homogenized ideal 50 objective is reached, and all the segments of the homogenized ideal 51 51 have been packed, locally closed segments will be obtained. 52 52 53 53 If we only homogenize the given basis of the ideal, then we cannot ensure 54 54 the canonicity of the partition obtained, because there are many different … … 58 58 is usually faster than mrcgs and crcgs. But the given partition is not 59 59 always canonical. 60 60 61 61 Finally it is possible to homogenize the whole affine ideal, and then 62 62 the packing algorithm will provide canonical segments by dehomogenizing. 63 63 This corresponds to crcgs routine. It provides the best description 64 of the segments and bases. In contrast crcgs algorithm is usually much 65 more time consuming and it will not always finish in a reasonable time. 66 Moreover it will contain more segments than mrcgs and possibly also more 64 of the segments and bases. In contrast crcgs algorithm is usually much 65 more time consuming and it will not always finish in a reasonable time. 66 Moreover it will contain more segments than mrcgs and possibly also more 67 67 than rcgs. 68 68 69 69 But the actual algorithms in the library to pack segments have some lacks. 70 70 They are not theoretically always able to pack the segments that we know 71 71 that can be packed. Nevertheless, thanks to Wibmer's Theorem, the 72 algorithms rcgs and crcgs are able to detect if the objective has not been 73 reached, and if so, to give a Warning. The warning does not invalidate the 74 output, but it only recognizes that the theoretical objective is not 75 completely reached by the actual campcting methods and that some segments 72 algorithms rcgs and crcgs are able to detect if the objective has not been 73 reached, and if so, to give a Warning. The warning does not invalidate the 74 output, but it only recognizes that the theoretical objective is not 75 completely reached by the actual campcting methods and that some segments 76 76 that can be packed have not been packed with a single basis. 77 77 78 78 The routine buildtree is the first algorithm used in all the previous 79 79 methods providing a first disjoint CGS, and can be used if none of the 80 80 three fundamental algorithms of the library finishes in a reasonable time. 81 82 There are also routines to visualize better the output of the previous 81 82 There are also routines to visualize better the output of the previous 83 83 algorithms: 84 84 finalcases can be applied to the list provided by buildtree to obtain the 85 85 CGS. The list provided by buildtree contains the whole discussion, and 86 86 finalcases extracts the CGS. 87 The output of buildtree can also be transformed into a file using 88 buildtreetoMaple routine that can be read in Maple. Using Monte's dpgb 87 The output of buildtree can also be transformed into a file using 88 buildtreetoMaple routine that can be read in Maple. Using Monte's dpgb 89 89 library in Maple the output can be plotted (with the routine tplot). 90 90 To plot the output of mrcgs, rcgs or crcgs in Maple, the library also … … 95 95 prime ideals in a canonical form that is described in the papers. 96 96 Nevertheless this canonical form is somewhat uncomfortable to be 97 interpreted. When the segments are all locally closed (and this is 97 interpreted. When the segments are all locally closed (and this is 98 98 always the case for rcgs and crcgs) the routine cantodiffcgs transforms 99 99 the output into a simpler form having only one list element for 100 100 each segment and providing the two varieties whose difference represent 101 101 the segment also in a canonical form. 102 103 AUTHORS: Antonio Montes , Hans Schoenemann. 104 OVERVIEW: see \"Minimal Reduced Comprehensive Groebner Systems\" 102 103 AUTHORS: Antonio Montes , Hans Schoenemann. 104 OVERVIEW: see \"Minimal Reduced Comprehensive Groebner Systems\" 105 105 by Antonio Montes. (http://www-ma2.upc.edu/~montes/). 106 106 … … 118 118 setglobalrings(); It is called by the fundamental routines of the library: 119 119 (buildtree, mrcgs, rcgs, crcgs). 120 After calling it, the rings @R, @P and @RP are defined 120 After calling it, the rings @R, @P and @RP are defined 121 121 globally. 122 memberpos(f,J); Returns the list of two integers: the value 0 or 1 depending 123 on if f belongs to J or not, and the position in J (0 if it 122 memberpos(f,J); Returns the list of two integers: the value 0 or 1 depending 123 on if f belongs to J or not, and the position in J (0 if it 124 124 does not belong). 125 125 subset(F,G); If all elements of F belong to the ideal G it returns 1, 126 and 0 otherwise. 127 pdivi(f,F); Pseudodivision of a poly f by an ideal F in @R. Returns a 126 and 0 otherwise. 127 pdivi(f,F); Pseudodivision of a poly f by an ideal F in @R. Returns a 128 128 list (r,q,m) such that m*f=r+sum(q.G). 129 facvar(ideal J) Returns all the free-square factors of the elements 129 facvar(ideal J) Returns all the free-square factors of the elements 130 130 of ideal J (non repeated). Integer factors are ignored, 131 131 even 0 is ignored. It can be called from ideal @R, but 132 132 the given ideal J must only contain poynomials in the 133 133 parameters. 134 redspec(N,W); Given null and non-null conditions depending only on the 134 redspec(N,W); Given null and non-null conditions depending only on the 135 135 parameters it returns a red-specification. 136 pnormalform(f,N,W); Reduces the poly f wrt to the null condition ideal N and the 136 pnormalform(f,N,W); Reduces the poly f wrt to the null condition ideal N and the 137 137 non-null condition ideal W (both depending on the parameters). 138 buildtree(F); Returns a list T describing a first reduced CGS of the ideal 138 buildtree(F); Returns a list T describing a first reduced CGS of the ideal 139 139 F in K[a][x]. 140 buildtreetoMaple(T); Writes into a file the output of buildtree in Maple readable 140 buildtreetoMaple(T); Writes into a file the output of buildtree in Maple readable 141 141 form. 142 142 finalcases(T); From the output of buildtree it provides the list 143 of its terminal vertices. That list represents the dichotomic, 143 of its terminal vertices. That list represents the dichotomic, 144 144 reduced CGS obtained by buildtree. 145 mrcgs(F); Returns a list T describing the Minimal Reduced CGS of the 145 mrcgs(F); Returns a list T describing the Minimal Reduced CGS of the 146 146 ideal F of K[a][x] 147 rcgs(F); Returns a list T describing the Reduced CGS of the ideal F 148 of K[a][x] obtained by direct homogenizing and de-homogenizing 147 rcgs(F); Returns a list T describing the Reduced CGS of the ideal F 148 of K[a][x] obtained by direct homogenizing and de-homogenizing 149 149 the basis of the given ideal. 150 crcgs(F); Returns a list T describing the Canonical Reduced CGS of the 151 ideal F of K[a][x] obtained by homogenizing and de-homogenizing 150 crcgs(F); Returns a list T describing the Canonical Reduced CGS of the 151 ideal F of K[a][x] obtained by homogenizing and de-homogenizing 152 152 the initial ideal. 153 cantreetoMaple)(M); Writes into a file the output of mrcgs, rcgs or crcgs in Maple 153 cantreetoMaple)(M); Writes into a file the output of mrcgs, rcgs or crcgs in Maple 154 154 readable form. 155 155 cantodiffcgs(list L);From the output of rcgs or crcgs (or even of mrcgs when 156 156 it is possible) it returns a simpler list where the segments 157 are given as difference of varieties. 158 159 SEE ALSO: compregb_lib 157 are given as difference of varieties. 158 159 SEE ALSO: compregb_lib 160 160 "; 161 161 162 162 // ************ Begin of the redCGS library ********************* 163 // Library redCGS 164 // (Reduced Comprehesive Groebner Systems): 163 // Library redCGS 164 // (Reduced Comprehesive Groebner Systems): 165 165 // Initial data: 21-1-2008 166 166 // Release 1: 167 167 // Final data: 3_7-2008 168 // All given and determined polynomials and ideals are in the 168 // All given and determined polynomials and ideals are in the 169 169 // basering K[a][x]; 170 // After calling setglobalrings(); the rings 170 // After calling setglobalrings(); the rings 171 171 // @R (K[a][x]), 172 // @P (K[a]), 172 // @P (K[a]), 173 173 // @RP (K[x,a]) are globally defined 174 174 // They are used internally and can also be called by the user; 175 // setglobalrings() is called by buildtree, so it is not required to 175 // setglobalrings() is called by buildtree, so it is not required to 176 176 // call setglobalrings before using 177 177 // the fundamental routines of the library. … … 184 184 "USAGE: setglobalrings(); 185 185 No arguments 186 RETURN: After its call the rings @R=K[a][x], @P=K[a], @RP=K[x,a] are 186 RETURN: After its call the rings @R=K[a][x], @P=K[a], @RP=K[x,a] are 187 187 defined as global variables. 188 188 NOTE: It is called by the fundamental routines of the library. … … 190 190 the fundamental routines have been called and some 191 191 other routines of the library are used. 192 The basering R, must be of the form K[a][x], a=parameters, 192 The basering R, must be of the form K[a][x], a=parameters, 193 193 x=variables, and should be defined previously. 194 194 KEYWORDS: ring, rings … … 196 196 { 197 197 def @R=basering; // must be of the form K[a][x], a=parameters, x=variables 198 def Rx=ringlist(@R); 199 def @P=ring(Rx[1]); 198 def Rx=ringlist(@R); 199 def @P=ring(Rx[1]); 200 200 list Lx; 201 201 Lx[1]=0; 202 202 Lx[2]=Rx[2]+Rx[1][2]; 203 203 Lx[3]=Rx[1][3]; 204 Lx[4]=Rx[1][4]; 204 Lx[4]=Rx[1][4]; 205 205 //def @K=ring(Lx); 206 206 //exportto(Top,@K); //global ring K[x,a] with the order of x extended to x,a 207 Rx[1]=0; 208 def D=ring(Rx); 209 def @RP=D+@P; 210 exportto(Top,@R); // global ring K[a][x] 207 Rx[1]=0; 208 def D=ring(Rx); 209 def @RP=D+@P; 210 exportto(Top,@R); // global ring K[a][x] 211 211 exportto(Top,@P); // global ring K[a] 212 212 exportto(Top,@RP); // global ring K[x,a] with product order … … 229 229 // ideal J (J can be also poly), but the output is an ideal; 230 230 // output: 231 // ideal Jc (the new form of ideal J without denominators and 231 // ideal Jc (the new form of ideal J without denominators and 232 232 // normalized to content 1) 233 233 proc cld(ideal J) … … 392 392 example 393 393 { "EXAMPLE:"; echo = 2; 394 list J=list(7,3,2); 394 list J=list(7,3,2); 395 395 list K=list(1,2,3,5,7,8); 396 396 subset(J,K); … … 439 439 poly f: the polynomial to be divided 440 440 ideal F: the divisor ideal 441 RETURN: A list (poly r, ideal q, poly m). r is the remainder of the 442 pseudodivision, q is the ideal of quotients, and m is the 443 factor by which f is to be multiplied. 444 NOTE: Pseudodivision of a poly f by an ideal F in @R. Returns a 441 RETURN: A list (poly r, ideal q, poly m). r is the remainder of the 442 pseudodivision, q is the ideal of quotients, and m is the 443 factor by which f is to be multiplied. 444 NOTE: Pseudodivision of a poly f by an ideal F in @R. Returns a 445 445 list (r,q,m) such that m*f=r+sum(q.G). 446 446 KEYWORDS: division, reduce … … 530 530 }; 531 531 532 // facvar: Returns all the free-square factors of the elements 532 // facvar: Returns all the free-square factors of the elements 533 533 // of ideal J (non repeated). Integer factors are ignored, 534 534 // even 0 is ignored. It can be called from ideal @R, but … … 537 537 // Operates in the ring @P, but can be called from ring @R. 538 538 // input: ideal J 539 // output: ideal Jc: Returns all the free-square factors of the elements 539 // output: ideal Jc: Returns all the free-square factors of the elements 540 540 // of ideal J (non repeated). Integer factors are ignored, 541 541 // even 0 is ignored. It can be called from ideal @R, but … … 545 545 "USAGE: facvar(J); 546 546 J: an ideal in the parameters 547 RETURN: all the free-square factors of the elements 547 RETURN: all the free-square factors of the elements 548 548 of ideal J (non repeated). Integer factors are ignored, 549 549 even 0 is ignored. It can be called from ideal @R, but 550 550 the given ideal J must only contain poynomials in the 551 parameters. 551 parameters. 552 552 NOTE: Operates in the ring @P, and the ideal J must contain only 553 polynomials in the parameters, but can be called from ring @R. 553 polynomials in the parameters, but can be called from ring @R. 554 554 KEYWORDS: factor 555 555 EXAMPLE: facvar; shows an example" … … 621 621 proc pnormalform(poly f, ideal N, ideal W) 622 622 "USAGE: pnormalform(f,N,W); 623 f: the polynomial to be reduced modulo N,W (in parameters and 623 f: the polynomial to be reduced modulo N,W (in parameters and 624 624 variables) 625 625 N: the null conditions ideal 626 W: the non-null conditions (set of irreducible polynomials, ideal) 626 W: the non-null conditions (set of irreducible polynomials, ideal) 627 627 RETURN: a reduced polynomial g of f, whose coefficients are reduced 628 628 modulo N and having no factor in W. 629 NOTE: Should be called from ring @R. Ideals N and W must be polynomials 630 in the parameters forming a red-specification (see definition) the papers). 629 NOTE: Should be called from ring @R. Ideals N and W must be polynomials 630 in the parameters forming a red-specification (see definition) the papers). 631 631 KEYWORDS: division, pdivi, reduce 632 632 EXAMPLE: pnormalform; shows an example" … … 700 700 W: set of non-null polynomials (ideal) 701 701 RETURN: a list (N1,W1,L1) containing a red-specification of the segment (N,W). 702 N1 is the radical reduced ideal characterizing the segment. 703 V(N1) is the Zarisky closure of the segment (N,W). 702 N1 is the radical reduced ideal characterizing the segment. 703 V(N1) is the Zarisky closure of the segment (N,W). 704 704 The segment S=V(N1) \ V(h), where h=prod(w in W1) 705 705 N1 is uniquely determined and no prime component of N1 contains none of 706 706 the polynomials in W1. The polynomials in W1 are prime and reduced 707 707 wrt N1, and are considered non-null on the segment. 708 L1 contains the list of prime components of N1. 709 NOTE: can be called from ring @R but it works in ring @P. 708 L1 contains the list of prime components of N1. 709 NOTE: can be called from ring @R but it works in ring @P. 710 710 KEYWORDS: specification 711 711 EXAMPLE: redspec; shows an example" … … 1284 1284 "USAGE: buildtree(F); 1285 1285 F: ideal in K[a][x] (parameters and variables) to be discussed 1286 RETURN: Returns a list T describing a dichotomic discussion tree, whose 1286 RETURN: Returns a list T describing a dichotomic discussion tree, whose 1287 1287 content is the first discussion of the ideal F of K[a][x]. 1288 1288 The first element of the list is the root, and contains … … 1294 1294 no optional conditions are given. 1295 1295 [7] the set of lpp of ideal F 1296 [8] condition that was taken to reach the vertex 1296 [8] condition that was taken to reach the vertex 1297 1297 (poly 1, for the root). 1298 1298 The remaning elements of the list represent vertices of the tree: … … 1306 1306 to reach the vertex 1307 1307 [7] the set of lpp of the specialized ideal at this stage 1308 [8] condition that was taken to reach the vertex from the 1308 [8] condition that was taken to reach the vertex from the 1309 1309 father's vertex (that was taken non-null if the last 1310 1310 integer in the label is 1, and null if it is 0) … … 1313 1313 specialized ideal on each point of the segment and preserve 1314 1314 the lpp. So they form a disjoint reduced CGS. 1315 NOTE: The basering R, must be of the form K[a][x], a=parameters, 1315 NOTE: The basering R, must be of the form K[a][x], a=parameters, 1316 1316 x=variables, and should be defined previously. The ideal must 1317 1317 be defined on R. … … 1323 1323 The file written by buildtreetoMaple when readed in a Maple 1324 1324 worksheet can be plotted using the dbgb routine tplot; 1325 1325 1326 1326 KEYWORDS: CGS, disjoint, reduced, comprehensive Groebner system 1327 1327 EXAMPLE: buildtree; shows an example" … … 1938 1938 // detect weather W1 intersect W2 is non-empty 1939 1939 for (i=1;i<=size(W1);i++) 1940 { 1940 { 1941 1941 if (memberpos(W1[i],W2)[1]) 1942 { 1942 { 1943 1943 W12[size(W12)+1]=W1[i]; 1944 1944 } 1945 1945 else 1946 1946 { 1947 if (nonnull(W1[i],N2,W2)) 1947 if (nonnull(W1[i],N2,W2)) 1948 1948 { 1949 1949 W12[size(W12)+1]=W1[i]; … … 2130 2130 G=G+(cA1*ww1*c1[alpha]-(matrix(N10)*T*qT)[1,1])*Tm[alpha]; 2131 2131 } 2132 //T_ "genimage has found a more generic basis (method 2)"; 2132 //T_ "genimage has found a more generic basis (method 2)"; 2133 2133 //T_ "f1:"; f1; "N1:"; N1; "W1:"; W1; 2134 2134 //T_ "f2:"; f2; "N2:"; N2; "W2:"; W2; … … 2136 2136 GG=ideal(G); 2137 2137 } 2138 else{GG=ideal(0);} 2138 else{GG=ideal(0);} 2139 2139 return(GG); 2140 2140 }; … … 2147 2147 // that is non-null in the second segment. 2148 2148 // input: 2149 // poly f: a polynomials of the reduced basis in the segment (N,W) 2149 // poly f: a polynomials of the reduced basis in the segment (N,W) 2150 2150 // ideal N: the null-conditions ideal in the segment 2151 // ideal W12: the set of non-null polynomials common to the segment and 2151 // ideal W12: the set of non-null polynomials common to the segment and 2152 2152 // a second segment 2153 2153 proc extendpoly(poly f, ideal N, ideal W12) … … 2297 2297 //T_ "A sheaf has been found (method 1)"; 2298 2298 return(ideal(g1,g2)); 2299 } 2299 } 2300 2300 return(ideal(genimage(g1,N1,W1,g2,N2,W2))); 2301 2301 } … … 2316 2316 [3]: the reduced basis of the segment. 2317 2317 [4], [5], [6]: the red-spec of the null and non-null conditions 2318 of the segment. 2318 of the segment. 2319 2319 [4] is the null-conditions radical ideal N, 2320 2320 [5] is the non-null polynomials set (ideal) W, … … 2322 2322 [7]: is the set of lpp 2323 2323 [8]: poly 1 (irrelevant) is the condition to branch (but no 2324 more branch is necessary in the discussion, so 1 is the result. 2324 more branch is necessary in the discussion, so 1 is the result. 2325 2325 NOTE: It can be called having as argument the list output by buildtree 2326 2326 KEYWORDS: buildtree, buildtreetoMaple, CGS … … 2455 2455 // reduced basis. The elements of L are of the form 2456 2456 // list (lpp,B,list(list(N,W,L),..list(N,W,L)) ) 2457 proc selectcases(list bT) 2457 proc selectcases(list bT) 2458 2458 { 2459 2459 list T=groupsegments(finalcases(bT)); … … 3071 3071 } 3072 3072 3073 // given the the label labfu of the vertex fu it returns the last3073 // given the label labfu of the vertex fu it returns the last 3074 3074 // int of the label of the last existing children. 3075 3075 // if no child exists, then it ouputs 0. … … 3098 3098 } 3099 3099 3100 // given the thevertex u it provides the next brother of u.3100 // given the vertex u it provides the next brother of u. 3101 3101 // if it does not exist, then it ouputs v=list(list(intvec(0)),0) 3102 3102 proc nextbrother(intvec labu) … … 3252 3252 The description given here is identical for rcgs and crcgs. 3253 3253 The elements of the list T computed by mrcgs are lists representing 3254 a rooted tree. 3254 a rooted tree. 3255 3255 Each element has as the two first entries with the following content: 3256 [1]: The label (intvec) representing the position in the rooted 3256 [1]: The label (intvec) representing the position in the rooted 3257 3257 tree: 0 for the root (and this is a special element) 3258 i for the root of the segment i 3258 i for the root of the segment i 3259 3259 (i,...) for the children of the segment i 3260 3260 [2]: the number of children (int) of the vertex. … … 3264 3264 3) the rest of vertices labelled with more indices. 3265 3265 Description of the root. Vertex type 1) 3266 There is a special vertex (the first one) whose content is 3266 There is a special vertex (the first one) whose content is 3267 3267 the following: 3268 3268 [3] lpp of the given ideal … … 3286 3286 with an odd number of integers in the label are to be considered as 3287 3287 substraction. As an example consider the following vertices: 3288 v1=((i),2,lpp,B), 3289 v2=((i,1),2,P_{(i,1)}), 3288 v1=((i),2,lpp,B), 3289 v2=((i,1),2,P_{(i,1)}), 3290 3290 v3=((i,1,1),2,P_{(i,1,1)}, 3291 v4=((i,1,1,1),1,P_{(i,1,1,1)}, 3291 v4=((i,1,1,1),1,P_{(i,1,1,1)}, 3292 3292 v5=((i,1,1,1,1),0,P_{(i,1,1,1,1)}, 3293 v6=((i,1,1,2),1,P_{(i,1,1,2)}, 3293 v6=((i,1,1,2),1,P_{(i,1,1,2)}, 3294 3294 v7=((i,1,1,2,1),0,P_{(i,1,1,2,1)}, 3295 3295 v8=((i,1,2),0,P_{(i,1,2)}, … … 3299 3299 (V(i,1)\(((V(i,1,1) \ ((V(i,1,1,1) \ V(i,1,1,1,1)) u (V(i,1,1,2) \ V(i,1,1,2,1))))) 3300 3300 u V(i,1,2)) u (V(i,2) \ V(i,2,1)) 3301 and can also be represented by 3301 and can also be represented by 3302 3302 (V(i,1) \ (V(i,1,1) u V(i,1,2))) u 3303 3303 (V(i,1,1,1) \ V(i,1,1,1)) u 3304 (V(i,1,1,2) \ V(i,1,1,2,1)) u 3304 (V(i,1,1,2) \ V(i,1,1,2,1)) u 3305 3305 (V(i,2) \ V(i,2,1)) 3306 where V(i,j,..) = V(P_{(i,j,..)} 3306 where V(i,j,..) = V(P_{(i,j,..)} 3307 3307 NOTE: There are three fundamental routines in the library: mrcgs, rcgs and crcgs. 3308 3308 mrcgs (Minimal Reduced CGS) is an algorithm that packs so much as it 3309 is able to do (using algorithms adhoc) the segments with the same lpp, 3310 obtaining the minimal number of segments. The hypothesis is that this 3311 is also canonical, but for the moment there is no proof of the uniqueness 3309 is able to do (using algorithms adhoc) the segments with the same lpp, 3310 obtaining the minimal number of segments. The hypothesis is that this 3311 is also canonical, but for the moment there is no proof of the uniqueness 3312 3312 of that minimal packing. Moreover, the segments that are obtained are not 3313 3313 locally closed, i.e. there are not always the difference of two varieties, … … 3396 3396 { 3397 3397 if (size(@L[i][1])>1) 3398 { 3398 { 3399 3399 @L[i][3]=delidfromid(N,@L[i][3]); 3400 3400 } … … 3403 3403 { 3404 3404 if ((size(@L[i][1])>1) and (size(@L[i][1]) mod 2==1) and (equalideals(@L[i][3],ideal(0)))) 3405 { 3405 { 3406 3406 lab=@L[i][1]; 3407 3407 labfu=delintvec(lab,size(lab)); … … 3595 3595 The description given here is analogous as for mrcgs and crcgs. 3596 3596 The elements of the list T computed by rcgs are lists representing 3597 a rooted tree. 3597 a rooted tree. 3598 3598 Each element has as the two first entries with the following content: 3599 [1]: The label (intvec) representing the position in the rooted 3599 [1]: The label (intvec) representing the position in the rooted 3600 3600 tree: 0 for the root (and this is a special element) 3601 i for the root of the segment i 3601 i for the root of the segment i 3602 3602 (i,...) for the children of the segment i 3603 3603 [2]: the number of children (int) of the vertex. … … 3607 3607 3) the rest of vertices labelled with more indices. 3608 3608 Description of the root. Vertex type 1) 3609 There is a special vertex (the first one) whose content is 3609 There is a special vertex (the first one) whose content is 3610 3610 the following: 3611 3611 [3] lpp of the given ideal … … 3629 3629 with an odd number of integers in the label are to be considered as 3630 3630 substraction. As an example consider the following vertices: 3631 v1=((i),2,lpp,B), 3632 v2=((i,1),2,P_{(i,1)}), 3631 v1=((i),2,lpp,B), 3632 v2=((i,1),2,P_{(i,1)}), 3633 3633 v3=((i,1,1),0,P_{(i,1,1)}, v4=((i,1,2),0,P_{(i,1,1)}), 3634 v5=((i,2),2,P_{(i,2)}, 3634 v5=((i,2),2,P_{(i,2)}, 3635 3635 v6=((i,2,1),0,P_{(i,2,1)}, v7=((i,2,2),0,P_{(i,2,2)} 3636 3636 They represent the segment: 3637 (V(i,1)\(V(i,1,1) u V(i,1,2))) u 3637 (V(i,1)\(V(i,1,1) u V(i,1,2))) u 3638 3638 (V(i,2)\(V(i,2,1) u V(i,2,2))) 3639 where V(i,j,..) = V(P_{(i,j,..)} 3639 where V(i,j,..) = V(P_{(i,j,..)} 3640 3640 NOTE: There are three fundamental routines in the library: mrcgs, rcgs and crcgs. 3641 3641 rcgs (Reduced CGS) is an algorithm that first homogenizes the 3642 basis of the given ideal then applies mrcgs and finally de-homogenizes 3642 basis of the given ideal then applies mrcgs and finally de-homogenizes 3643 3643 and reduces the resulting bases. (See the note of mrcgs). 3644 3644 As a result of Wibmer's Theorem, the resulting segments are … … 3647 3647 is not the homogenized ideal of the given ideal but only the ideal 3648 3648 obtained by homogenizing the given basis. 3649 3649 3650 3650 The output can be visualized using cantreetoMaple, that will 3651 3651 write a file with the content of mrcgs that can be read in Maple … … 3777 3777 The description given here is identical for mrcgs and rcgs. 3778 3778 The elements of the list T computed by crcgs are lists representing 3779 a rooted tree. 3779 a rooted tree. 3780 3780 Each element has as the two first entries with the following content: 3781 [1]: The label (intvec) representing the position in the rooted 3781 [1]: The label (intvec) representing the position in the rooted 3782 3782 tree: 0 for the root (and this is a special element) 3783 i for the root of the segment i 3783 i for the root of the segment i 3784 3784 (i,...) for the children of the segment i 3785 3785 [2]: the number of children (int) of the vertex. … … 3789 3789 3) the rest of vertices labelled with more indices. 3790 3790 Description of the root. Vertex type 1) 3791 There is a special vertex (the first one) whose content is 3791 There is a special vertex (the first one) whose content is 3792 3792 the following: 3793 3793 [3] lpp of the given ideal … … 3811 3811 with an odd number of integers in the label are to be considered as 3812 3812 substraction. As an example consider the following vertices: 3813 v1=((i),2,lpp,B), 3814 v2=((i,1),2,P_{(i,1)}), 3813 v1=((i),2,lpp,B), 3814 v2=((i,1),2,P_{(i,1)}), 3815 3815 v3=((i,1,1),0,P_{(i,1,1)}, v4=((i,1,2),0,P_{(i,1,1)}), 3816 v5=((i,2),2,P_{(i,2)}, 3816 v5=((i,2),2,P_{(i,2)}, 3817 3817 v6=((i,2,1),0,P_{(i,2,1)}, v7=((i,2,2),0,P_{(i,2,2)} 3818 3818 They represent the segment: 3819 (V(i,1)\(V(i,1,1) u V(i,1,2))) u 3819 (V(i,1)\(V(i,1,1) u V(i,1,2))) u 3820 3820 (V(i,2)\(V(i,2,1) u V(i,2,2))) 3821 where V(i,j,..) = V(P_{(i,j,..)} 3821 where V(i,j,..) = V(P_{(i,j,..)} 3822 3822 NOTE: There are three fundamental routines in the library: mrcgs, rcgs and crcgs. 3823 3823 crcgs (Canonical Reduced CGS) is an algorithm that first homogenizes the 3824 the given ideal then applies mrcgs and finally de-homogenizes 3824 the given ideal then applies mrcgs and finally de-homogenizes 3825 3825 and reduces the resulting bases. (See the note of mrcgs). 3826 3826 As a result of Wibmer's Theorem, the resulting segments are 3827 3827 locally closed (i.e. difference of varieties) and the partition is 3828 canonical as the homogenized ideal is uniquely associated to the given 3828 canonical as the homogenized ideal is uniquely associated to the given 3829 3829 ideal not depending of the given basis. 3830 3830 3831 3831 Nevertheless the computations to do are usually more time consuming 3832 3832 and so it is preferable to compute first the rcgs and only if 3833 3833 it success you can try crcgs. 3834 3834 3835 3835 The output can be visualized using cantreetoMaple, that will 3836 3836 write a file with the content of crcgs that can be read in Maple … … 3882 3882 def Jp=idint(Np,Mp); 3883 3883 setring(RR); 3884 return(imap(@P,Jp)); 3884 return(imap(@P,Jp)); 3885 3885 } 3886 3886 … … 3905 3905 output where each segment corresponds to a single element of the list 3906 3906 that is described as difference of two varieties. 3907 3907 3908 3908 The first element of the list is identical to the first element 3909 3909 of the list provided by the corresponding cgs algorithm, and … … 3916 3916 [4]; the ideal of the second variety (radical) 3917 3917 The segment is V([3]) \ V([4]). 3918 3918 3919 3919 NOTE: It can be called from the output of mrcgs or rcgs of crcgs 3920 3920 KEYWORDS: mrcgs, rcgs, crcgs, Maple … … 3947 3947 v=tree(intvec(i,j),L); 3948 3948 Nn=v[1][3]; 3949 N=idintR(N,Nn); 3949 N=idintR(N,Nn); 3950 3950 for (k=1;k<=v[1][2];k++) 3951 3951 { 3952 3952 w=tree(intvec(i,j,k),L); 3953 3953 Mn=w[1][3]; 3954 M=idintR(M,Mn); 3954 M=idintR(M,Mn); 3955 3955 } 3956 3956 } … … 3964 3964 MP=gbR(MP); 3965 3965 setring(RR); 3966 N=imap(@P,NP); 3967 M=imap(@P,MP); 3966 N=imap(@P,NP); 3967 M=imap(@P,MP); 3968 3968 LL[i+1]=list(u[1][3],u[1][4],N,M); 3969 3969 } … … 3977 3977 T; 3978 3978 cantreetoMaple(T,"Tc","Tc.txt"); 3979 cantodiffcgs(T); 3979 cantodiffcgs(T); 3980 3980 } 3981 3981 -
Singular/LIB/sing.lib
rfba86f8 r7d56875 1 // $Id: sing.lib,v 1.3 1 2008-09-24 07:54:59Singular Exp $1 // $Id: sing.lib,v 1.32 2008-10-09 09:31:58 Singular Exp $ 2 2 //(GMG/BM, last modified 26.06.96, 3 3 //GMG, 27.7.08: in milnor printlevel und Ausschrift gendert) 4 4 /////////////////////////////////////////////////////////////////////////////// 5 version="$Id: sing.lib,v 1.3 1 2008-09-24 07:54:59Singular Exp $";5 version="$Id: sing.lib,v 1.32 2008-10-09 09:31:58 Singular Exp $"; 6 6 category="Singularities"; 7 7 info=" … … 11 11 12 12 PROCEDURES: 13 codim(id1, id2); vector space dimension of ofid2/id1 if finite13 codim(id1, id2); vector space dimension of id2/id1 if finite 14 14 deform(i); infinitesimal deformations of ideal i 15 15 dim_slocus(i); dimension of singular locus of ideal i -
Singular/LIB/tropical.lib
rfba86f8 r7d56875 1 version="$Id: tropical.lib,v 1. 7 2008-08-20 17:36:04 keilenExp $";1 version="$Id: tropical.lib,v 1.8 2008-10-09 09:31:58 Singular Exp $"; 2 2 category="Tropical Geometry"; 3 3 info=" … … 8 8 @* Thomas Markwig, email: keilen@mathematik.uni-kl.de 9 9 10 WARNING: 10 WARNING: 11 11 - tropicalLifting will only work under LINUX and if in addition gfan is installed. 12 12 @* - drawTropicalCurve and drawTropicalNewtonSubdivision will only display the tropical … … 20 20 the torus is embedded via the map sending a point x in (K*)^n to the point (x^v0,...,x^vm). 21 21 The generic hyperplane sections are just the images of the hypersurfaces in (K*)^n defined by 22 the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties of these hypersurfaces can be studied 23 via tropicalisation. 24 25 For this we suppose that K=C{{t}} is the field of Puiseux series over the field of complex 22 the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties of these hypersurfaces can be studied 23 via tropicalisation. 24 25 For this we suppose that K=C{{t}} is the field of Puiseux series over the field of complex 26 26 numbers (or any other field with a valuation into the real numbers). One associates to the 27 27 hypersurface given by f=a0*x^v0+...+am*x^vm the tropical hypersurface defined by the tropicalisation … … 29 29 of the integer vector v in Z^n with the vector x=(x1,...,xn) of variables, so that trop(f) is 30 30 a piecewise linear function on R^n. The corner locus of this function (i.e. the points at which 31 the minimum is attained a least twice) is the tropical hypersurface defined by trop(f). 31 the minimum is attained a least twice) is the tropical hypersurface defined by trop(f). 32 32 The theorem of Newton-Kapranov states that this tropical hypersurface is the same as if one 33 33 computes pointwise the valuation of the hypersurface given by f. The analogue holds true if one 34 replaces one equation f by an ideal I. A constructive proof of the theorem is given by an adapted 34 replaces one equation f by an ideal I. A constructive proof of the theorem is given by an adapted 35 35 version of the Newton-Puiseux algorithm. The hard part is to find a point in the variety over 36 36 C{{t}} which corresponds to a given point in the tropical variety. … … 39 39 Of course we cannot represent the field of Puiseux series over C in its full strength, however, 40 40 in order to compute interesting examples it will be sufficient to replace the complex numbers C 41 by the rational numbers Q and to replace Puiseux series in t by rational functions in t, 42 i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. Note, that this in particular 41 by the rational numbers Q and to replace Puiseux series in t by rational functions in t, 42 i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. Note, that this in particular 43 43 forbits rational exponents for the t's. 44 44 … … 48 48 If, however, for some reason you prefer to work with general vi, then you have to pass right away to 49 49 the tropicalisation of the equations, whereever this is allowed -- these are linear polynomials 50 where the constant coefficient correspond to the valuation of the original coefficient and where 50 where the constant coefficient correspond to the valuation of the original coefficient and where 51 51 the non-constant coefficient correspond to the exponents of the monomials, thus they may be rational 52 numbers respectively negative numbers: 52 numbers respectively negative numbers: 53 53 e.g. if f=t^{1/2}*x^{-2}*y^3+2t*x*y+4 then trop(f)=min{1/2-2x+3y,1+x+y,0}. 54 54 … … 59 59 I have to be in the polynomial ring Q[t,x1,...,xn] considered as a subring of 60 60 C{{t}}[x1,...,xn]; a solution will be constructed up to given order; note that 61 several field extensions of Q might be necessary thoughout the intermediate 61 several field extensions of Q might be necessary thoughout the intermediate 62 62 computations; the procedures uses the external program gfan 63 63 @* - drawTropicalCurve visualises a tropical plane curve either given by a polynomial in Q(t)[x,y] … … 66 66 @* - tropicalJInvariant computes the tropical j-invaiant of a tropical elliptic curve 67 67 @* - jInvariant computes the j-invariant of an elliptic curve 68 @* - weierstrassFom computes the Weierstrass form of an elliptic curve 68 @* - weierstrassFom computes the Weierstrass form of an elliptic curve 69 69 70 70 PROCEDURES CONCERNED WITH TROPICAL LIFTING: … … 93 93 PROCEDURES CONCERNED WITH THE LATEX CONVERSION: 94 94 texNumber(poly) outputs the texcommand for the leading coefficient of poly 95 texPolynomial(poly) outputs the texcommand for the polynomial poly 95 texPolynomial(poly) outputs the texcommand for the polynomial poly 96 96 texMatrix(matrix) outputs the texcommand for the matrix 97 97 texDrawBasic(list) embeds the output of texDrawTropical in a texdraw environment 98 98 texDrawTropical(list) computes the texdraw commands for a tropical curve 99 texDrawNewtonSubdivision(list) computes the texdraw commands for a Newton subdivision 100 texDrawTriangulation(list,list) computes the texdraw commands for a triangulation 99 texDrawNewtonSubdivision(list) computes the texdraw commands for a Newton subdivision 100 texDrawTriangulation(list,list) computes the texdraw commands for a triangulation 101 101 102 102 AUXILARY PROCEDURES: … … 108 108 dualConic(poly) computes the dual of the affine plane conic defined by poly 109 109 parameterSubstitute(poly,int) substitutes in the poly the parameter t by t^N 110 tropcialSubst(poly,int,list) computes the tropical polynomial of poly with certain substitutions 110 tropcialSubst(poly,int,list) computes the tropical polynomial of poly with certain substitutions 111 111 randomPoly(int,int,int) computes a polynomial with random coefficients 112 112 cleanTmp() removes the latex and ps files from /tmp created by other procedures … … 137 137 /// - eliminatecomponents 138 138 /// - findzerosAndBasictransform 139 /// - ordermaximalideals 139 /// - ordermaximalideals 140 140 /// - verticesTropicalCurve 141 141 /// - bunchOfLines … … 186 186 187 187 //////////////////////////////////////////////////////////////////////////////////// 188 /// Procedures concerned with tropical parametrisation 189 /////////////////////////////////////////////////////////////////////////////////// 188 /// Procedures concerned with tropical parametrisation 189 /////////////////////////////////////////////////////////////////////////////////// 190 190 191 191 proc tropicalLifting (ideal i,intvec w,int ordnung,list #) 192 192 "USAGE: tropicalLifting(i,w,ord[,opt]); i ideal, w intvec, ord int, opt string 193 ASSUME: - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 194 and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 195 and ord is the order up to which a point in V(i) over Q{{t}} lying over 193 ASSUME: - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 194 and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 195 and ord is the order up to which a point in V(i) over Q{{t}} lying over 196 196 (w_1/w_0,...,w_n/w_0) shall be computed; w_0 may NOT be ZERO 197 @* - the basering should not have any parameters on its own 197 @* - the basering should not have any parameters on its own 198 198 and it should have a global monomial ordering, e.g. ring r=0,(t,x(1..n)),dp; 199 @* - the first variable of the basering will be treated as the parameter t 199 @* - the first variable of the basering will be treated as the parameter t 200 200 in the Puiseux series field !!!! 201 201 @* - the optional parameter opt should be one or more strings among the following: … … 203 203 @* 'isPrime' : the ideal is prime over Q(t)[x_1,...,x_n] (not to be checked); 204 204 @* 'isInTrop' : (w_1/w_0,...,w_n/w_0) is in the tropical variety (not to be checked); 205 @* 'oldGfan' : uses gfan version 0.2.1 or less 205 @* 'oldGfan' : uses gfan version 0.2.1 or less 206 206 @* 'findAll' : find all solutions of a zero-dimensional ideal over (w_1/w_0,...,w_n/w_0) 207 207 @* 'noAbs' : do NOT use absolute primary decomposition … … 226 226 in the tropical variety of i to a point in V(i) over Puiseux series field up to 227 227 the first ord terms, if the ideal is zero-dimensional over Q{{t}}; 228 more precisely, each entry of the list is a list l as computed if 228 more precisely, each entry of the list is a list l as computed if 229 229 'find_all' was NOT set 230 230 @* WE NOW DESCRIBE THE LIST ENTRIES IF 'findAll' WAS NOT SET: 231 @* - the ring l[1] contains an ideal LIFT, which contains 231 @* - the ring l[1] contains an ideal LIFT, which contains 232 232 a point in V(i) lying over w up to the first ord terms; 233 233 @* - and if the integer l[2] is N then t has to be replaced by t^1/N in the … … 235 235 @* - if the k+1st entry of l[3] is non-zero, then the kth component of LIFT has to 236 236 be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t by t^1/N 237 @* - unless the option 'noResubst' was set, the kth entry of list l[4] 237 @* - unless the option 'noResubst' was set, the kth entry of list l[4] 238 238 is a string which represents the kth generator of 239 239 the ideal i where the coordinates have been replaced by the result of the lift; … … 246 246 @* - if the parameter 'findAll' is set AND the ideal i is zero-dimensional in Q{{t}}[x_1,...,x_n] 247 247 then ALL points in V(i) lying over w are computed up to order ord; if the ideal 248 is not-zero dimenisonal, then only all points in the ideal after cutting down 248 is not-zero dimenisonal, then only all points in the ideal after cutting down 249 249 to dimension zero will be computed 250 250 @* - the procedure REQUIRES that the program GFAN is installed on your computer; … … 263 263 and thus there may not exist a point in V(i) over the Puiseux series field 264 264 with the desired valuation; so there is no chance that the procedure produced 265 a sensible output - e.g. if i=tx^p-tx-1 266 @* + if the dimension of i over Z/pZ(t) is not zero the process of reduction to 265 a sensible output - e.g. if i=tx^p-tx-1 266 @* + if the dimension of i over Z/pZ(t) is not zero the process of reduction to 267 267 zero might not work if the characteristic is small and you are unlucky 268 @* + the option 'noAbs' has to be used since absolute primary decomposition in 268 @* + the option 'noAbs' has to be used since absolute primary decomposition in 269 269 Singular only works in characteristic zero 270 @* - the basefield should either be Q or Z/pZ for some prime p; field extensions 270 @* - the basefield should either be Q or Z/pZ for some prime p; field extensions 271 271 will be computed where necessary; if you need parameters or field extensions 272 272 from the beginning they should rather be simulated as variables possibly adding … … 346 346 { 347 347 Error("The first coordinate of your input w must be NON-ZERO, since it is a DENOMINATOR!"); 348 } 348 } 349 349 // if w_0<0, then replace w by -w, so that the "denominator" w_0 is positive 350 350 if (w[1]<0) … … 362 362 w[1]=-1; 363 363 } 364 // if some entry of w is positive, we have to make a transformation, 364 // if some entry of w is positive, we have to make a transformation, 365 365 // which moves it to something non-positive 366 366 for (j=2;j<=nvars(basering);j++) … … 387 387 { 388 388 variablen=variablen+var(j); 389 } 389 } 390 390 map GRUNDPHI=BASERING,t,variablen; 391 391 ideal i=GRUNDPHI(i); 392 // compute the initial ideal of i and test if w is in the tropical variety of i 392 // compute the initial ideal of i and test if w is in the tropical variety of i 393 393 // - the last entry 1 only means that t is the last variable in the ring 394 394 ideal ini=tInitialIdeal(i,w,1); 395 395 if (isintrop==0) // test if w is in trop(i) only if isInTrop has not been set 396 { 396 { 397 397 poly product=1; 398 398 for (j=1;j<=nvars(basering)-1;j++) … … 418 418 // the procedurce cutdown computes a new ring, in which there lives a zero-dimensional 419 419 // ideal which has been computed by cutting down the input with generic linear forms 420 // of the type x_i1-p_1,...,x_id-p_d for some polynomials p_1,...,p_d not depending 420 // of the type x_i1-p_1,...,x_id-p_d for some polynomials p_1,...,p_d not depending 421 421 // on the variables x_i1,...,x_id; that way we have reduced the number of variables by dd !!! 422 422 // the new zero-dimensional ideal is called i, its t-initial ideal (with respect to 423 // the new w=CUTDOWN[2]) is ini, and finally there is a list repl in the ring 423 // the new w=CUTDOWN[2]) is ini, and finally there is a list repl in the ring 424 424 // which contains at the polynomial p_j at position i_j and a zero otherwise; 425 425 if (isprime==0) // the minimal associated primes of i are computed … … 461 461 for (jj=1;jj<=size(TP);jj++) 462 462 { 463 // the list TP contains as a first entry the ring over which the tropical parametrisation 463 // the list TP contains as a first entry the ring over which the tropical parametrisation 464 464 // of the (possibly cutdown ideal) i lives 465 465 def LIFTRING=TP[jj][1]; … … 493 493 } 494 494 setring LIFTRING; 495 ideal LIFT=imap(REPLACEMENTRING,LIFT); 496 // test now if the LIFT has the correct valuation !!! 495 ideal LIFT=imap(REPLACEMENTRING,LIFT); 496 // test now if the LIFT has the correct valuation !!! 497 497 // note: it may happen, that when resubstituting PARA into the replacement rules 498 498 // there occured some unexpected cancellation; we only know that for SOME 499 // solution of the zero-dimensional reduction NO canellation will occur, 499 // solution of the zero-dimensional reduction NO canellation will occur, 500 500 // but for others this may very well happen; this in particular means that 501 501 // we possibly MUST compute all zero-dimensional solutions when cutting down! … … 548 548 // replace @a by a in minpoly and in LIFT 549 549 map phi=INTERRING,t,a,a; 550 mp=phi(mp); 550 mp=phi(mp); 551 551 LIFT=phi(LIFT); 552 552 // pass now to a ring whithout @a and with a as parameter … … 555 555 ideal LIFT=imap(INTERRING,LIFT); 556 556 kill INTERRING; 557 } 557 } 558 558 // then export LIFT 559 export(LIFT); 559 export(LIFT); 560 560 // test the result by resubstitution 561 setring GRUNDRING; 561 setring GRUNDRING; 562 562 list resubst; 563 563 if (noresubst==0) … … 568 568 } 569 569 else 570 { 570 { 571 571 resubst=tropicalliftingresubstitute(substitute(i,t,t^(TP[jj][2])),list(LIFTRING),N*TP[jj][2]); 572 572 } 573 573 } 574 574 setring BASERING; 575 // Finally, if t has been replaced by t^N, then we have to change the 575 // Finally, if t has been replaced by t^N, then we have to change the 576 576 // third entry of TP by multiplying by N. 577 577 if (noabs==1) … … 598 598 "The procedure will be restarted with the option 'findAll'."; 599 599 "Go on by hitting RETURN!"; 600 findall=1; 600 findall=1; 601 601 noabs=0; 602 602 setring CUTDOWNRING; … … 604 604 "i";i; 605 605 "ini";tInitialIdeal(i,w,1); 606 606 607 607 /* 608 608 setring GRUNDRING; … … 630 630 if (voice+printlevel>=2) 631 631 { 632 632 633 633 "The procedure has created a list of lists. The jth entry of this list 634 634 contains a ring, an integer and an intvec. 635 635 In this ring lives an ideal representing the wanted lifting, 636 636 if the integer is N then in the parametrisation t has to be replaced by t^1/N, 637 and if the ith component of the intvec is w[i] then the ith component in LIFT 637 and if the ith component of the intvec is w[i] then the ith component in LIFT 638 638 should be multiplied by t^-w[i]/N in order to get the parametrisation. 639 639 640 640 Suppose your list has the name L, then you can access the 1st ring via: 641 641 "; 642 642 if (findall==1) 643 643 { 644 "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 644 "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 645 645 "; 646 646 } 647 647 else 648 648 { 649 "def LIFTRing=L[1]; setring LIFTRing; LIFT; 649 "def LIFTRing=L[1]; setring LIFTRing; LIFT; 650 650 "; 651 } 651 } 652 652 } 653 653 if (findall==1) // if all solutions have been computed, return a list of lists … … 674 674 def LIFTRing=LIST[1]; 675 675 setring LIFTRing; 676 // LIFT contains the first 4 terms of a point in the variety of i 676 // LIFT contains the first 4 terms of a point in the variety of i 677 677 // over the Puiseux series field C{{t}} whose order is -w[1]/w[0]=1 678 678 LIFT; … … 702 702 // NOTE: since the last component of v is positive, the lifting 703 703 // must start with a negative power of t, which in Singular 704 // is not allowed for a variable. 704 // is not allowed for a variable. 705 705 def LIFTRing3=LIST[1]; 706 706 setring LIFTRing3; … … 756 756 } 757 757 if (size(troplift)==4) // this means that tropicalLifting was called with absolute primary decomposition 758 { 758 { 759 759 setring LIFTRing; 760 760 "The lifting of the point in the tropical variety lives in the ring"; 761 761 if ((size(LIFTpar)==0) and (N==1)) 762 762 { 763 Kstring+"[[t]]"; 763 Kstring+"[[t]]"; 764 764 } 765 765 if ((size(LIFTpar)==0) and (N!=1)) 766 766 { 767 Kstring+"[[t^(1/"+string(N)+")]]"; 767 Kstring+"[[t^(1/"+string(N)+")]]"; 768 768 } 769 769 if ((size(LIFTpar)!=0) and (N!=1)) 770 { 771 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 770 { 771 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 772 772 } 773 773 if ((size(LIFTpar)!=0) and (N==1)) 774 { 775 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 774 { 775 Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 776 776 } 777 777 } … … 790 790 } 791 791 if ((size(LIFTpar)!=0) and (N!=1)) 792 { 793 Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 792 { 793 Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 794 794 "where M is the maximal ideal"; 795 795 "M=<"+m+">"; 796 796 } 797 797 if ((size(LIFTpar)!=0) and (N==1)) 798 { 799 Kstring+"["+LIFTpar+"]/M[[t]]"; 798 { 799 Kstring+"["+LIFTpar+"]/M[[t]]"; 800 800 "where M is the maximal ideal"; 801 801 "M=<"+m+">"; 802 } 802 } 803 803 } 804 804 ""; … … 827 827 } 828 828 } 829 } 829 } 830 830 } 831 831 example … … 841 841 842 842 //////////////////////////////////////////////////////////////////////////////////// 843 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 843 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 844 844 //////////////////////////////////////////////////////////////////////////////////// 845 845 proc tropicalCurve (def tp,list #) 846 846 "USAGE: tropicalCurve(tp[,#]); tp list, # optional list 847 ASSUME: tp is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 847 ASSUME: tp is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 848 848 representing a tropical Laurent polynomial defining a tropical plane curve; 849 849 alternatively tp can be a polynomial in Q(t)[x,y] defining a tropical plane curve 850 via the valuation map; 850 via the valuation map; 851 851 the basering must have a global monomial ordering, two variables and up to one parameter! 852 RETURN: list, each entry i=1,...,size(l)-1 corresponds to a vertex in the tropical plane 852 RETURN: list, each entry i=1,...,size(l)-1 corresponds to a vertex in the tropical plane 853 853 curve defined by tp 854 854 l[i][1] = x-coordinate of the ith vertex … … 857 857 the tropical curve is connected to the jth vertex with multiplicity given 858 858 by the corresponding entry in the second row 859 l[i][4] = list of lists, the first entry of a list is a primitive integer vector 860 defining the direction of an unbounded edge emerging from the ith vertex 859 l[i][4] = list of lists, the first entry of a list is a primitive integer vector 860 defining the direction of an unbounded edge emerging from the ith vertex 861 861 of the graph, the corresponding second entry in the list is the multiplicity 862 862 of the unbounded edge 863 863 l[i][5] = a polynomial whose monomials mark the vertices in the Newton polygon 864 corresponding to the entries in tp which take the common minimum 864 corresponding to the entries in tp which take the common minimum 865 865 at the ith vertex -- if some coefficient a or b of the linear polynomials 866 866 in the input was negative, then each monomial has to be shifted by … … 885 885 } 886 886 // if you insert a single polynomial instead of an ideal representing a tropicalised polynomial, 887 // then we compute first the tropicalisation of this polynomial -- this feature is not 887 // then we compute first the tropicalisation of this polynomial -- this feature is not 888 888 // documented in the above help string 889 889 if (typeof(tp)=="poly") … … 892 892 if ((npars(basering)!=1) or (nvars(basering)!=2)) 893 893 { 894 ERROR("The basering should have precisely one parameter and two indeterminates!"); 894 ERROR("The basering should have precisely one parameter and two indeterminates!"); 895 895 } 896 896 poly f=tp; … … 901 901 if (nvars(basering) != 2) 902 902 { 903 ERROR("The basering should have precisely two indeterminates!"); 903 ERROR("The basering should have precisely two indeterminates!"); 904 904 } 905 905 // -1) Exclude the pathological case that the defining tropical polynomial has only one term, … … 910 910 intmat M[2][1]=0,0; 911 911 return(list(list(0,0,M,list(),detropicalise(tp[1])),list(list(leadexp(detropicalise(tp[1]))),list()))); 912 } 912 } 913 913 // 0) If the input was a list of linear polynomials, then some coefficient of x or y can be negative, 914 914 // i.e. the input corresponds to the tropical curve of a Laurent polynomial. In that case we should … … 925 925 { 926 926 bb=koeffizienten(tp[i],2); 927 } 927 } 928 928 } 929 929 if ((aa!=0) or (bb!=0)) … … 942 942 return(bunchOfLines(tp)); 943 943 } 944 // 2) store all vertices belonging to the ith part of the 944 // 2) store all vertices belonging to the ith part of the 945 945 // Newton subdivision in the list vtp[i] as 4th entry, 946 946 // and store those, which are not corners of the ith subdivision polygon 947 947 // in vtp[i][6] 948 poly nwt; 948 poly nwt; 949 949 list boundaryNSD; // stores the boundary of a Newton subdivision 950 intmat zwsp[2][1]; // used for intermediate storage 950 intmat zwsp[2][1]; // used for intermediate storage 951 951 for (i=1;i<=size(vtp);i++) 952 952 { … … 954 954 nwt=vtp[i][3]; // the polynomial representing the ith part of the Newton subdivision 955 955 // store the vertices of the ith part of the Newton subdivision in the list newton 956 list newton; 956 list newton; 957 957 while (nwt!=0) 958 958 { … … 964 964 vtp[i][4]=boundaryNSD[1]; 965 965 vtp[i][5]=boundaryNSD[2]; 966 vtp[i][6]=zwsp; // the entries of the first row will denote to which vertex the ith one is connected 966 vtp[i][6]=zwsp; // the entries of the first row will denote to which vertex the ith one is connected 967 967 // and the entries of the second row will denote with which multiplicity 968 968 kill newton; // we kill the superflous list … … 984 984 kill ipairs; 985 985 } 986 // 4) Check for all pairs of verticies in the Newton diagram if they 986 // 4) Check for all pairs of verticies in the Newton diagram if they 987 987 // occur in two different parts of the Newton subdivision 988 988 int deleted; // if a pair occurs in two NSD, it can be removed from both - deleted is then set to 1 … … 991 991 d=1; // counts the inner edges 992 992 for (i=1;i<=size(pairs)-1;i++) 993 { 993 { 994 994 for (j=i+1;j<=size(pairs);j++) 995 995 { … … 998 998 deleted=0; 999 999 for (l=size(pairs[j]);l>=1 and deleted==0;l--) 1000 { 1000 { 1001 1001 if (((pairs[i][k][1]==pairs[j][l][1]) and (pairs[i][k][2]==pairs[j][l][2])) or ((pairs[i][k][1]==pairs[j][l][2]) and (pairs[i][k][2]==pairs[j][l][1]))) 1002 1002 { … … 1062 1062 for (i=1;i<=size(pairs);i++) 1063 1063 { 1064 list ubedges; // stores the unbounded edges 1064 list ubedges; // stores the unbounded edges 1065 1065 k=1; // counts the unbounded edges 1066 1066 for (j=1;j<=size(pairs[i]);j++) … … 1114 1114 gr[3]=vtp[i][6]; // to which vertices is the ith vertex of the tropical curve connected 1115 1115 gr[4]=vtp[i][7]; // the directions unbounded edges emerging from the ith vertex of the trop. curve 1116 gr[5]=vtp[i][3]; // the vertices of the boundary of the ith part of the NSD 1116 gr[5]=vtp[i][3]; // the vertices of the boundary of the ith part of the NSD 1117 1117 graph[i]=gr; 1118 1118 } … … 1149 1149 // the coordinates of the first vertex are graph[1][1],graph[1][2]; 1150 1150 graph[1][1],graph[1][2]; 1151 // the first vertex is connected to the vertices 1151 // the first vertex is connected to the vertices 1152 1152 // graph[1][3][1,1..ncols(graph[1][3])] 1153 1153 intmat M=graph[1][3]; 1154 1154 M[1,1..ncols(graph[1][3])]; 1155 // the weights of the edges to these vertices are 1155 // the weights of the edges to these vertices are 1156 1156 // graph[1][3][2,1..ncols(graph[1][3])] 1157 1157 M[2,1..ncols(graph[1][3])]; 1158 1158 // from the first vertex emerge size(graph[1][4]) unbounded edges 1159 1159 size(graph[1][4]); 1160 // the primitive integral direction vector of the first unbounded edge 1160 // the primitive integral direction vector of the first unbounded edge 1161 1161 // of the first vertex 1162 1162 graph[1][4][1][1]; 1163 1163 // the weight of the first unbounded edge of the first vertex 1164 1164 graph[1][4][1][2]; 1165 // the monomials which are part of the Newton subdivision of the first vertex 1165 // the monomials which are part of the Newton subdivision of the first vertex 1166 1166 graph[1][5]; 1167 // connecting the points in graph[size(graph)][1] we get 1167 // connecting the points in graph[size(graph)][1] we get 1168 1168 // the boundary of the Newton polytope 1169 1169 graph[size(graph)][1]; 1170 // an entry in graph[size(graph)][2] is a pair of points 1170 // an entry in graph[size(graph)][2] is a pair of points 1171 1171 // in the Newton polytope bounding an inner edge 1172 1172 graph[size(graph)][2][1]; … … 1175 1175 proc drawTropicalCurve (def f,list #) 1176 1176 "USAGE: drawTropicalCurve(f[,#]); f poly or list, # optional list 1177 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1177 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1178 1178 representing a tropical Laurent polynomial defining a tropical plane curve; 1179 1179 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve 1180 via the valuation map; 1180 via the valuation map; 1181 1181 the basering must have a global monomial ordering, two variables and up to one parameter! 1182 1182 RETURN: NONE 1183 NOTE: - the procedure produces the files /tmp/tropicalcurveNUMBER.tex and 1184 /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four digit integer; 1183 NOTE: - the procedure produces the files /tmp/tropicalcurveNUMBER.tex and 1184 /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four digit integer; 1185 1185 moreover it displays the tropical curve defined by f via kghostview; 1186 1186 if you wish to remove all these files from /tmp, call the procedure cleanTmp 1187 1187 @* - edges with multiplicity greater than one carry this multiplicity 1188 1188 @* - if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the 1189 string 'max', then it is computed w.r.t. maximum 1189 string 'max', then it is computed w.r.t. maximum 1190 1190 @* - if the last optional argument is 'onlytexfile' then only the latex file 1191 1191 is produced; this option should be used if kghostview is not installed on … … 1212 1212 if ((npars(basering)!=1) or (nvars(basering)!=2)) 1213 1213 { 1214 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1214 ERROR("The basering should have precisely one parameter and two indeterminates!"); 1215 1215 } 1216 1216 texf=texPolynomial(f); // write the polynomial over Q(t) … … 1223 1223 texf="\\mbox{\\tt The defining equation was not handed over!}"; 1224 1224 list graph=f; 1225 } 1225 } 1226 1226 else 1227 1227 { // write the tropical polynomial defined by f 1228 1228 if (size(#)==0) 1229 { 1229 { 1230 1230 texf="\\min\\{"; 1231 1231 } … … 1236 1236 for (j=1;j<=size(f);j++) 1237 1237 { 1238 texf=texf+texPolynomial(f[j]); 1238 texf=texf+texPolynomial(f[j]); 1239 1239 if (j<size(f)) 1240 1240 { … … 1245 1245 texf=texf+"\\}"; 1246 1246 } 1247 } 1247 } 1248 1248 list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f 1249 1249 } … … 1263 1263 \\addtolength{\\topmargin}{-\\headheight} 1264 1264 \\addtolength{\\topmargin}{-\\topskip} 1265 \\setlength{\\textheight}{267mm} 1265 \\setlength{\\textheight}{267mm} 1266 1266 \\addtolength{\\textheight}{\\topskip} 1267 1267 \\addtolength{\\textheight}{-\\footskip} 1268 1268 \\addtolength{\\textheight}{-30pt} 1269 \\setlength{\\oddsidemargin}{-1in} 1269 \\setlength{\\oddsidemargin}{-1in} 1270 1270 \\addtolength{\\oddsidemargin}{20mm} 1271 1271 \\setlength{\\evensidemargin}{\\oddsidemargin} 1272 \\setlength{\\textwidth}{170mm} 1272 \\setlength{\\textwidth}{170mm} 1273 1273 1274 1274 \\begin{document} 1275 1275 \\parindent0cm 1276 1276 \\begin{center} 1277 \\large\\bf The Tropicalisation of 1277 \\large\\bf The Tropicalisation of 1278 1278 1279 1279 \\bigskip … … 1299 1299 1300 1300 \\begin{center} 1301 "+texDrawNewtonSubdivision(graph,#)+" 1301 "+texDrawNewtonSubdivision(graph,#)+" 1302 1302 \\end{center} 1303 1303 \\end{document}"; … … 1306 1306 int rdnum=random(1000,9999); 1307 1307 write(":w /tmp/tropicalcurve"+string(rdnum)+".tex",TEXBILD); 1308 system("sh","cd /tmp; latex /tmp/tropicalcurve"+string(rdnum)+".tex; dvips /tmp/tropicalcurve"+string(rdnum)+".dvi -o; /bin/rm tropicalcurve"+string(rdnum)+".log; /bin/rm tropicalcurve"+string(rdnum)+".aux; /bin/rm tropicalcurve"+string(rdnum)+".ps?; /bin/rm tropicalcurve"+string(rdnum)+".dvi; kghostview tropicalcurve"+string(rdnum)+".ps &"); 1308 system("sh","cd /tmp; latex /tmp/tropicalcurve"+string(rdnum)+".tex; dvips /tmp/tropicalcurve"+string(rdnum)+".dvi -o; /bin/rm tropicalcurve"+string(rdnum)+".log; /bin/rm tropicalcurve"+string(rdnum)+".aux; /bin/rm tropicalcurve"+string(rdnum)+".ps?; /bin/rm tropicalcurve"+string(rdnum)+".dvi; kghostview tropicalcurve"+string(rdnum)+".ps &"); 1309 1309 } 1310 1310 else … … 1331 1331 proc drawNewtonSubdivision (def f,list #) 1332 1332 "USAGE: drawTropicalCurve(f[,#]); f poly, # optional list 1333 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1333 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1334 1334 representing a tropical Laurent polynomial defining a tropical plane curve; 1335 1335 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve 1336 via the valuation map; 1336 via the valuation map; 1337 1337 the basering must have a global monomial ordering, two variables and up to one parameter! 1338 1338 RETURN: NONE 1339 NOTE: - the procedure produces the files /tmp/newtonsubdivisionNUMBER.tex, 1340 and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random four digit integer; 1339 NOTE: - the procedure produces the files /tmp/newtonsubdivisionNUMBER.tex, 1340 and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random four digit integer; 1341 1341 moreover it desplays the tropical curve defined by f via kghostview; 1342 1342 if you wish to remove all these files from /tmp, call the procedure cleanTmp 1343 1343 @* if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the 1344 string 'max', then it is computed w.r.t. maximum 1344 string 'max', then it is computed w.r.t. maximum 1345 1345 @* - note that lattice points in the Newton subdivision which are black correspond to markings 1346 1346 of the marked subdivision, while lattice points in grey are not marked … … 1357 1357 { // write the tropical polynomial defined by f 1358 1358 if (size(#)==0) 1359 { 1359 { 1360 1360 texf="\\min\\{"; 1361 1361 } … … 1366 1366 for (j=1;j<=size(f);j++) 1367 1367 { 1368 texf=texf+texPolynomial(f[j]); 1368 texf=texf+texPolynomial(f[j]); 1369 1369 if (j<size(f)) 1370 1370 { … … 1375 1375 texf=texf+"\\}"; 1376 1376 } 1377 } 1377 } 1378 1378 list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f 1379 1379 } … … 1383 1383 \\parindent0cm 1384 1384 \\begin{center} 1385 \\large\\bf The Newtonsubdivison of 1385 \\large\\bf The Newtonsubdivison of 1386 1386 \\begin{displaymath} 1387 1387 f="+texf+" … … 1391 1391 1392 1392 \\begin{center} 1393 "+texDrawNewtonSubdivision(graph)+ 1393 "+texDrawNewtonSubdivision(graph)+ 1394 1394 " \\end{center} 1395 1395 … … 1397 1397 int rdnum=random(1000,9999); 1398 1398 write(":w /tmp/newtonsubdivision"+string(rdnum)+".tex",TEXBILD); 1399 system("sh","cd /tmp; latex /tmp/newtonsubdivision"+string(rdnum)+".tex; dvips /tmp/newtonsubdivision"+string(rdnum)+".dvi -o; /bin/rm newtonsubdivision"+string(rdnum)+".log; /bin/rm newtonsubdivision"+string(rdnum)+".aux; /bin/rm newtonsubdivision"+string(rdnum)+".ps?; /bin/rm newtonsubdivision"+string(rdnum)+".dvi; kghostview newtonsubdivision"+string(rdnum)+".ps &"); 1399 system("sh","cd /tmp; latex /tmp/newtonsubdivision"+string(rdnum)+".tex; dvips /tmp/newtonsubdivision"+string(rdnum)+".dvi -o; /bin/rm newtonsubdivision"+string(rdnum)+".log; /bin/rm newtonsubdivision"+string(rdnum)+".aux; /bin/rm newtonsubdivision"+string(rdnum)+".ps?; /bin/rm newtonsubdivision"+string(rdnum)+".dvi; kghostview newtonsubdivision"+string(rdnum)+".ps &"); 1400 1400 // return(TEXBILD); 1401 1401 } … … 1422 1422 proc tropicalJInvariant (def f,list #) 1423 1423 "USAGE: tropicalJInvariant(f[,#]); f poly or list, # optional list 1424 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1424 ASSUME: f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c 1425 1425 representing a tropical Laurent polynomial defining a tropical plane curve; 1426 1426 alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve 1427 via the valuation map; 1427 via the valuation map; 1428 1428 @* the basering must have a global monomial ordering, two variables and up to one parameter! 1429 1429 RETURN: number, if the graph underlying the tropical curve has precisely one loop then its weighted 1430 1430 lattice length is returned, otherwise the result will be -1 1431 NOTE: - if the tropical curve is elliptic and its embedded graph has precisely one loop, 1431 NOTE: - if the tropical curve is elliptic and its embedded graph has precisely one loop, 1432 1432 then the weigthed lattice length of the loop is its tropical j-invariant 1433 @* - the procedure checks if the embedded graph of the tropical curve has genus one, 1434 but it does NOT check if the loop can be resolved, so that the curve is not 1435 a proper tropical elliptic curve 1433 @* - the procedure checks if the embedded graph of the tropical curve has genus one, 1434 but it does NOT check if the loop can be resolved, so that the curve is not 1435 a proper tropical elliptic curve 1436 1436 @* - if the embedded graph of a tropical elliptic curve has more than one loop, then 1437 1437 all but one can be resolved, but this is not observed by this procedure, so it 1438 1438 will not compute the j-invariant 1439 1439 @* - if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the 1440 string 'max', then it is computed w.r.t. maximum 1440 string 'max', then it is computed w.r.t. maximum 1441 1441 @* - the tropicalJInvariant of a plane tropical cubic is the 'cycle length' of the 1442 cubic as introduced in the paper: 1442 cubic as introduced in the paper: 1443 1443 Erik Katz, Hannah Markwig, Thomas Markwig: The j-invariant of a cubic tropical plane curve. 1444 1444 EXAMPLE: example tropicalJInvariant; shows an example" … … 1454 1454 { 1455 1455 if (typeof(f[1])=="list") 1456 { 1456 { 1457 1457 list graph=f; 1458 1458 } … … 1466 1466 { 1467 1467 ERROR("This is no valid input."); 1468 } 1468 } 1469 1469 } 1470 1470 } … … 1494 1494 else 1495 1495 { 1496 intmat nullmat[2][1]; // used to set 1497 // 4) find a vertex which has only one bounded edge, if none exists zero is returned, 1496 intmat nullmat[2][1]; // used to set 1497 // 4) find a vertex which has only one bounded edge, if none exists zero is returned, 1498 1498 // otherwise the number of the vertex in the list graph 1499 1499 int nonloopvertex=findNonLoopVertex(graph); … … 1528 1528 intvec loop,weights; // encodes the loop and the edges 1529 1529 i=1; 1530 // start by finding some vertex which belongs to the loop 1531 while (loop==0) 1530 // start by finding some vertex which belongs to the loop 1531 while (loop==0) 1532 1532 { 1533 1533 if (ncols(graph[i][3])==1) // the graph[i][3] of a vertex in the loop has 2 columns, all others have 1 … … 1537 1537 else 1538 1538 { 1539 loop[1]=i; // a starting vertex is found 1540 loop[2]=graph[i][3][1,1]; // it is connected to the vertex with this number 1539 loop[1]=i; // a starting vertex is found 1540 loop[2]=graph[i][3][1,1]; // it is connected to the vertex with this number 1541 1541 weights[2]=graph[i][3][2,1]; // and the edge has this weight 1542 1542 } … … 1549 1549 // to which the active vertex j is connected; one is loop[k-1], i.e. the one which 1550 1550 // precedes j in the loop; we have to choose the other one 1551 if (graph[j][3][1,1]==loop[k-1]) 1551 if (graph[j][3][1,1]==loop[k-1]) 1552 1552 { 1553 1553 loop[k+1]=graph[j][3][1,2]; … … 1560 1560 } 1561 1561 j=loop[k+1]; // set loop[k+1] the new active vertex 1562 k++; 1563 } 1562 k++; 1563 } 1564 1564 // 7) compute for each edge in the loop the lattice length 1565 1565 poly xcomp,ycomp; // the x- and y-components of the vectors connecting two vertices of the loop 1566 1566 number nenner; // the product of the denominators of the x- and y-components 1567 1567 number jinvariant; // the j-invariant 1568 int eins,zwei,ggt; 1568 int eins,zwei,ggt; 1569 1569 for (i=1;i<=size(loop)-1;i++) // compute the lattice length for each edge 1570 1570 { 1571 xcomp=graph[loop[i]][1]-graph[loop[i+1]][1]; 1572 ycomp=graph[loop[i]][2]-graph[loop[i+1]][2]; 1571 xcomp=graph[loop[i]][1]-graph[loop[i+1]][1]; 1572 ycomp=graph[loop[i]][2]-graph[loop[i+1]][2]; 1573 1573 nenner=denominator(leadcoef(xcomp))*denominator(leadcoef(ycomp)); 1574 execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 1575 execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 1574 execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 1575 execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 1576 1576 ggt=gcd(eins,zwei); // the lattice length is the "gcd" of the x-component and the y-component 1577 1577 jinvariant=jinvariant+ggt/(nenner*weights[i+1]); // divided by the weight of the edge 1578 1578 } 1579 return(jinvariant); 1579 return(jinvariant); 1580 1580 } 1581 1581 } … … 1591 1591 // the curve can have arbitrary degree 1592 1592 tropicalJInvariant(t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2); 1593 // the procedure does not realise, if the embedded graph of the tropical 1593 // the procedure does not realise, if the embedded graph of the tropical 1594 1594 // curve has a loop that can be resolved 1595 1595 tropicalJInvariant(1+x+y+xy+tx2y+txy2); 1596 1596 // but it does realise, if the curve has no loop at all ... 1597 1597 tropicalJInvariant(x+y+1); 1598 // or if the embedded graph has more than one loop - even if only one 1598 // or if the embedded graph has more than one loop - even if only one 1599 1599 // cannot be resolved 1600 1600 tropicalJInvariant(1+x+y+xy+tx2y+txy2+t3x5+t3y5+tx2y2+t2xy4+t2yx4); … … 1603 1603 proc weierstrassForm (poly f,list #) 1604 1604 "USAGE: weierstrassFormOfACubic(wf[,#]); wf poly, # list 1605 ASSUME: wf is a apolynomial whose Newton polygon has precisely one interior lattice1605 ASSUME: wf is a polynomial whose Newton polygon has precisely one interior lattice 1606 1606 point, so that it defines an elliptic curve on the toric surface corresponding 1607 1607 to the Newton polygon 1608 1608 RETURN: poly, the Weierstrass normal form of the polygon 1609 NOTE: - the algorithm for the coefficients of the Weierstrass form is due to 1609 NOTE: - the algorithm for the coefficients of the Weierstrass form is due to 1610 1610 Fernando Rodriguez Villegas, villegas@math.utexas.edu 1611 1611 @* - the characteristic of the base field should not be 2 or 3 … … 1669 1669 1670 1670 proc jInvariant (poly f,list #) 1671 "USAGE: jInvariant(f[,#]); f poly, # list 1672 ASSUME: - f is a apolynomial whose Newton polygon has precisely one interior lattice1671 "USAGE: jInvariant(f[,#]); f poly, # list 1672 ASSUME: - f is a polynomial whose Newton polygon has precisely one interior lattice 1673 1673 point, so that it defines an elliptic curve on the toric surface corresponding 1674 1674 to the Newton polygon 1675 @* - it the optional argument # is present the base field should be Q(t) and 1675 @* - it the optional argument # is present the base field should be Q(t) and 1676 1676 the optional argument should be one of the following strings: 1677 1677 @* 'ord' : then the return value is of type integer, namely the order of the j-invariant … … 1704 1704 echo=2; 1705 1705 ring r=(0,t),(x,y),dp; 1706 // jInvariant computes the j-invariant of a cubic 1706 // jInvariant computes the j-invariant of a cubic 1707 1707 jInvariant(x+y+x2y+y3+1/t*xy); 1708 // if the ground field has one parameter t, then we can instead 1708 // if the ground field has one parameter t, then we can instead 1709 1709 // compute the order of the j-invariant 1710 1710 jInvariant(x+y+x2y+y3+1/t*xy,"ord"); … … 1714 1714 poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3+x14y8; 1715 1715 // its j-invariant is 1716 jInvariant(h); 1716 jInvariant(h); 1717 1717 } 1718 1718 … … 1777 1777 ring tRING=0,t,ls; 1778 1778 list pointdenom=imap(BASERING,pointdenom); 1779 list pointnum=imap(BASERING,pointnum); 1779 list pointnum=imap(BASERING,pointnum); 1780 1780 intvec pointcoordinates; 1781 1781 for (i=1;i<=size(pointdenom);i++) … … 1853 1853 We consider the concic through the following five points: 1854 1854 \\begin{displaymath} 1855 "; 1855 "; 1856 1856 string texf=texDrawTropical(graphf,list("",scalefactor)); 1857 1857 for (i=1;i<=size(points);i++) … … 1891 1891 \\end{document}"; 1892 1892 setring BASERING; 1893 // If # non-empty, compute the dual conic and the tangents through the dual points 1893 // If # non-empty, compute the dual conic and the tangents through the dual points 1894 1894 // corresponding to the tangents of the given conic. 1895 1895 if (size(#)>0) 1896 1896 { 1897 1897 list dualpoints; 1898 for (i=1;i<=size(points);i++) 1898 for (i=1;i<=size(points);i++) 1899 1899 { 1900 1900 dualpoints[i]=list(leadcoef(tangents[i])/substitute(tangents[i],x,0,y,0),leadcoef(tangents[i]-lead(tangents[i]))/substitute(tangents[i],x,0,y,0)); … … 1920 1920 // conic[2] is the equation of the conic f passing through the five points 1921 1921 conic[2]; 1922 // conic[3] is a list containing the equations of the tangents 1922 // conic[3] is a list containing the equations of the tangents 1923 1923 // through the five points 1924 1924 conic[3]; 1925 1925 // conic[4] is an ideal representing the tropicalisation of the conic f 1926 1926 conic[4]; 1927 // conic[5] is a list containing the tropicalisation 1927 // conic[5] is a list containing the tropicalisation 1928 1928 // of the five tangents in conic[3] 1929 1929 conic[5]; 1930 // conic[6] is a list containing the vertices of the tropical conic 1930 // conic[6] is a list containing the vertices of the tropical conic 1931 1931 conic[6]; 1932 1932 // conic[7] is a list containing the vertices of the five tangents 1933 1933 conic[7]; 1934 // conic[8] contains the latex code to draw the tropical conic and 1935 // its tropicalised tangents; it can written in a file, processed and 1936 // displayed via kghostview 1937 write(":w /tmp/conic.tex",conic[8]); 1938 system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi -o; 1934 // conic[8] contains the latex code to draw the tropical conic and 1935 // its tropicalised tangents; it can written in a file, processed and 1936 // displayed via kghostview 1937 write(":w /tmp/conic.tex",conic[8]); 1938 system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi -o; 1939 1939 kghostview conic.ps &"); 1940 // with an optional argument the same information for the dual conic is computed 1940 // with an optional argument the same information for the dual conic is computed 1941 1941 // and saved in conic[9] 1942 1942 conic=conicWithTangents(points,1); 1943 1943 conic[9][2]; // the equation of the dual conic 1944 1944 } 1945 1945 1946 1946 //////////////////////////////////////////////////////////////////////////////////// 1947 1947 /// Procedures concerned with tropicalisation … … 1952 1952 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 1953 1953 RETURN: list, the linear forms of the tropicalisation of f 1954 NOTE: if # is empty, then the valuation of t will be 1, 1955 @* if # is the string 'max' it will be -1; 1956 @* the latter supposes that we consider the maximum of the the computed1954 NOTE: if # is empty, then the valuation of t will be 1, 1955 @* if # is the string 'max' it will be -1; 1956 @* the latter supposes that we consider the maximum of the computed 1957 1957 linear forms, the former that we consider their minimum 1958 1958 EXAMPLE: example tropicalise; shows an example" … … 1977 1977 { 1978 1978 tropicalf[i]=tropicalf[i]+exp[j]*var(j); 1979 } 1979 } 1980 1980 f=f-lead(f); 1981 1981 } … … 2013 2013 } 2014 2014 2015 proc tInitialForm (poly f, intvec w) 2015 proc tInitialForm (poly f, intvec w) 2016 2016 "USAGE: tInitialForm(f,w); f a polynomial, w an integer vector 2017 2017 ASSUME: f is a polynomial in Q[t,x_1,...,x_n] and w=(w_0,w_1,...,w_n) … … 2026 2026 // do the same for the remaining part of f and compare the results 2027 2027 // keep only the smallest ones 2028 int vglgewicht; 2029 f=f-lead(f); 2028 int vglgewicht; 2029 f=f-lead(f); 2030 2030 while (f!=0) 2031 2031 { … … 2042 2042 initialf=initialf+lead(f); 2043 2043 } 2044 } 2044 } 2045 2045 f=f-lead(f); 2046 2046 } … … 2058 2058 } 2059 2059 2060 proc tInitialIdeal (ideal i,intvec w,list #) 2060 proc tInitialIdeal (ideal i,intvec w,list #) 2061 2061 "USAGE: tInitialIdeal(i,w); i ideal, w intvec 2062 ASSUME: i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 2062 ASSUME: i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 2063 2063 RETURN: ideal ini, the t-initial ideal of i with respect to w" 2064 2064 { … … 2087 2087 // ... and compute a standard basis with 2088 2088 // respect to the homogenised ordering defined by w. Since the generators 2089 // of i will be homogeneous it we can instead take the ordering wp 2090 // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 2091 // large M, so that all entries are positive 2089 // of i will be homogeneous it we can instead take the ordering wp 2090 // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 2091 // large M, so that all entries are positive 2092 2092 int M=-minInIntvec(w)[1]+1; // find M such that w[j]+M is strictly positive for all j 2093 2093 intvec whomog=M+1; … … 2097 2097 } 2098 2098 execute("ring WEIGHTRING=("+charstr(basering)+"),("+varstr(basering)+"),(wp("+string(whomog)+"));"); 2099 // map i to the new ring and compute a GB of i, then dehomogenise i, 2100 // so that we can be sure, that the 2099 // map i to the new ring and compute a GB of i, then dehomogenise i, 2100 // so that we can be sure, that the 2101 2101 // initial forms of the generators generate the initial ideal 2102 2102 ideal i=subst(groebner(imap(HOMOGRING,i)),@s,1); … … 2343 2343 proc texDrawBasic (list texdraw) 2344 2344 "USAGE: texDrawBasic(texdraw); list texdraw 2345 ASSUME: texdraw is a list of strings representing texdraw commands (as produced by 2345 ASSUME: texdraw is a list of strings representing texdraw commands (as produced by 2346 2346 texDrawTropical) which should be embedded into a texdraw environment 2347 2347 RETURN: string, a texdraw environment enclosing the input … … 2363 2363 \\end{texdraw}"; 2364 2364 return(texdrawtp); 2365 } 2365 } 2366 2366 example 2367 2367 { … … 2378 2378 ASSUME: graph is the output of tropicalCurve 2379 2379 RETURN: string, the texdraw code of the tropical plane curve encoded by graph 2380 NOTE: - if the list # is non-empty, the first entry should be a string; if this string is 'max', 2380 NOTE: - if the list # is non-empty, the first entry should be a string; if this string is 'max', 2381 2381 then the tropical curve is considered with respect to the maximum; otherwise the curve 2382 is considered with respect to the minimum and the string can be used to 2382 is considered with respect to the minimum and the string can be used to 2383 2383 insert further texdraw commands (e.g. to have a lighter image as when called 2384 from inside conicWithTangents); 2384 from inside conicWithTangents); 2385 2385 @* - the procedure computes a scalefactor for the texdraw command which should 2386 2386 help to display the curve in the right way; this may, however, be a bad idea … … 2392 2392 int i,j; 2393 2393 // deal first with the pathological case that the input polynomial was a monomial 2394 // and does therefore not define a tropical curve, and check if the Newton polytope is 2394 // and does therefore not define a tropical curve, and check if the Newton polytope is 2395 2395 // a line segment so that the curve defines a bunch of lines 2396 2396 int bunchoflines; … … 2414 2414 // go on with the case that a tropical curve is defined 2415 2415 if (size(#)==0) 2416 { 2416 { 2417 2417 string texdrawtp=" 2418 2418 … … 2422 2422 { 2423 2423 if ((#[1]!="max") and (#[1]!="")) 2424 { 2424 { 2425 2425 string texdrawtp=#[1]; 2426 2426 } … … 2545 2545 NOTE: - the list # should contain as only entry a string; if this string is 'max', then 2546 2546 the tropical curve is considered with respect to the maximum; otherwise the curve 2547 is considered with respect to the minimum and the string can be used to 2547 is considered with respect to the minimum and the string can be used to 2548 2548 insert further texdraw commands (e.g. to have a lighter image as when called 2549 2549 from inside conicWithTangents); the list # is optional and may as well be empty … … 2554 2554 int i,j,k,l; 2555 2555 list boundary=graph[size(graph)][1]; 2556 list inneredges=graph[size(graph)][2]; 2556 list inneredges=graph[size(graph)][2]; 2557 2557 intvec shiftvector=graph[size(graph)][3]; 2558 2558 string subdivision; … … 2566 2566 poly scalefactor=minOfPolys(list(12/leadcoef(maxx),12/leadcoef(maxy))); 2567 2567 if (scalefactor<1) 2568 { 2568 { 2569 2569 subdivision=subdivision+" 2570 2570 \\relunitscale"+ decimal(scalefactor); … … 2574 2574 { 2575 2575 subdivision=subdivision+" 2576 \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+") 2576 \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+") 2577 2577 \\lvec ("+string(boundary[i+1][1])+" "+string(boundary[i+1][2])+")"; 2578 } 2578 } 2579 2579 subdivision=subdivision+" 2580 \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+") 2580 \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+") 2581 2581 \\lvec ("+string(boundary[1][1])+" "+string(boundary[1][2])+") 2582 2582 … … 2585 2585 { 2586 2586 subdivision=subdivision+" 2587 \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+") 2587 \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+") 2588 2588 \\lvec ("+string(inneredges[i][2][1])+" "+string(inneredges[i][2][2])+")"; 2589 2589 } … … 2605 2605 } 2606 2606 } 2607 // deal with the pathological cases 2607 // deal with the pathological cases 2608 2608 if (size(boundary)==1) // then the Newton polytope is a point 2609 2609 { … … 2660 2660 { 2661 2661 subdivision=subdivision+" 2662 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 2662 \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 2663 2663 \\fcir f:0 r:"+decimal(2/(8*scalefactor),size(string(int(scalefactor)))+1); 2664 2664 } 2665 2665 // enclose subdivision in the texdraw environment 2666 string texsubdivision=" 2666 string texsubdivision=" 2667 2667 \\begin{texdraw} 2668 \\drawdim cm \\relunitscale 1 2668 \\drawdim cm \\relunitscale 1 2669 2669 \\linewd 0.05" 2670 2670 +subdivision+" … … 2680 2680 poly f=x+y+x2y+xy2+1/t*xy; 2681 2681 list graph=tropicalCurve(f); 2682 // compute the texdraw code of the Newton subdivision of the tropical curve 2682 // compute the texdraw code of the Newton subdivision of the tropical curve 2683 2683 texDrawNewtonSubdivision(graph); 2684 2684 } … … 2707 2707 markings[3*i-2]=triang[i][1]; 2708 2708 markings[3*i-1]=triang[i][2]; 2709 markings[3*i]=triang[i][3]; 2709 markings[3*i]=triang[i][3]; 2710 2710 } 2711 2711 // delete redundant pairs which occur more than once … … 2740 2740 { 2741 2741 latex=latex+" 2742 \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+") 2742 \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+") 2743 2743 \\fcir f:0 r:0.08"; 2744 2744 } … … 2747 2747 { 2748 2748 latex=latex+" 2749 \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+") 2749 \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+") 2750 2750 \\lvec ("+string(polygon[pairs[i][2]][1])+" "+string(polygon[pairs[i][2]][2])+")"; 2751 2751 } … … 2754 2754 { 2755 2755 latex=latex+" 2756 \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+") 2756 \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+") 2757 2757 \\fcir f:0.7 r:0.04"; 2758 2758 } … … 2763 2763 "EXAMPLE:"; 2764 2764 echo=2; 2765 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 2765 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 2766 2766 // with all integer points as markings 2767 2767 list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),intvec(0,0), 2768 2768 intvec(2,1),intvec(0,1),intvec(1,2),intvec(0,2),intvec(0,3); 2769 // define a triangulation by connecting the only interior point 2769 // define a triangulation by connecting the only interior point 2770 2770 // with the vertices 2771 2771 list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,2,10); … … 2775 2775 2776 2776 //////////////////////////////////////////////////////////////////////////////////// 2777 /// Auxilary Procedures 2777 /// Auxilary Procedures 2778 2778 //////////////////////////////////////////////////////////////////////////////////// 2779 2779 … … 2829 2829 // do the same for the remaining part of f and compare the results 2830 2830 // keep only the smallest ones 2831 int vglgewicht; 2832 f=f-lead(f); 2831 int vglgewicht; 2832 f=f-lead(f); 2833 2833 while (f!=0) 2834 2834 { 2835 leitkoef=simplifyToOrder(f); 2835 leitkoef=simplifyToOrder(f); 2836 2836 vglgewicht=leitkoef[1]+scalarproduct(w,leadexp(f)); 2837 2837 if (vglgewicht<gewicht) … … 2848 2848 initialf=initialf+koef*leadmonom(f); 2849 2849 } 2850 } 2850 } 2851 2851 f=f-lead(f); 2852 2852 } … … 2872 2872 // compute first the t-order of the leading coefficient of f (leitkoef[1]) and 2873 2873 // the rational constant corresponding to this order in leadkoef(f) (leitkoef[2]) 2874 list leitkoef=simplifyToOrder(f); 2874 list leitkoef=simplifyToOrder(f); 2875 2875 execute("poly koef="+leitkoef[2]+";"); 2876 2876 // take in lead(f) only the term of lowest t-order and set t=1 … … 2881 2881 // keep only the largest ones 2882 2882 int vglgewicht; 2883 f=f-lead(f); 2883 f=f-lead(f); 2884 2884 while (f!=0) 2885 2885 { … … 2899 2899 initialf=initialf+koef*leadmonom(f); 2900 2900 } 2901 } 2901 } 2902 2902 f=f-lead(f); 2903 2903 } … … 2916 2916 proc solveTInitialFormPar (ideal i) 2917 2917 "USAGE: solveTInitialFormPar(i); i ideal 2918 ASSUME: i is a zero-dimensional ideal in Q(t)[x_1,...,x_n] generated by the (1,w)-homogeneous 2918 ASSUME: i is a zero-dimensional ideal in Q(t)[x_1,...,x_n] generated by the (1,w)-homogeneous 2919 2919 elements for some integer vector w - i.e. by the (1,w)-initialforms of polynomials 2920 2920 RETURN: none … … 2941 2941 } 2942 2942 2943 proc detropicalise (poly p) 2943 proc detropicalise (poly p) 2944 2944 "USAGE: detropicalise(f); f poly 2945 2945 ASSUME: f is a linear polynomial with an arbitrary constant term and … … 2953 2953 { 2954 2954 if (leadmonom(p)!=1) 2955 { 2955 { 2956 2956 dtp=dtp*leadmonom(p)^int(leadcoef(p)); 2957 2957 } … … 3057 3057 poly f=t2x+1/t*y-1; 3058 3058 tropicalSubst(f,2,x,x+t,y,tx+y+t2); 3059 // The procedure can be used to study the effect of a transformation of 3059 // The procedure can be used to study the effect of a transformation of 3060 3060 // the form x -> x+t^b, with b a rational number, on the tropicalisation and 3061 3061 // the j-invariant of a cubic over the Puiseux series. … … 3063 3063 // - the j-invariant, and hence its valuation, does not change under the transformation 3064 3064 jInvariant(f,"ord"); 3065 // - b=3/2, then the cycle length of the tropical cubic equals -val(j-inv) 3066 list g32=tropicalSubst(f,2,x,x+t3,y,y); 3065 // - b=3/2, then the cycle length of the tropical cubic equals -val(j-inv) 3066 list g32=tropicalSubst(f,2,x,x+t3,y,y); 3067 3067 tropicalJInvariant(g32); 3068 3068 // - b=1, then it is still true, but only just ... … … 3075 3075 3076 3076 proc randomPoly (int d,int ug, int og, list #) 3077 "USAGE: randomPoly(d,ug,og[,#]); d, ug, og int, # list 3077 "USAGE: randomPoly(d,ug,og[,#]); d, ug, og int, # list 3078 3078 ASSUME: the basering has a parameter t 3079 3079 RETURN: poly, a polynomial of degree d where the coefficients are of the form t^j with 3080 3080 j a random integer between ug and og 3081 NOTE: if an optional argument # is given, then the coefficients are instead either of the 3081 NOTE: if an optional argument # is given, then the coefficients are instead either of the 3082 3082 form t^j as above or they are zero, and this is chosen randomly 3083 3083 EXAMPLE: example randomPoly; shows an example" … … 3095 3095 { 3096 3096 if (size(#)!=0) 3097 { 3097 { 3098 3098 k=random(0,1); 3099 3099 } 3100 3100 if (k==0) 3101 { 3101 { 3102 3102 j=random(ug,og); 3103 3103 randomPolynomial=randomPolynomial+t^j*m[i]; … … 3127 3127 RETURN: none" 3128 3128 { 3129 system("sh","cd /tmp; /bin/rm -f tropicalcurve*; /bin/rm -f tropicalnewtonsubdivision*"); 3129 system("sh","cd /tmp; /bin/rm -f tropicalcurve*; /bin/rm -f tropicalnewtonsubdivision*"); 3130 3130 } 3131 3131 … … 3182 3182 static proc cutdown (ideal jideal,intvec wvec,int dimension,list #) 3183 3183 "USAGE: cutdown(i,w,d); i ideal, w intvec, d int, # list 3184 ASSUME: i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical variety of jideal 3184 ASSUME: i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical variety of jideal 3185 3185 and d=dim(i)>0, in Q(t)[x]; the optional parameter # can contain the string 'isPrime' 3186 to indicate that the input ideal is prime and no minimal associated primes have 3186 to indicate that the input ideal is prime and no minimal associated primes have 3187 3187 to be computed 3188 3188 RETURN: list, the first entry is a ring, namely the basering where some variables have been … … 3195 3195 wvec with the components corresponding to the eliminated variables removed 3196 3196 NOTE: needs the libraries random.lib and primdec.lib; is called from tropicalLifting" 3197 { 3198 // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 3197 { 3198 // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 3199 3199 // forms in such a way that the resulting 3200 3200 // ideal is 0-dim and still contains w in the tropical variety 3201 // NOTE: t is the last variable in the basering 3201 // NOTE: t is the last variable in the basering 3202 3202 ideal pideal; //this is the ideal we want to return 3203 3203 ideal cutideal; … … 3219 3219 variablen=variablen+var(j1); //read the set of variables (needed to make the quotring later) 3220 3220 product=product*var(j1); //make product of all variables (needed for the initial-monomial-check later 3221 } 3221 } 3222 3222 execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;"); 3223 3223 setring BASERING; … … 3226 3226 { 3227 3227 setring QUOTRING; 3228 ideal jideal=imap(BASERING,jideal); 3229 list primp=minAssGTZ(jideal); //compute the primary decomposition 3228 ideal jideal=imap(BASERING,jideal); 3229 list primp=minAssGTZ(jideal); //compute the primary decomposition 3230 3230 for (j1=1;j1<=size(primp);j1++) 3231 { 3231 { 3232 3232 for(j2=1;j2<=size(primp[j1]);j2++) 3233 3233 { 3234 3234 primp[j1][j2]=primp[j1][j2]/content(primp[j1][j2]);// clear all denominators 3235 } 3235 } 3236 3236 } 3237 3237 setring BASERING; … … 3239 3239 // if i is not primary itself 3240 3240 // go through the list of min. ass. primes and find the first one which has w in its tropical variety 3241 if (size(primp)>1) 3241 if (size(primp)>1) 3242 3242 { 3243 3243 j1=1; … … 3246 3246 //compute the t-initial of the associated prime 3247 3247 // - the last entry 1 only means that t is the last variable in the ring 3248 primini=tInitialIdeal(primp[j1],wvec,1); 3248 primini=tInitialIdeal(primp[j1],wvec,1); 3249 3249 // check if it contains a monomial (resp if the product of var is in the radical) 3250 if (radicalMemberShip(product,primini)==0) 3251 { 3250 if (radicalMemberShip(product,primini)==0) 3251 { 3252 3252 jideal=primp[j1];// if w is in the tropical variety of the prime, we take that 3253 3253 setring QUOTRING; … … 3255 3255 setring BASERING; 3256 3256 winprim=1; // and stop the checking 3257 } 3257 } 3258 3258 j1=j1+1; //else we look at the next associated prime 3259 3259 } … … 3262 3262 { 3263 3263 jideal=primp[1]; //if i is primary itself we take its prime instead 3264 } 3264 } 3265 3265 } 3266 3266 // now we start as a first try to intersect with a hyperplane parallel to 3267 3267 // coordinate axes, because this would make our further computations 3268 // a lot easier. 3268 // a lot easier. 3269 3269 // We choose a subset of our n variables of size d=dim(ideal). For each of these 3270 3270 // variables, we want to fix a value: x_i= a_i*t^-w_i. This will only work if the … … 3275 3275 // (NOTE, there EXIST d variables such that a random choice of a_i's would work!). 3276 3276 // But since this involves many computations, we prefer to choose randomly and just 3277 // try in the end if our intersected ideal satisfies our requirements. If this does not 3277 // try in the end if our intersected ideal satisfies our requirements. If this does not 3278 3278 // work, we give up this try and use our second intersection idea, which 3279 3279 // will work for a Zariksi-open subset (i.e. almost always). … … 3282 3282 // wvec-coordinate is smallest, because this will give us the smallest powers of t and hence 3283 3283 // less effort in following computations. Note that the smallest absolute value have those 3284 // which are biggest, because wvec is negative. 3284 // which are biggest, because wvec is negative. 3285 3285 //print("first try"); 3286 3286 intvec wminust=intvecdelete(wvec,1); … … 3290 3290 A[2,1..size(wminust)]=1..size(wminust); 3291 3291 // sort this matrix in order to get the d biggest entries and their position in wvec 3292 A=sortintmat(A); 3293 // we construct a vector which has 1 at entry j if j belongs to the list 3292 A=sortintmat(A); 3293 // we construct a vector which has 1 at entry j if j belongs to the list 3294 3294 // of the d biggest entries of wvec and a 0 else 3295 3295 for (j1=1;j1<=nvars(basering)-1;j1++) //go through the variables … … 3300 3300 { 3301 3301 setvec[j1]=1;//put a 1 3302 } 3303 } 3304 } 3305 // using this 0/1-vector we produce a random constant (i.e. coeff in Q times something in t) 3302 } 3303 } 3304 } 3305 // using this 0/1-vector we produce a random constant (i.e. coeff in Q times something in t) 3306 3306 // for each of the biggest variables, we add the forms x_i-random constant to the ideal 3307 3307 // and we save the constant at the i-th place of a list we want to return for later computations … … 3315 3315 { 3316 3316 if(setvec[j1]==1)//if x_i belongs to the biggest variables 3317 { 3317 { 3318 3318 if ((j3==1) and ((char(basering)==0) or (char(basering)>3))) 3319 { 3319 { 3320 3320 randomp1=random(1,3); 3321 3321 randomp=t^(A[1,j2])*randomp1;//make a random constant --- first we try small numbers 3322 } 3322 } 3323 3323 if ((j3==2) and ((char(basering)==0) or (char(basering)>100))) 3324 3324 { 3325 3325 randomp1=random(1,100); 3326 3326 randomp=t^(A[1,j2])*randomp1;//make a random constant --- next we try bigger numbers 3327 } 3327 } 3328 3328 else 3329 3329 { … … 3337 3337 else 3338 3338 { 3339 ergl[j1]=0; //if the variable belongs not the thed biggest ones, save 0 in the list3339 ergl[j1]=0; //if the variable belongs not the d biggest ones, save 0 in the list 3340 3340 erglini[j1]=0; 3341 } 3341 } 3342 3342 } 3343 3343 // print(ergl);print(pideal); 3344 // now we check if we made a good choice of pideal, i.e. if dim=0 and 3344 // now we check if we made a good choice of pideal, i.e. if dim=0 and 3345 3345 // wvec is still in the tropical variety 3346 3346 //change to quotring where we compute dimension … … 3349 3349 { 3350 3350 if(setvec[j1]==1) 3351 { 3352 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3353 } 3351 { 3352 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3353 } 3354 3354 } 3355 3355 setring QUOTRING; … … 3369 3369 // and if the initial w.r.t. t contains no monomial as we want (checked with 3370 3370 // radical-membership of the product of all variables) 3371 if (radicalMemberShip(product,pini)==0) 3372 { 3373 // we made the right choice and now we substitute the variables in the ideal 3371 if (radicalMemberShip(product,pini)==0) 3372 { 3373 // we made the right choice and now we substitute the variables in the ideal 3374 3374 //to get an ideal in less variables 3375 3375 // also we make a projected vector from wvec only the components of the remaining variables 3376 3376 wvecp=wvec; 3377 variablen=0; 3377 variablen=0; 3378 3378 j2=0; 3379 3379 for(j1=1;j1<=nvars(basering)-1;j1++) … … 3389 3389 { 3390 3390 variablen=variablen+var(j1); //read the set of remaining variables (needed to make quotring later) 3391 } 3392 } 3391 } 3392 } 3393 3393 // return pideal, the initial and the list ergl which tells us 3394 3394 // which variables we replaced by which form … … 3400 3400 export(ini); 3401 3401 export(repl); 3402 return(list(BASERINGLESS1,wvecp)); 3402 return(list(BASERINGLESS1,wvecp)); 3403 3403 } 3404 3404 } … … 3409 3409 // probability 1. 3410 3410 // 3411 // We choose general hyperplanes, i.e. linear forms which involve all x_i. 3412 // Each x_i has to be multiplied bz t^(w_i) in order to get the same weight (namely 0) 3411 // We choose general hyperplanes, i.e. linear forms which involve all x_i. 3412 // Each x_i has to be multiplied bz t^(w_i) in order to get the same weight (namely 0) 3413 3413 // for each term. As we cannot have negative exponents, we multiply 3414 // the whole form by t^minimumw. Notice that then in the first form, 3414 // the whole form by t^minimumw. Notice that then in the first form, 3415 3415 // there is one term without t- the term of the variable 3416 3416 // x_i such that w_i is minimal. That is, we can solve for this variable. 3417 // In the second form, we can replace that variable, and divide by t as much as possible. 3418 // Then there is again one term wihtout t - the term of the variable with second least w. 3417 // In the second form, we can replace that variable, and divide by t as much as possible. 3418 // Then there is again one term wihtout t - the term of the variable with second least w. 3419 3419 // So we can solve for this one again and also replace it in the first form. 3420 // Since all our coefficients are chosen randomly, we can also from the beginning on 3421 // choose the set of variables which belong to the d smallest entries of wvec 3422 // (t not counting) and pick random forms g_i(t,x') (where x' is the set of remaining variables) 3423 // and set x_i=g_i(t,x'). 3420 // Since all our coefficients are chosen randomly, we can also from the beginning on 3421 // choose the set of variables which belong to the d smallest entries of wvec 3422 // (t not counting) and pick random forms g_i(t,x') (where x' is the set of remaining variables) 3423 // and set x_i=g_i(t,x'). 3424 3424 // 3425 3425 // make a matrix with first row wvec (without t) and second row 1..n 3426 3426 //print("second try"); 3427 3427 setring BASERING; 3428 A[1,1..size(wminust)]=wminust; 3428 A[1,1..size(wminust)]=wminust; 3429 3429 A[2,1..size(wminust)]=1..size(wminust); 3430 3430 // sort this matrix in otder to get the d smallest entries (without counting the t-entry) … … 3433 3433 setvec=0; 3434 3434 setvec[nvars(basering)-1]=0; 3435 // we construct a vector which has 1 at entry j if j belongs to the list of 3435 // we construct a vector which has 1 at entry j if j belongs to the list of 3436 3436 // the d smallest entries of wvec and a 0 else 3437 3437 for (j1=1;j1<=nvars(basering)-1;j1++) //go through the variables … … 3459 3459 variablen=variablen+var(j1); //read the set of remaining variables (needed to make the quotring later) 3460 3460 } 3461 } 3461 } 3462 3462 setring BASERING; 3463 3463 execute("ring BASERINGLESS2=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));"); 3464 3464 // using the 0/1-vector which tells us which variables belong to the set of smallest entries of wvec 3465 // we construct a set of d random linear polynomials of the form x_i=g_i(t,x'), 3465 // we construct a set of d random linear polynomials of the form x_i=g_i(t,x'), 3466 3466 // where the set of all x_i is the set of 3467 3467 // all variables which are in the list of smallest entries in wvec, and x' are the other variables. 3468 // We add these d random linear polynomials to the indeal pideal, i.e. we intersect 3468 // We add these d random linear polynomials to the indeal pideal, i.e. we intersect 3469 3469 // with these and hope to get something 3470 // 0-dim which still contains wvec in its tropical variety. Also, we produce a list ergl 3470 // 0-dim which still contains wvec in its tropical variety. Also, we produce a list ergl 3471 3471 // with g_i at the i-th position. 3472 3472 // This is a list we want to return. … … 3477 3477 { 3478 3478 if ((char(basering)==0) or (char(basering)>3)) 3479 { 3479 { 3480 3480 randomp1=random(1,3); 3481 3481 randomp=randomp1*t^(-A[1,j1]); … … 3514 3514 } 3515 3515 //print(ergl); 3516 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3516 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3517 3517 // pideal is 0-dim and contains wvec in the tropical variety. 3518 3518 cutideal=pideal; … … 3521 3521 if(setvec[j1]==1) 3522 3522 { 3523 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3524 } 3523 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3524 } 3525 3525 } 3526 3526 setring QUOTRING; … … 3540 3540 // and if the initial w.r.t. t contains no monomial as we want (checked with 3541 3541 // radical-membership of the product of all variables) 3542 if (radicalMemberShip(product,pini)==0) 3542 if (radicalMemberShip(product,pini)==0) 3543 3543 { 3544 3544 // we want to replace the variables x_i by the forms -g_i in 3545 // our ideal in order to return an ideal with less variables 3545 // our ideal in order to return an ideal with less variables 3546 3546 // first we substitute the chosen variables 3547 3547 for(j1=1;j1<=nvars(basering)-1;j1++) … … 3560 3560 export(ini); 3561 3561 export(repl); 3562 return(list(BASERINGLESS2,wvecp)); 3562 return(list(BASERINGLESS2,wvecp)); 3563 3563 } 3564 3564 } … … 3573 3573 randomp=randomp1*t^(-A[1,j1]); 3574 3574 for(j2=1;j2<=nvars(basering)-1;j2++)//go through all variables 3575 { 3575 { 3576 3576 if(setvec[j2]==0)//if x_j belongs to the set x' 3577 3577 { 3578 3578 // add a random term with the suitable power of t to the random linear form 3579 3579 if ((char(basering)==0) or (char(basering)>100)) 3580 { 3580 { 3581 3581 randomp2=random(1,100); 3582 3582 randomp1=randomp1+randomp2*var(j2); … … 3599 3599 } 3600 3600 //print(ergl); 3601 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3601 // Again, we have to test if we made a good choice to intersect,i.e. we have to check whether 3602 3602 // pideal is 0-dim and contains wvec in the tropical variety. 3603 3603 cutideal=pideal; … … 3606 3606 if(setvec[j1]==1) 3607 3607 { 3608 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3609 } 3608 cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 3609 } 3610 3610 } 3611 3611 setring QUOTRING; … … 3615 3615 //print(dimp); 3616 3616 kill cutideal; 3617 setring BASERING; 3617 setring BASERING; 3618 3618 if (dimp==0) // if it is 0 as we want 3619 3619 { … … 3625 3625 // and if the initial w.r.t. t contains no monomial as we want (checked with 3626 3626 // radical-membership of the product of all variables) 3627 if (radicalMemberShip(product,pini)==0) 3627 if (radicalMemberShip(product,pini)==0) 3628 3628 { 3629 3629 // we want to replace the variables x_i by the forms -g_i in … … 3636 3636 pideal=subst(pideal,var(j1),ergl[j1]);//substitute it 3637 3637 pini=subst(pini,var(j1),erglini[j1]); 3638 } 3639 } 3638 } 3639 } 3640 3640 // return pideal and the list ergl which tells us 3641 3641 // which variables we replaced by which form … … 3647 3647 export(ini); 3648 3648 export(repl); 3649 return(list(BASERINGLESS2,wvecp)); 3649 return(list(BASERINGLESS2,wvecp)); 3650 3650 } 3651 3651 } … … 3656 3656 static proc tropicalparametriseNoabs (ideal i,intvec ww,int ordnung,int gfanold,int nogfan,list #) 3657 3657 "USAGE: tropicalparametriseNoabs(i,tw,ord,gf,ng[,#]); i ideal, tw intvec, ord int, gf,ng int, # opt. list 3658 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], tw=(w_0,w_1,...,w_n,0,...,0) 3659 and (w_0,...,w_n,0,...,0) is in the tropical variety of i, 3660 and ord is the order up to which a point in V(i) over C((t)) lying over w shall be computed; 3658 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], tw=(w_0,w_1,...,w_n,0,...,0) 3659 and (w_0,...,w_n,0,...,0) is in the tropical variety of i, 3660 and ord is the order up to which a point in V(i) over C((t)) lying over w shall be computed; 3661 3661 - moreover, k should be zero if the procedure is not called recursively; 3662 3662 - the point in the tropical variety is supposed to lie in the NEGATIVE orthant; 3663 3663 - the ideal is zero-dimensional when considered in (Q(t)[X_1,...,X_k]/m)[x_1,...,x_n], 3664 where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 3664 where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 3665 3665 - gf is 0 if version 2.2 or larger is used and it is 1 else 3666 - ng is 1 if gfan should not be executed 3666 - ng is 1 if gfan should not be executed 3667 3667 RETURN: list, l[1] = ring Q(0,X_1,...,X_r)[[t]] 3668 3668 l[2] = int 3669 3669 l[3] = string 3670 3670 NOTE: - the procedure is also called recursively by itself, and 3671 if it is called in the first recursion, the list # is empty, 3671 if it is called in the first recursion, the list # is empty, 3672 3672 otherwise #[1] is an integer, one more than the number of true variables x_1,...,x_n, 3673 3673 and #[2] will contain the maximal ideal m in the variables X_1,...X_k … … 3739 3739 intvec tw=ww; // in case some variables are deleted, we have to store the old weight vector 3740 3740 deletedvariables[anzahlvariablen]=0; 3741 ideal I,LI; 3741 ideal I,LI; 3742 3742 i=i+m; // if a field extension was necessary, then i has to be extended by m 3743 3743 for (jj=anzahlvariablen-1;jj>=1;jj--) // the variable t is the last one !!! … … 3751 3751 if (size(LI)==0) // if no power of t is in lead(I) (where the X(i) are considered as field elements) 3752 3752 { 3753 // get rid of var(jj) 3753 // get rid of var(jj) 3754 3754 i=eliminate(I,var(jj)); 3755 3755 deletedvariables[jj]=1; … … 3775 3775 execute("ring NEURING=("+charstr(basering)+"),("+string(variablen)+"),(dp("+string(size(variablen)-1)+"),lp(1));"); 3776 3776 ideal i=imap(BASERING,i); 3777 ideal gesamt_m=imap(BASERING,gesamt_m); 3777 ideal gesamt_m=imap(BASERING,gesamt_m); 3778 3778 } 3779 3779 // now we have to compute a point ww on the tropical variety of the transformed ideal i; … … 3784 3784 def PREGFANRING=basering; 3785 3785 if (nogfan!=1) 3786 { 3786 { 3787 3787 // pass to a ring which has variables which are suitable for gfan 3788 3788 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;"); 3789 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; 3789 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; 3790 3790 phiideal[nvars(PREGFANRING)]=a; // map t to a 3791 map phi=PREGFANRING,phiideal; 3791 map phi=PREGFANRING,phiideal; 3792 3792 ideal i=phi(i); 3793 // homogenise the ideal i with the first not yet used variable in our ring, since gfan 3793 // homogenise the ideal i with the first not yet used variable in our ring, since gfan 3794 3794 // only handles homogenous ideals; in principle for this one has first to compute a 3795 // standard basis of i and homogenise that, but for the tropical variety (says Anders) 3795 // standard basis of i and homogenise that, but for the tropical variety (says Anders) 3796 3796 // it suffices to homogenise an arbitrary system of generators 3797 // i=groebner(i); 3797 // i=groebner(i); 3798 3798 i=homog(i,maxideal(1)[nvars(PREGFANRING)+1]); 3799 3799 // if gfan version >= 0.3.0 is used and the characteristic … … 3804 3804 ringvariablen=ringvariablen[1..2*nvars(PREGFANRING)+1]; 3805 3805 write(":w /tmp/gfaninput","Z/"+string(char(GFANRING))+"Z["+ringvariablen+"]"); 3806 // write the ideal to a file which gfan takes as input and call gfan 3806 // write the ideal to a file which gfan takes as input and call gfan 3807 3807 write(":a /tmp/gfaninput","{"+string(i)+"}"); 3808 3808 } 3809 else 3810 { 3811 // write the ideal to a file which gfan takes as input and call gfan 3809 else 3810 { 3811 // write the ideal to a file which gfan takes as input and call gfan 3812 3812 write(":w /tmp/gfaninput","{"+string(i)+"}"); 3813 3813 } … … 3840 3840 ~ 3841 3841 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE TROPICAL PREVARIETY 3842 // test, if wneu really is in the tropical variety 3842 // test, if wneu really is in the tropical variety 3843 3843 while (goon==0) 3844 3844 { … … 3873 3873 // if all variables were deleted, then i=0 and thus anzahlvariablen==0 3874 3874 if ((ordnung>1) and (anzahlvariablen>1)) 3875 { 3875 { 3876 3876 // we call the procedure with the transformed ideal i, the new weight vector, with the 3877 3877 // required order lowered by one, and with additional parameters, namely the number of … … 3884 3884 string PARAm=PARALIST[3]; 3885 3885 setring PARARing; 3886 // if some variables have been eliminated in before, then we have to insert zeros 3886 // if some variables have been eliminated in before, then we have to insert zeros 3887 3887 // into the parametrisation for those variables 3888 3888 if (numberdeletedvariables>0) … … 3912 3912 int tweight=-tw[1]; 3913 3913 // if additional variables were necessary, we introduce them now as parameters; 3914 // in any case the parametrisation ring will have only one variable, namely t, 3914 // in any case the parametrisation ring will have only one variable, namely t, 3915 3915 // and its order will be local, so that it displays the lowest term in t first 3916 3916 if (anzahlvariablen+numberdeletedvariables<nvars(basering)) … … 3933 3933 list a=imap(BASERING,a); 3934 3934 if (defined(wneu)==0) // when tropicalparametriseNoabs is called for the last time, it does not 3935 { // enter the part, where wneu is defined and the variable t should have 3935 { // enter the part, where wneu is defined and the variable t should have 3936 3936 intvec wneu=-1; // weight -1 3937 3937 } … … 3945 3945 // note, if all variables were deleted, then i==0 and thus testaufnull==0 3946 3946 if ((ordnung==1) or (anzahlvariablen==1)) 3947 { 3947 { 3948 3948 export(PARA); 3949 3949 } 3950 3950 // kill the gfan files in /tmp 3951 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 3951 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 3952 3952 // we return a list which contains the parametrisation ring (with the parametrisation ideal) 3953 3953 // and the string representing the maximal ideal describing the necessary field extension … … 3957 3957 static proc findzeros (ideal i,intvec w,list #) 3958 3958 "USAGE: findzeros(i,w[,#]); i ideal, w intvec, # an optional list 3959 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and w=(w_0,...,w_n,0,...,0) 3959 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and w=(w_0,...,w_n,0,...,0) 3960 3960 is in the tropical variety of i 3961 RETURN: list, l[1] = is polynomial ring containing an associated maximal ideal m of the w-initial 3961 RETURN: list, l[1] = is polynomial ring containing an associated maximal ideal m of the w-initial 3962 3962 ideal of i which does not contain any monomial and where the variables 3963 3963 which do not lead to a field extension have already been eliminated, … … 3969 3969 been eliminated 3970 3970 NOTE: the procedure is called from inside the recursive procedure tropicalparametriseNoabs; 3971 if it is called in the first recursion, the list #[1] contains the t-initial ideal 3972 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 3971 if it is called in the first recursion, the list #[1] contains the t-initial ideal 3972 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 3973 3973 variables x_1,...,x_n" 3974 3974 { 3975 def BASERING=basering; 3975 def BASERING=basering; 3976 3976 // set anzahlvariablen to the number of true variables 3977 3977 if (typeof(#[1])=="int") … … 3990 3990 ideal variablen; 3991 3991 for (int j=1;j<=nvars(basering)-1;j++) 3992 { 3992 { 3993 3993 variablen=variablen+var(j); 3994 3994 } … … 4002 4002 intvec neuevariablen=maximalideals[1][3]; // the information which variable leads to a new one 4003 4003 list a=maximalideals[1][4]; // a_k is the kth component of a zero of m, if it is not zero 4004 // eliminate from m the superflous variables, that is those ones, which do not lead to 4004 // eliminate from m the superflous variables, that is those ones, which do not lead to 4005 4005 // a new variable 4006 4006 poly elimvars=1; … … 4012 4012 } 4013 4013 } 4014 m=eliminate(m,elimvars); 4015 export(a); 4014 m=eliminate(m,elimvars); 4015 export(a); 4016 4016 export(m); 4017 4017 list m_ring=INITIALRING,neuvar,neuevariablen; … … 4023 4023 static proc basictransformideal (ideal i,intvec w,list m_ring,list #) 4024 4024 "USAGE: basictransformideal(i,w,m_ring[,#]); i ideal, w intvec, m_ring list, # an optional list 4025 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], w=(w_0,...,w_n,0,...,0) 4025 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], w=(w_0,...,w_n,0,...,0) 4026 4026 is in the tropical variety of i, and m_ring contains a ring containing a maximal ideal m needed 4027 4027 to describe the field extension over which a corresponding associated maximal ideal of the … … 4034 4034 or l[1] = ring which contains the ideals i and m, and the list a 4035 4035 NOTE: the procedure is called from inside the recursive procedure tropicalparametriseNoabs; 4036 if it is called in the first recursion, the list # is empty, 4036 if it is called in the first recursion, the list # is empty, 4037 4037 otherwise #[1] is an integer, the number of true variables x_1,...,x_n; 4038 4038 during the procedure we check if a field extension is necessary to express 4039 4039 a zero (a_1,...,a_n) of m; if so, we have to introduce new variables and 4040 4040 a list containing a ring is returned, otherwise the list containing i, a and m 4041 is returned; 4041 is returned; 4042 4042 the ideal m will be changed during the procedure since all variables which reduce 4043 4043 to a polynomial in X_1,...,X_k modulo m will be eliminated, while the others are … … 4083 4083 // map i into the new ring 4084 4084 ideal i=imap(BASERING,i); 4085 // define a map phi which maps the true variables, which are not 4085 // define a map phi which maps the true variables, which are not 4086 4086 // reduced to polynomials in the additional variables modulo m, to 4087 // the corresponding newly introduced variables, and which maps 4087 // the corresponding newly introduced variables, and which maps 4088 4088 // the old additional variables to themselves 4089 4089 ideal phiideal; … … 4098 4098 else 4099 4099 { 4100 phiideal[j-1]=0; 4100 phiideal[j-1]=0; 4101 4101 } 4102 4102 } … … 4105 4105 phiideal=phiideal,X(1..nvars(BASERING)-anzahlvariablen); 4106 4106 } 4107 map phi=MRING,phiideal; 4107 map phi=MRING,phiideal; 4108 4108 // map m and a to the new ring via phi, so that the true variables in m and a are replaced by 4109 4109 // the corresponding newly introduced variables … … 4115 4115 // moreover, substitute right away in the ideal i the true variable x_j by (a_j+x_j)*t^w_j 4116 4116 zaehler=nvars(BASERING)-anzahlvariablen+1; 4117 for (j=1;j<=anzahlvariablen;j++) 4117 for (j=1;j<=anzahlvariablen;j++) 4118 4118 { 4119 4119 if ((a[j]==0) and (j!=1)) // a[1]=0, since t->t^w_0 4120 { 4120 { 4121 4121 a[j]=X(zaehler); 4122 4122 zaehler++; … … 4125 4125 { 4126 4126 if (j!=1) // corresponds to x_(j-1) -- note t is the last variable 4127 { 4127 { 4128 4128 i[k]=substitute(i[k],var(j-1),(a[j]+var(j-1))*t^(-w[j])); 4129 4129 } … … 4138 4138 { 4139 4139 if (wdegs[j]<0) // if wdegs[j]==0 there is no need to divide, and we made sure that it is no positive 4140 { 4140 { 4141 4141 i[j]=i[j]/t^(-wdegs[j]); 4142 4142 } … … 4164 4164 static proc testw (ideal i,intvec w,int anzahlvariablen,list #) 4165 4165 "USAGE: testw(i,w,n); i ideal, w intvec, n number 4166 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and w=(w_0,...,w_n,0,...,0) 4166 ASSUME: i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and w=(w_0,...,w_n,0,...,0) 4167 4167 RETURN: int b, 0 if the t-initial ideal of i considered in Q(X_1,...,X_k)[t,x_1,...,x_n] 4168 4168 is monomial free, 1 else … … 4179 4179 ideal tin=tInitialIdeal(i,w,1); 4180 4180 } 4181 4181 4182 4182 int j; 4183 4183 ideal variablen; … … 4211 4211 def BASERING=basering; 4212 4212 if (anzahlvariablen<nvars(basering)) 4213 { 4213 { 4214 4214 execute("ring TINRING=("+charstr(basering)+","+string(Parameter)+"),("+string(variablen)+"),dp;"); 4215 4215 } … … 4221 4221 poly monom=imap(BASERING,monom); 4222 4222 return(radicalMemberShip(monom,tin)); 4223 } 4223 } 4224 4224 4225 4225 static proc simplifyToOrder (poly f) 4226 4226 "USAGE: simplifyToOrder(f); f a polynomial 4227 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 4227 ASSUME: f is a polynomial in Q(t)[x_1,...,x_n] 4228 4228 RETURN: list, l[1] = t-order of leading term of f 4229 4229 l[2] = the rational coefficient of the term of lowest t-order … … 4246 4246 static proc scalarproduct (intvec w,intvec v) 4247 4247 "USAGE: scalarproduct(w,v); w,v intvec 4248 ASSUME: w and v are integer vectors of the same length 4248 ASSUME: w and v are integer vectors of the same length 4249 4249 RETURN: int, the scalarproduct of v and w 4250 4250 NOTE: the procedure is called by tropicalparametriseNoabs" … … 4304 4304 l[j][3] = intvec, if for the kth variable a new variable is needed to 4305 4305 define the corresponding zero of l[j][1], then the k+1st entry is one 4306 l[j][4] = list, if for the kth variable no new variable is needed to 4306 l[j][4] = list, if for the kth variable no new variable is needed to 4307 4307 define the corresponding zero of l[j][1], then its value is the k+1st entry 4308 4308 NOTE: if a maximal ideal contains a variable, it is removed from the list; … … 4320 4320 intvec testvariablen; // integer vector of length n=number of variables 4321 4321 // compute for each maximal ideal the number of new variables, which are needed to describe 4322 // its zeros -- note, a new variable is needed if modulo the maximal ideal it does not reduce 4322 // its zeros -- note, a new variable is needed if modulo the maximal ideal it does not reduce 4323 4323 // to something which only depends on the following variables; 4324 // if no new variable is needed, then store the value a variable reduces to in the list a; 4324 // if no new variable is needed, then store the value a variable reduces to in the list a; 4325 4325 for (j=size(minassi);j>=1;j--) 4326 4326 { … … 4341 4341 { 4342 4342 if (l<=k) 4343 { 4343 { 4344 4344 testvariablen[l]=1; 4345 4345 } … … 4357 4357 a[k+1]=nf; // a_k is the normal form of the kth variable modulo m 4358 4358 neuevariablen[k+1]=0; // no new variable is needed 4359 } 4359 } 4360 4360 else 4361 4361 { … … 4367 4367 // if the maximal ideal contains a variable, we simply delete it 4368 4368 if (pruefer==0) 4369 { 4369 { 4370 4370 minassisort[j]=list(minassi[j],neuvar,neuevariablen,a); 4371 4371 } … … 4384 4384 l=j; 4385 4385 for (k=j-1;k>=1;k--) 4386 { 4386 { 4387 4387 if (minassisort[l][2]<minassisort[k][2]) 4388 4388 { … … 4400 4400 "USAGE: displaypoly(p,N,wj,w1); p poly, N, wj, w1 int 4401 4401 ASSUME: p is a polynomial in r=(0,X(1..k)),t,ls 4402 RETURN: string, the string of t^-wj/w1*p(t^1/N) 4402 RETURN: string, the string of t^-wj/w1*p(t^1/N) 4403 4403 NOTE: the procedure is called from displayTropicalLifting" 4404 4404 { … … 4418 4418 { 4419 4419 if (koeffizienten[j-ord(p)+1]!=0) 4420 { 4420 { 4421 4421 if ((j-(N*wj)/w1)==0) 4422 4422 { … … 4534 4534 "USAGE: tropicalliftingresubstitute(i,L,N[,#]); i ideal, L list, N int, # string 4535 4535 ASSUME: i is an ideal and L[1] is a ring which contains the lifting of a point in the 4536 tropical variety of i computed with tropicalLifting; 4537 t has to be replaced by t^1/N in the lifting; #[1]=m is the string of the maximal 4536 tropical variety of i computed with tropicalLifting; 4537 t has to be replaced by t^1/N in the lifting; #[1]=m is the string of the maximal 4538 4538 ideal defining the necessary field extension as computed by tropicalLifting, 4539 4539 if #[1] is present … … 4559 4559 ideal i=imap(BASERING,i); 4560 4560 } 4561 } 4561 } 4562 4562 else 4563 4563 { … … 4588 4588 for (j=1;j<=ncols(i);j++) 4589 4589 { 4590 SUBSTTEST[j]=displaypoly(i[j],N,0,1); 4590 SUBSTTEST[j]=displaypoly(i[j],N,0,1); 4591 4591 } 4592 4592 return(SUBSTTEST); … … 4598 4598 /// - eliminatecomponents 4599 4599 /// - findzerosAndBasictransform 4600 /// - ordermaximalideals 4600 /// - ordermaximalideals 4601 4601 //////////////////////////////////////////////////////////////////////////////////// 4602 4602 4603 4603 static proc tropicalparametrise (ideal i,intvec ww,int ordnung,int gfanold,int findall,int nogfan,list #) 4604 4604 "USAGE: tropicalparametrise(i,tw,ord,gf,fa,ng[,#]); i ideal, tw intvec, ord int, gf,fa,ng int, # opt. list 4605 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 4606 and (w_0,...,w_n,0) is in the tropical variety of i, 4607 and ord is the order up to which a point in V(i) over K{{t}} lying over w shall be computed; 4605 ASSUME: - i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 4606 and (w_0,...,w_n,0) is in the tropical variety of i, 4607 and ord is the order up to which a point in V(i) over K{{t}} lying over w shall be computed; 4608 4608 - moreover, @a should be not be there if the procedure is not called recursively; 4609 4609 - the point in the tropical variety is supposed to lie in the NEGATIVE orthant; 4610 4610 - the ideal is zero-dimensional when considered in (K(t)[@a]/m)[x_1,...,x_n], 4611 where m=#[2] is a maximal ideal in K[@a]; 4611 where m=#[2] is a maximal ideal in K[@a]; 4612 4612 - gf is 0 if version 2.2 or larger is used and it is 1 else 4613 4613 - fa is 1 if all solutions should be found … … 4616 4616 l[2] = int 4617 4617 NOTE: - the procedure is also called recursively by itself, and 4618 if it is called in the first recursion, the list # is empty, 4618 if it is called in the first recursion, the list # is empty, 4619 4619 otherwise #[1] is an integer, one more than the number of true variables x_1,...,x_n, 4620 4620 and #[2] will contain the maximal ideal m in the variable @a … … 4651 4651 int anzahlvariablen=nvars(basering); 4652 4652 list zerolist; // will carry the zeros which are computed in the recursion steps 4653 4653 4654 4654 // the initial ideal of i has been handed over as #[1] 4655 4655 ideal ini=#[1]; … … 4660 4660 } 4661 4661 list wneulist; // carries all newly computed weight vector 4662 intvec wneu; // carries the newly computed weight vector 4662 intvec wneu; // carries the newly computed weight vector 4663 4663 int tweight; // carries the weight of t 4664 4664 list PARALIST; // carries the result when tropicalparametrise is recursively called … … 4695 4695 { 4696 4696 if (nogfan!=1) 4697 { 4697 { 4698 4698 // pass to a ring which has variables which are suitable for gfan 4699 4699 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;"); 4700 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; 4700 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; 4701 4701 phiideal[nvars(PREGFANRING)]=a; // map t to a 4702 map phi=PREGFANRING,phiideal; 4702 map phi=PREGFANRING,phiideal; 4703 4703 ideal II=phi(i); 4704 // homogenise the ideal II with the first not yet used variable in our ring, since gfan 4704 // homogenise the ideal II with the first not yet used variable in our ring, since gfan 4705 4705 // only handles homogenous ideals; in principle for this one has first to compute a 4706 // standard basis of II and homogenise that, but for the tropical variety (says Anders) 4706 // standard basis of II and homogenise that, but for the tropical variety (says Anders) 4707 4707 // it suffices to homogenise an arbitrary system of generators 4708 // II=groebner(II); 4708 // II=groebner(II); 4709 4709 II=homog(II,maxideal(1)[nvars(PREGFANRING)+1]); 4710 4710 // if gfan version >= 0.3.0 is used and the characteristic … … 4751 4751 ~ 4752 4752 // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE TROPICAL PREVARIETY 4753 // test, if wneu really is in the tropical variety 4753 // test, if wneu really is in the tropical variety 4754 4754 while (goon==0) 4755 4755 { … … 4796 4796 lll=0; 4797 4797 if ((ordnung>1) and (anzahlvariablen>1)) 4798 { 4798 { 4799 4799 partliftings=list(); // initialise partliftings 4800 4800 // we call the procedure with the transformed ideal i, the new weight vector, with the … … 4808 4808 // the maximal ideal that describes the necessary field extension 4809 4809 for (ll=1;ll<=size(PARALIST);ll++) 4810 { 4810 { 4811 4811 def PARARing=PARALIST[ll][1]; 4812 4812 tweight=-ww[1]*PARALIST[ll][2]; 4813 4813 setring PARARing; 4814 // if some variables have been eliminated in before, then we have to insert zeros 4814 // if some variables have been eliminated in before, then we have to insert zeros 4815 4815 // into the parametrisation for those variables 4816 4816 if (numberdeletedvariables>0) … … 4844 4844 tweight=-ww[1]; 4845 4845 // if additional variables were necessary, we introduce them now as parameters; 4846 // in any case the parametrisation ring will have only one variable, namely t, 4846 // in any case the parametrisation ring will have only one variable, namely t, 4847 4847 // and its order will be local, so that it displays the lowest term in t first 4848 4848 if (anzahlvariablen<nvars(basering)) … … 4872 4872 { 4873 4873 if (size(partliftings[lll])==2) // when tropicalparametrise is called for the last time, it does not 4874 { // enter the part, where wneu is defined and the variable t should have 4874 { // enter the part, where wneu is defined and the variable t should have 4875 4875 wneu=-1; // weight -1 4876 4876 } … … 4904 4904 } 4905 4905 // kill the gfan files in /tmp 4906 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 4906 system("sh","cd /tmp; /bin/rm gfaninput; /bin/rm gfanoutput"); 4907 4907 // we return a list which contains lists of the parametrisation rings (with the parametrisation ideal) 4908 4908 // and an integer N such that t should be replaced by t^1/N … … 4912 4912 static proc eliminatecomponents (ideal i,ideal m,int anzahlvariablen,int findall,int lastvar,intvec deletedvariables) 4913 4913 "USAGE: eliminatecomponents(i,m,n,a,v,d); i,m ideal, n,a,v int, d intvec 4914 ASSUME: i is an ideal in Q[x_1,...,x_n,@a,t] and w=(-w_1/w_0,...,-w_n/w_0) 4915 is in the tropical variety of i considered in Q[@a]/m{{t}}[x_1,...,x_n]; 4916 considered in this ring i is zero-dimensional; @a need not be present 4914 ASSUME: i is an ideal in Q[x_1,...,x_n,@a,t] and w=(-w_1/w_0,...,-w_n/w_0) 4915 is in the tropical variety of i considered in Q[@a]/m{{t}}[x_1,...,x_n]; 4916 considered in this ring i is zero-dimensional; @a need not be present 4917 4917 in which case m is zero; 1<=v<=n 4918 4918 RETURN: list, L of lists … … 4922 4922 NOTE: - the procedure is called from inside the recursive procedure tropicalparametrise 4923 4923 - the procedure checks for solutions which have certain components zero; these are 4924 separated from the rest by elimination and saturation; the integer deletedvariables 4924 separated from the rest by elimination and saturation; the integer deletedvariables 4925 4925 records which variables have been eliminated; the integer anzahlvariablen records how 4926 4926 many true variables remain after the elimination … … 4933 4933 // if all solutions have to be found 4934 4934 if (findall==1) 4935 { 4935 { 4936 4936 list saturatelist,eliminatelist; // carry the solution of the two tests 4937 // we test first if there is a solution which has the component lastvar zero and 4937 // we test first if there is a solution which has the component lastvar zero and 4938 4938 // where the order of each component is strictly positive; 4939 4939 // if so, we add this variable to the ideal and eliminate it - which amounts to 4940 4940 // to projecting the solutions with this component zero to the hyperplane without this component; 4941 4941 // for the test we compute the saturation with respect to t and replace each variable 4942 // x_i and also t by zero -- if the result is zero, then 1 is not in I:t^infty 4942 // x_i and also t by zero -- if the result is zero, then 1 is not in I:t^infty 4943 4943 // (i.e. there is a solution which has the component lastvar zero) and 4944 // the result lives in the maximal ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 4944 // the result lives in the maximal ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 4945 4945 // there is a solution which has strictly positive valuation 4946 4946 /* … … 4954 4954 // equal to zero then this component has a valuation with all strictly positive values!!!!; 4955 4955 // for this we can either saturate the ideal after elimination with respect to <t,x_1,...,x_n> 4956 // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 4956 // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 4957 4957 // or ALTERNATIVELY we can pass to the ring 0,(t,x_1,...,x_n,@a),(ds(n+1),dp(1)), 4958 4958 // compute a standard basis of the elimination ideal (plus m) there and check if the dimension 1 … … 4989 4989 { 4990 4990 string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(simplify(reduce(maxideal(1),std(var(lastvar))),2))+"),("; 4991 } 4991 } 4992 4992 if (anzahlvariablen<nvars(basering)) // if @a was present, the ordersting needs an additional entry 4993 4993 { … … 4995 4995 } 4996 4996 elring=elring+"lp(1));"; 4997 execute(elring); 4997 execute(elring); 4998 4998 ideal i=imap(BASERING,I); // move the ideal I to the new ring 4999 4999 // if not yet all variables have been checked, then go on with the next smaller variable, … … 5011 5011 } 5012 5012 // next we have to test if there is also a solution which has the variable lastvar non-zero; 5013 // to do so, we saturate with respect to this variable; since when considered over K{{t}} 5013 // to do so, we saturate with respect to this variable; since when considered over K{{t}} 5014 5014 // the ideal is zero dimensional, this really removes all solutions with that component zero; 5015 5015 // the checking is then done as above 5016 5016 i=std(sat(i,var(lastvar))[1]); 5017 5017 I=reduce(i,std(m)); // "remove" m from i 5018 // test first, if i still is in the ideal <t,x_1,...,x_n> -- if not, then 5018 // test first, if i still is in the ideal <t,x_1,...,x_n> -- if not, then 5019 5019 // we know that i has no longer a point in the tropical variety with all components negative 5020 5020 LI=subst(I,var(nvars(basering)),0); … … 5024 5024 } 5025 5025 if (size(LI)==0) // the entries of i have not constant part 5026 { 5026 { 5027 5027 // check now, if the leading ideal of i contains an element which only depends on t 5028 5028 LI=lead(I); … … 5040 5040 } 5041 5041 else 5042 { 5042 { 5043 5043 execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");"); 5044 5044 ideal i=imap(BASERING,i); … … 5069 5069 if (size(LI)==0) // if no power of t is in lead(I) (where the X(i) are considered as field elements) 5070 5070 { 5071 // get rid of var(j) 5071 // get rid of var(j) 5072 5072 i=eliminate(I,var(j)); 5073 5073 deletedvariables[j]=1; … … 5086 5086 } 5087 5087 // if there are variables left, then pass to a ring which only realises these variables 5088 // else we are done 5088 // else we are done 5089 5089 if (anzahlvariablen>1) 5090 5090 { … … 5094 5094 { 5095 5095 string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(variablen)+"),("; 5096 } 5096 } 5097 5097 if (size(deletedvariables)+1<nvars(basering)) // if @a was present, the ordersting needs an additional entry 5098 5098 { … … 5100 5100 } 5101 5101 elring=elring+"lp(1));"; 5102 execute(elring); 5102 execute(elring); 5103 5103 ideal i=imap(BASERING,i); 5104 5104 ideal m=imap(BASERING,m); … … 5111 5111 static proc findzerosAndBasictransform (ideal i,intvec w,list zerolist,int findall,list #) 5112 5112 "USAGE: findzerosAndBasictransform(i,w,z,f[,#]); i ideal, w intvec, z list, f int,# an optional list 5113 ASSUME: i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 5113 ASSUME: i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 5114 5114 is in the tropical variety of i; @a need not be present; 5115 5115 the list 'zero' contains the zeros computed in previous recursion steps; … … 5125 5125 list zero = zero[k+1] is the kth component of a zero the t-initial ideal of i 5126 5126 NOTE: - the procedure is called from inside the recursive procedure tropicalparametrise; 5127 if it is called in the first recursion, the list #[1] contains the t-initial ideal 5128 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 5127 if it is called in the first recursion, the list #[1] contains the t-initial ideal 5128 of i w.r.t. w, otherwise #[1] is an integer, one more than the number of true 5129 5129 variables x_1,...,x_n 5130 5130 - if #[2] is present, then it is an integer which tells whether ALL zeros should be … … 5154 5154 int anzahlvariablen=nvars(basering); 5155 5155 ideal ini=#[1]; // the t-initial ideal has been computed in before and was handed over 5156 } 5156 } 5157 5157 // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING 5158 5158 ideal variablen; 5159 5159 for (j=1;j<=nvars(basering)-1;j++) 5160 { 5160 { 5161 5161 variablen=variablen+var(j); 5162 5162 } … … 5187 5187 // phi maps x_i to x_i, @a to @a (if present in the ring), and the additional variable 5188 5188 // for the field extension is mapped to @a as well -- note that we only apply phi 5189 // to the list a, and in this list no @a is present; therefore, it does not matter 5189 // to the list a, and in this list no @a is present; therefore, it does not matter 5190 5190 // where this is mapped to 5191 5191 map phi=ABSRING,imap(BASERING,variablen),@a; … … 5197 5197 // for the field extension is mapped to @a as well respectively to 0, if no @a is present; 5198 5198 // note that we only apply phi to the list a and to the replacement rule for 5199 // the old variable @a, and in this list resp. replacement rule no @a is present; 5199 // the old variable @a, and in this list resp. replacement rule no @a is present; 5200 5200 // therefore, it does not matter where this is mapped to; 5201 5201 if (anzahlvariablen<nvars(EXTENSIONRING)) // @a is in EXTENSIONRING 5202 { 5202 { 5203 5203 map phi=ABSRING,imap(BASERING,variablen),@a; // additional variable is mapped to @a 5204 5204 } … … 5212 5212 poly m=maximalideals[j][1]; // extract m 5213 5213 list zeroneu=maximalideals[j][2]; // extract the new zero 5214 poly repl=maximalideals[j][3]; // extract the replacement rule 5214 poly repl=maximalideals[j][3]; // extract the replacement rule 5215 5215 // the list zero may very well exist as an EMPTY global list - in this case we have to remove it 5216 5216 // in order to avoid a redefining warning 5217 if (defined(zero)!=0) 5217 if (defined(zero)!=0) 5218 5218 { 5219 5219 if (size(zero)==0) … … 5227 5227 ideal i=imap(BASERING,i); 5228 5228 if (defined(zerolist)==0) // if zerolist is empty, it does not depend on BASERING ! 5229 { 5229 { 5230 5230 list zero=imap(BASERING,zerolist); 5231 5231 } 5232 else 5232 else 5233 5233 { 5234 5234 list zero=zerolist; 5235 5235 } 5236 5236 } 5237 else // in BASERING was @a present 5237 else // in BASERING was @a present 5238 5238 { 5239 5239 ideal variablen=imap(BASERING,variablen); … … 5247 5247 zero[size(zero)+1]=zeroneu; 5248 5248 // do now the basic transformation sending x_l -> t^-w_l*(zero_l+x_l) 5249 for (l=1;l<=anzahlvariablen;l++) 5249 for (l=1;l<=anzahlvariablen;l++) 5250 5250 { 5251 5251 for (k=1;k<=size(i);k++) 5252 5252 { 5253 5253 if (l!=1) // corresponds to x_(l-1) -- note t is the last variable 5254 { 5254 { 5255 5255 i[k]=substitute(i[k],var(l-1),(zeroneu[l]+var(l-1))*t^(-w[l])); 5256 5256 } … … 5265 5265 { 5266 5266 if (wdegs[l]<0) // if wdegs[l]==0 there is no need to divide, and we made sure that it is no positive 5267 { 5267 { 5268 5268 i[l]=i[l]/t^(-wdegs[l]); 5269 5269 } … … 5276 5276 export(i); 5277 5277 export(m); 5278 export(zero); 5278 export(zero); 5279 5279 extensionringlist[j]=EXTENSIONRING; 5280 5280 kill EXTENSIONRING; … … 5290 5290 polynomial of the last variable in the ring which is considered as a parameter 5291 5291 RETURN: list, the procedure orders the maximal ideals in minassi according to how many new 5292 variables are needed (namely none or one) to describe the zeros of the ideal, 5292 variables are needed (namely none or one) to describe the zeros of the ideal, 5293 5293 and accordingly to the degree of the corresponding minimal polynomial 5294 5294 l[j][1] = the minimal polynomial for the jth maximal ideal 5295 l[j][2] = list, the k+1st entry is the kth coordinate of the zero 5295 l[j][2] = list, the k+1st entry is the kth coordinate of the zero 5296 5296 described by the maximal ideal in terms of the last variable 5297 l[j][3] = poly, the replacement for the old variable @a 5297 l[j][3] = poly, the replacement for the old variable @a 5298 5298 NOTE: if a maximal ideal contains a variable, it is removed from the list; 5299 5299 the procedure is called by findzerosAndBasictransform" … … 5306 5306 list zero; // (a_1,...,a_n)=(zero[2],...,zero[n+1]) will be a common zero of the ideal m 5307 5307 poly nf; // normalform of a variable w.r.t. m 5308 poly minimalpolynomial; // minimal polynomial for the field extension 5308 poly minimalpolynomial; // minimal polynomial for the field extension 5309 5309 poly parrep; // the old variable @a possibly has to be replaced by a new one 5310 5310 // compute for each maximal ideal the number of new variables, which are needed to describe 5311 5311 // its zeros -- note, a new variable is needed if the first entry of minassi[j][1] is not the last variable 5312 // store the value a variable reduces to in the list a; 5312 // store the value a variable reduces to in the list a; 5313 5313 for (j=size(minassi);j>=1;j--) 5314 5314 { … … 5337 5337 // if the maximal ideal contains a variable, we simply delete it 5338 5338 if (pruefer==0) 5339 { 5339 { 5340 5340 minassisort[j]=list(minimalpolynomial,zero,parrep); 5341 5341 } … … 5354 5354 l=j; 5355 5355 for (k=j-1;k>=1;k--) 5356 { 5356 { 5357 5357 if (deg(minassisort[l][1])<deg(minassisort[k][1])) 5358 5358 { … … 5393 5393 l[i][2] = y-coordinate of the ith vertex 5394 5394 l[i][3] = a polynomial whose monimials mark the vertices in the Newton polygon 5395 corresponding to the entries in tp which take the common minimum 5395 corresponding to the entries in tp which take the common minimum 5396 5396 at the ith vertex 5397 NOTE: - the information in l[i][3] represents the subdivision of the Newton polygon of tp 5398 (respectively a polynomial which defines tp); 5399 - if # is non-empty and #[1] is the string 'max', then in the computations minimum and 5400 maximum are exchanged; 5401 - if # is non-empty and the #[1] is not a string, only the vertices will be computed 5397 NOTE: - the information in l[i][3] represents the subdivision of the Newton polygon of tp 5398 (respectively a polynomial which defines tp); 5399 - if # is non-empty and #[1] is the string 'max', then in the computations minimum and 5400 maximum are exchanged; 5401 - if # is non-empty and the #[1] is not a string, only the vertices will be computed 5402 5402 and the information on the Newton subdivision will be omitted; 5403 5403 - here the tropical polynomial is supposed to be the MINIMUM of the linear forms in tp, … … 5406 5406 { 5407 5407 // if you insert a single polynomial instead of an ideal representing a tropicalised polynomial, 5408 // then we compute first the tropicalisation of this polynomial -- this feature is not 5408 // then we compute first the tropicalisation of this polynomial -- this feature is not 5409 5409 // documented in the above help string 5410 5410 if (typeof(tp)=="poly") … … 5485 5485 e++; 5486 5486 } 5487 } 5487 } 5488 5488 } 5489 5489 } … … 5511 5511 RETURN: list, see the procedure tropicalCurve for an explanation of the syntax of this list 5512 5512 NOTE: - the tropical curve defined by tp will consist of a bunch of parallel lines and 5513 throughout the procedure a list with the name bunchoflines is computed, which 5513 throughout the procedure a list with the name bunchoflines is computed, which 5514 5514 represents these lines and has the following interpretation: 5515 5515 list, each entry corresponds to a vertex in the tropical plane curve defined by tp 5516 5516 l[i][1] = the equation of the ith line in the tropical curve 5517 5517 l[i][2] = a polynomial whose monimials mark the vertices in the Newton polygon 5518 corresponding to the entries in tp which take the common minimum 5518 corresponding to the entries in tp which take the common minimum 5519 5519 at the ith vertex 5520 - the information in l[i][2] represents the subdivision of the Newton polygon of tp 5521 (respectively a polynomial which defines tp); 5522 - if # is non-empty and #[1] is the string 'max', then in the computations minimum and 5523 maximum are exchanged; 5524 - if # is non-empty and the #[1] is not a string, only the vertices will be computed 5520 - the information in l[i][2] represents the subdivision of the Newton polygon of tp 5521 (respectively a polynomial which defines tp); 5522 - if # is non-empty and #[1] is the string 'max', then in the computations minimum and 5523 maximum are exchanged; 5524 - if # is non-empty and the #[1] is not a string, only the vertices will be computed 5525 5525 and the information on the Newton subdivision will be omitted; 5526 5526 - here the tropical polynomial is supposed to be the MINIMUM of the linear forms in tp, … … 5571 5571 { 5572 5572 vergleich=substitute(tp[l],var(1),px); 5573 if (vergleich==wert) 5573 if (vergleich==wert) 5574 5574 { 5575 5575 newton=newton+detropicalise(oldtp[l]); … … 5582 5582 e++; 5583 5583 } 5584 } 5584 } 5585 5585 } 5586 5586 // if a vertex appears several times, only its first occurence will be kept … … 5589 5589 for (j=i-1;j>=1;j--) 5590 5590 { 5591 if (bunchoflines[i][1]==bunchoflines[j][1]) 5591 if (bunchoflines[i][1]==bunchoflines[j][1]) 5592 5592 { 5593 5593 bunchoflines=delete(bunchoflines,i); … … 5630 5630 xc=substitute(bunchoflines[i][1]-cc,var(2),0,var(1),1); 5631 5631 yc=substitute(bunchoflines[i][1]-cc,var(2),1,var(1),0); 5632 5632 if (xc!=0) // then there is a point on the line with y-coordinate zero 5633 5633 { 5634 5634 gr[1]=-cc/leadcoef(xc); … … 5650 5650 5651 5651 static proc clearintmat (intmat vv) 5652 "USAGE: clearintmat(vv); vv intmat 5652 "USAGE: clearintmat(vv); vv intmat 5653 5653 ASSUME: all entries of the first column of vv are non-negative, not all entries are zero 5654 5654 unless vv has only one column 5655 RETURN: intmat, vv has been ordered in an ascending way by the entries of the first row; 5656 if an entry in the first row occurs several times, the entries in the 5655 RETURN: intmat, vv has been ordered in an ascending way by the entries of the first row; 5656 if an entry in the first row occurs several times, the entries in the 5657 5657 second row have been added and only one row has been kept; 5658 5658 colums with a zero in the first row have been removed unless vv has only one … … 5663 5663 for (int i=ncols(vv)-1;i>=1;i--) 5664 5664 { 5665 if (vv[1,i]==vv[1,i+1]) 5665 if (vv[1,i]==vv[1,i+1]) 5666 5666 { 5667 5667 vv[2,i]=vv[2,i]+vv[2,i+1]; … … 5693 5693 k++; 5694 5694 } 5695 else 5695 else 5696 5696 { 5697 5697 stop=1; … … 5768 5768 { 5769 5769 int m=nrows(M); 5770 5770 5771 5771 } 5772 5772 else … … 5890 5890 return(c); 5891 5891 } 5892 f=f-c; 5892 f=f-c; 5893 5893 if (k==1) 5894 5894 { 5895 5895 return(substitute(f,var(1),1,var(2),0)); 5896 } 5896 } 5897 5897 else 5898 5898 { 5899 5899 return(substitute(f,var(1),0,var(2),1)); 5900 } 5900 } 5901 5901 } 5902 5902 … … 5983 5983 ASSUME: f is a polynomial in Q[x_1,...,x_n], and # is either empty or #[1] is a positive integer 5984 5984 RETURN: string, a decimal expansion of the leading coefficient of f up to order two respectively #[1] 5985 NOTE: the procedure is called by texDrawTropical and conicWithTangents and 5985 NOTE: the procedure is called by texDrawTropical and conicWithTangents and 5986 5986 f will actually be a number" 5987 5987 { … … 6010 6010 } 6011 6011 for (j=i;j<=i+nachkomma;j++) 6012 { 6012 { 6013 6013 news=news+s[j]; 6014 6014 } … … 6040 6040 } 6041 6041 return(0); 6042 } 6042 } 6043 6043 6044 6044 static proc stringdelete (string w,int i) … … 6054 6054 { 6055 6055 return(""); 6056 6056 6057 6057 } 6058 6058 if (i==1) … … 6109 6109 k=j+2; 6110 6110 while (k<=size(F) and ((F[k]=="0") or (F[k]=="1") or (F[k]=="2") or (F[k]=="3") or 6111 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6111 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6112 6112 or (F[k]=="9"))) 6113 6113 { … … 6123 6123 k=j+2; 6124 6124 while (k<=size(F) and ((F[k]=="0") or (F[k]=="1") or (F[k]=="2") or (F[k]=="3") or 6125 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6125 (F[k]=="4") or (F[k]=="5") or (F[k]=="6") or (F[k]=="7") or (F[k]=="8") 6126 6126 or (F[k]=="9"))) 6127 6127 { … … 6136 6136 F=stringdelete(F,j); 6137 6137 j--; 6138 } 6138 } 6139 6139 } 6140 6140 short=altshort; 6141 6141 return(F); 6142 6142 } 6143 6143 6144 6144 static proc texcoefficient (poly f,list #) 6145 6145 "USAGE: texcoefficient(f[,#]); f poly, # optional list … … 6176 6176 } 6177 6177 if (size(koeffizient)>5) 6178 { 6178 { 6179 6179 string tfractest=koeffizient[2..6]; 6180 6180 if (tfractest=="tfrac") … … 6259 6259 static proc coordinatechange (poly f,intmat A,intvec v) 6260 6260 "USAGE: coordinatechange(f,A,v); f poly, A intmat, v intvec 6261 ASSUME: f is a polynomial in two variables, A is a 2x2 6261 ASSUME: f is a polynomial in two variables, A is a 2x2 6262 6262 integer matrix, and v is an integer vector with 2 entries 6263 6263 RETURN: poly, the polynomial transformed by (x,y)->A*(x,y)+v … … 6280 6280 ASSUME: poly is a cubic polynomial 6281 6281 RETURN: poly, the Weierstrass normal form of the cubic, 0 if poly is not a cubic 6282 NOTE: - the algorithm for the coefficients of the Weierstrass form is due to 6282 NOTE: - the algorithm for the coefficients of the Weierstrass form is due to 6283 6283 Fernando Rodriguez Villegas, villegas@math.utexas.edu 6284 6284 - if an additional argument # is given, the simplified Weierstrass form … … 6304 6304 poly a4=((-3*t0*r0+s0^2)*q1+(-3*s1*s0*q0+s1*r0^2))*q3 6305 6305 +(t0*r0*q2^2+(s1*s0*q1+((-3*t0*r2+s1^2)*q0+s0*r0*r2))*q2 6306 +(t0*r2*q1^2+s1*r0*r2*q1+s0*r2^2*q0)); 6306 +(t0*r2*q1^2+s1*r0*r2*q1+s0*r2^2*q0)); 6307 6307 poly a6=(-27*t0^2*q0^2+(9*t0*s0*r0-s0^3)*q0-t0*r0^3)*q3^2+ 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6308 (((9*t0^2*q0-t0*s0*r0)*q1+((-3*t0*s0*r1+(3*t0*s1*r0+ 6309 2*s1*s0^2))*q0+(t0*r0^2*r1-s1*s0*r0^2)))*q2+(-t0^2*q1^3 6310 +(t0*s0*r1+(2*t0*s1*r0-s1*s0^2))*q1^2+((3*t0*s0*r2+ 6311 (-3*t0*s1*r1+2*s1^2*s0))*q0+((2*t0*r0^2-s0^2*r0)*r2+ 6312 (-t0*r0*r1^2+s1*s0*r0*r1-s1^2*r0^2)))*q1+((9*t0*s1*r2- 6313 s1^3)*q0^2+(((-3*t0*r0+s0^2)*r1-s1*s0*r0)*r2+(t0*r1^3 6314 -s1*s0*r1^2+s1^2*r0*r1))*q0)))*q3+(-t0^2*q0*q2^3+ 6315 (-t0*s1*r0*q1+((2*t0*s0*r2+(t0*s1*r1-s1^2*s0))*q0- 6316 t0*r0^2*r2))*q2^2+(-t0*s0*r2*q1^2+(-t0*s1*r2*q0+ 6317 (t0*r0*r1-s1*s0*r0)*r2)*q1+((2*t0*r0-s0^2)*r2^2+ 6318 (-t0*r1^2+s1*s0*r1-s1^2*r0)*r2)*q0)*q2+ 6319 (-t0*r0*r2^2*q1^2+(t0*r1-s1*s0)*r2^2*q0*q1- 6320 6320 t0*r2^3*q0^2)); 6321 6321 poly b2=a1^2+4*a2; … … 6365 6365 i.e. a polynomial of the form a+bx+cx2+dy+exy+fx2y+gy2+hxy2+ix2y2 6366 6366 RETURN: poly, a Weierstrass form of the elliptic curve defined by poly 6367 NOTE: - the algorithm is based on the paper Sang Yook An, Seog Young Kim, 6367 NOTE: - the algorithm is based on the paper Sang Yook An, Seog Young Kim, 6368 6368 David C. Marshall, Susan H. Marshall, William G. McCallum and Alexander R. Perlis: 6369 6369 Jacobians of Genus One Curves. Journal of Number Theory 90,2 (2001), 304-315. … … 6388 6388 6389 6389 static proc jInvariantOfACubic (poly f,list #) 6390 "USAGE: jInvariantOfACubic(f[,#]); f poly, # list 6390 "USAGE: jInvariantOfACubic(f[,#]); f poly, # list 6391 6391 ASSUME: poly is a cubic polynomial defining an elliptic curve 6392 6392 RETURN: poly, the j-invariant of the elliptic curve defined by poly … … 6429 6429 6430 6430 static proc jInvariantOfA2x2Curve (poly f,list #) 6431 "USAGE: jInvariantOfA2x2Curve(f[,#]); f poly, # list 6431 "USAGE: jInvariantOfA2x2Curve(f[,#]); f poly, # list 6432 6432 ASSUME: poly, is a polynomial defining an elliptic curve of type (2,2) on P^1xP^1, 6433 6433 i.e. a polynomial of the form a+bx+cx2+dy+exy+fx2y+gy2+hxy2+ix2y2 … … 6475 6475 6476 6476 static proc jInvariantOfA4x2Curve (poly f,list #) 6477 "USAGE: jInvariantOfA4x2Curve(f[,#]); f poly, # list 6477 "USAGE: jInvariantOfA4x2Curve(f[,#]); f poly, # list 6478 6478 ASSUME: poly, is a polynomial defining an elliptic curve of type (4,2), 6479 6479 i.e. a polynomial of the form a+bx+cx2+dx3+ex4+fy+gxy+hx2y+iy2 … … 6515 6515 6516 6516 static proc jInvariantOfAPuiseuxCubic (poly f,list #) 6517 "USAGE: jInvariantOfAPuiseuxCubic(f[,#]); f poly, # list 6517 "USAGE: jInvariantOfAPuiseuxCubic(f[,#]); f poly, # list 6518 6518 ASSUME: poly is a cubic polynomial over Q(t) defining an elliptic curve and # is empty 6519 RETURN: list, containing two polynomials whose ratio is the j-invariant of the 6519 RETURN: list, containing two polynomials whose ratio is the j-invariant of the 6520 6520 elliptic curve defined by poly 6521 6521 ASSUME: poly is a cubic polynomial over Q(t) defining an elliptic curve and # is non-empty … … 6624 6624 // Example 3 - the ideal is not zero dimensional 6625 6625 // -------------------------------------------------------- 6626 ring r1=0,(t,x,y),dp; 6626 ring r1=0,(t,x,y),dp; 6627 6627 poly f=(9t27-12t26-5t25+21t24+35t23-51t22-40t21+87t20+56t19-94t18-62t17+92t16+56t15-70t14-42t13+38t12+28t11+18t10-50t9-48t8+40t7+36t6-16t5-12t4+4t2)*x2+(-9t24+12t23-4t22-42t20+28t19+30t18-20t17-54t16+16t15+48t14-16t12+8t11-18t10-26t9+30t8+20t7-24t6+4t5+28t4-8t3-16t2+4)*xy+(6t16-10t15-2t14+16t13+4t12-18t11-10t10+24t9+6t8-20t7+8t6+8t5-20t4-4t3+12t2+4t-4)*y2+(-9t28+3t27+8t26-4t25-45t24-6t23+42t22+30t21-94t20-40t19+68t18+82t17-38t16-60t15+26t14+36t13-22t12-20t11+4t10+4t9+12t8+8t7-8t6-8t5+4t4)*x+(9t27-21t26+16t25+14t24+12t23-61t22+27t21+80t20-19t19-100t18+26t17+96t16-24t15-84t14+44t12-2t11-18t10+2t9+40t8+4t7-32t6-12t5+4t3+12t2-4)*y+(9t27-12t26+4t25+36t23-18t22-28t21-2t20+54t19+14t18-52t17-44t16+24t15+40t14-4t13-12t12+4t11-4t10-4t9+4t8); 6628 6628 f; … … 6810 6810 poly f=t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2; 6811 6811 list graph=tropicalCurve(f); 6812 graph; 6812 graph; 6813 6813 size(graph)-1; 6814 6814 drawTropicalCurve(graph); -
Singular/LIB/tst.lib
rfba86f8 r7d56875 1 // $Id: tst.lib,v 1.3 3 2005-05-18 17:54:58 Singular Exp $1 // $Id: tst.lib,v 1.34 2008-10-09 09:31:58 Singular Exp $ 2 2 //(obachman, last modified 6/30/98) 3 3 ///////////////////////////////////////////////////////////////////////////// 4 4 5 version="$Id: tst.lib,v 1.3 3 2005-05-18 17:54:58 Singular Exp $";5 version="$Id: tst.lib,v 1.34 2008-10-09 09:31:58 Singular Exp $"; 6 6 category="Utilities"; 7 7 info=" … … 13 13 prepending prefix \"// tst_ignore:\" 14 14 tst_init() writes some identification data to GetTstStatusFile() 15 tst_status([any]) writes status info to toGetTstStatusFile()15 tst_status([any]) writes status info to GetTstStatusFile() 16 16 tst_InitTimer() initialize tst-Timer 17 17 tst_StopTimer() stop Tst-Timer … … 48 48 { 49 49 "EXAMPLE"; echo = 2; 50 string s = tst_system("echo This is isan example of tst_system");50 string s = tst_system("echo This is an example of tst_system"); 51 51 "The following is what the system call wrote to stdout: " + s; 52 52 } -
Singular/LIB/zeroset.lib
rfba86f8 r7d56875 1 1 // Last change 12.02.2001 (Eric Westenberger) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: zeroset.lib,v 1.1 7 2007-03-14 18:27:47Singular Exp $";3 version="$Id: zeroset.lib,v 1.18 2008-10-09 09:31:58 Singular Exp $"; 4 4 category="Symbolic-numerical solving"; 5 5 info=" … … 110 110 list result = RootsMain(f); // find roots of f 111 111 112 // store the roots and the thenew representation of 'a' and transform112 // store the roots and the new representation of 'a' and transform 113 113 // the coefficients of f. 114 114
Note: See TracChangeset
for help on using the changeset viewer.