source: git/Tst/Short/tropical.tst @ 033e00f

spielwiese
Last change on this file since 033e00f was 687609, checked in by Thomas Markwig <keilen@…>, 16 years ago
*** empty log message *** git-svn-id: file:///usr/local/Singular/svn/trunk@10862 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.2 KB
Line 
1// File: tropical.tst
2// Tests for tropical lib
3LIB "tst.lib";
4tst_init();
5LIB "tropical.lib";
6///////////////////////////////////////////////////////////////////////////
7// A) Test for tropicalLifting and displayTropicalLifting
8///////////////////////////////////////////////////////////////////////////
9ring r0=0,(t,x),dp;
10poly f=t7-6t4+3t3x+8t3-12t2x+6tx2-x3+t2;
11f;
12// The point -2/3 is in the tropical variety.
13list L=tropicalLifting(f,intvec(3,-2),4);
14L;
15displayTropicalLifting(L,"subst");
16// --------------------------------------------------------
17// Example 2 - a field extension is necessary
18// --------------------------------------------------------
19poly g=(1+t2)*x2+t5x+t2;
20g;
21// The poin -1 is in the tropical variety.
22displayTropicalLifting(tropicalLifting(g,intvec(1,-1),4),"subst");
23// --------------------------------------------------------
24// Example 3 - the ideal is not zero dimensional
25// --------------------------------------------------------
26ring r1=0,(t,x,y),dp;
27poly 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);
28f;
29displayTropicalLifting(tropicalLifting(f,intvec(1,-1,-4),3),"subst");
30// --------------------------------------------------------
31// Example 4 - the ideal has even more equations
32// --------------------------------------------------------
33ring r2=0,(t,x,y,z),dp;
34ideal i=t-x3+3yz,t2xy-2x2z;
35i;
36displayTropicalLifting(tropicalLifting(i,intvec(1,1,3,0),2),"subst");
37// --------------------------------------------------------
38// Example 5-7 - testing some options
39// --------------------------------------------------------
40setring r0;
41poly f1=(x2-t3)*(x3-t5)*(x5-t7)*(x7-t11)*(x11-t13);
42f1;
43displayTropicalLifting(tropicalLifting(f1,intvec(7,-11),4,"noAbs"),"subst");
44poly f2=(1+t2)*x2+t5x+t2;
45f2;
46displayTropicalLifting(tropicalLifting(f2,intvec(1,-1),4,"isZeroDimensional","findAll"),"subst");
47poly f3=t7-6t4+3t3x+8t3-12t2x+6tx2-x3+t2;
48f3;
49displayTropicalLifting(tropicalLifting(f3,intvec(3,-2),4,"isInTrop","findAll"),"subst");
50///////////////////////////////////////////////////////////////////////////
51// B) Test for tropicalCurve, drawTropicalCurve and drawNewtonSubdivision
52///////////////////////////////////////////////////////////////////////////
53ring r=(0,t),(x,y),dp;
54poly f=t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2;
55list graph=tropicalCurve(f);
56graph;
57size(graph)-1;
58drawTropicalCurve(graph,"onlytexfile");
59poly g=t3*(x7+y7+1)+1/t3*(x4+y4+x2+y2+x3y+xy3)+1/t21*x2y2;
60list tropical_g=tropicalise(g);
61tropical_g;
62drawTropicalCurve(tropical_g,"onlytexfile");
63///////////////////////////////////////////////////////////////////////////
64// C) Test for tropicalJInvariant, jInvariant, weierstrassForm
65///////////////////////////////////////////////////////////////////////////
66// tropcial_j_invariant computes the tropical j-invariant of the elliptic curve f
67tropicalJInvariant(t*(x3+y3+1)+1/t*(x2+y2+x+y+x2y+xy2)+1/t2*xy);
68// the Newton polygone need not be the standard simplex
69tropicalJInvariant(x+y+x2y+xy2+1/t*xy);
70// the curve can have arbitrary degree
71tropicalJInvariant(t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2);
72// the procedure does not realise, if the embedded graph of the tropical curve has
73// a loop that can be resolved
74tropicalJInvariant(1+x+y+xy+tx2y+txy2);
75// but it does realise, if the curve has no loop at all ...
76tropicalJInvariant(x+y+1);
77// or if the embedded graph has more than one loop - even if only one cannot be resolved
78tropicalJInvariant(1+x+y+xy+tx2y+txy2+t3x5+t3y5+tx2y2+t2xy4+t2yx4);
79// f is already in Weierstrass form
80weierstrassForm(y2+yx+3y-x3-2x2-4x-6);
81// g is not, but wg is
82g=x+y+x2y+xy2+1/t*xy;
83poly wg=weierstrassForm(g);
84wg;
85// ... but it is not yet a simple, since it still has an xy-term, unlike swg
86poly swg=weierstrassForm(g,1);
87swg;
88// the j-invariants of all three polynomials coincide ...
89jInvariant(g);
90jInvariant(wg);
91jInvariant(swg);
92// the following curve is elliptic as well
93poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3;
94// its Weierstrass form is
95weierstrassForm(h);
96jInvariant(x+y+x2y+y3+1/t*xy,"ord");
97///////////////////////////////////////////////////////////////////////////
98// D) Test for tropicalise, tropicaliseSet, tInitialForm,
99//    tInitialIdeal, initialForm, initialIdeal
100///////////////////////////////////////////////////////////////////////////
101tropicalise(2t3x2-1/t*xy+2t3y2+(3t3-t)*x+ty+(t6+1));
102ideal i=txy-y2+1,2t3x2+1/t*y-t6;
103tropicaliseSet(i);
104setring r1;
105poly ff=t4x2+y2-t2xy+t4x-t9;
106intvec w=-1,-2,-3;
107tInitialForm(ff,w);
108ideal ii=t2x-y+t3,t2x-y-2t3x;
109w=-1,2,0;
110// the t-initial forms of the generators are
111tInitialForm(ii[1],w),tInitialForm(i[2],w);
112// and they do not generate the t-initial ideal of i
113tInitialIdeal(ii,w);
114ring r5=0,(x,y),dp;
115poly f=x3+y2-xy+x-1;
116w=2,3;
117initialForm(f,w);
118initialIdeal(f,w);
119///////////////////////////////////////////////////////////////////////////
120// E) Test for texNumber, texPolynomial, texMatrix, texDrawBasic,
121//    texDrawTropical, texDrawNewtonSubdivision, texDrawTriangulation
122///////////////////////////////////////////////////////////////////////////
123ring r6=(0,t),x,dp;
124texNumber((3t2-1)/t3);
125texPolynomial(1/t*x2-t2x+1/t);
126matrix M[2][2]=3/2,1/t*x2-t2x+1/t,5,-2x;
127texMatrix(M);
128setring r;
129string texf=texDrawTropical(tropicalCurve(x+y+1),list("",1));
130texDrawBasic(texf);
131graph=tropicalCurve(x+y+x2y+xy2+1/t*xy);
132// compute the texdraw code of the tropical curve defined by f
133texDrawTropical(graph);
134// compute the texdraw code again, but set the scalefactor to 1
135texDrawTropical(graph,"",1);
136texDrawNewtonSubdivision(graph);
137list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),intvec(0,0),intvec(2,1),intvec(0,1),intvec(1,2),intvec(0,2),intvec(0,3);
138list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,2,10);
139texDrawTriangulation(triang,polygon);
140///////////////////////////////////////////////////////////////////////////
141// F) Test for Auxilary Procedures
142///////////////////////////////////////////////////////////////////////////
143ring r7=0,(x,y),dp;
144ideal i=(x+1)*y2;
145// y is NOT in the radical of i
146radicalMemberShip(y,i);
147ring r8=0,(x,y),ds;
148ideal i=(x+1)*y2;
149// since this time the ordering is local, y is in the radical of i
150radicalMemberShip(y,i);
151ring r9=(0,t),(x,y),dp;
152poly f=t4x2+y2-t2xy+t4x-t9;
153w=2,3;
154tInitialFormPar(f,w);
155f=t4x2+y2-t2xy+t4x-1/t6;
156w=2,3;
157tInitialFormParMax(f,w);
158ideal i=t2x2+y2,x-t2;
159solveTInitialFormPar(i);
160detropicalise(3x+4y-1);
161ring r10=0,(x,y),dp;
162poly conic=2x2+1/2y2-1;
163dualConic(conic);
164setring r;
165f=t2xy+1/t*y+t3;
166parameterSubstitute(f,3);
167parameterSubstitute(f,-1);
168f=t2x+1/t*y-1;
169tropicalSubst(f,2,x,x+t,y,tx+y+t2);
170randomPoly(3,-2,5);
171randomPoly(3,-2,5,1);
172//////////////////////////////
173tst_status(1);$
Note: See TracBrowser for help on using the repository browser.