source: git/Singular/LIB/ellipticCovers.lib @ d55b3c

spielwiese
Last change on this file since d55b3c was d55b3c, checked in by Janko Boehm <boehm@…>, 11 years ago
Added first version of new library on Gromov-Witten invariants of elliptic curves
  • Property mode set to 100755
File size: 4.6 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2version="$Id$";
3category="Commutative Algebra";
4info="
5LIBRARY:  ellipticCovers.lib    Gromov Witten numbers of elliptic curves
6
7AUTHORS:  J. Boehm, boehm @ mathematik.uni-kl.de
8          A. Buchholz, buchholz @ math.uni-sb.de
9          H. Markwig   hannah @ math.uni-sb.de
10
11OVERVIEW:
12
13KEYWORDS:
14
15TYPES:
16
17PROCEDURES:
18
19";
20
21
22LIB "parallel.lib";
23
24
25proc mod_init()
26{
27newstruct("graph","list vertices, list edges");
28newstruct("Net","list rows");
29
30system("install","graph","print",printGraph,1);
31system("install","Net","print",printNet,1);
32system("install","Net","+",catNet,2);
33
34}
35
36
37proc max(int n, int m){
38if (n>m){return(n);}
39return(m);}
40
41
42proc catNet(Net N, Net M)
43{
44list L;
45list LN=N.rows;
46list LM=M.rows;
47int widthN=size(LN[1]);
48int widthM=size(LM[1]);
49int nm=max(size(LN),size(LM));
50for (int j=1; j<=nm; j++)
51{
52    if (j>size(LN)){LN[j]=emptyString(widthN);}
53    if (j>size(LM)){LM[j]=emptyString(widthM);}
54    L[j]=LN[j]+LM[j];
55}
56Net NM;
57NM.rows=L;
58return(NM);}
59
60
61proc netList(list L1)
62{
63  Net N=net("[");
64  for (int j=1; j<=size(L1)-1; j++)
65  {
66     N=N+net(L1[j])+net(", ");
67  }
68  N=N+net(L1[size(L1)])+net("]");
69  return(N);
70}
71
72proc printNet(Net N)
73{
74list L = N.rows;
75for (int j=1; j<=size(L); j++)
76{
77   print(L[j]);
78}
79}
80
81proc net(def M){
82  if (typeof(M)=="list"){
83    return(netList(M));
84  }
85  Net N;
86  list L;
87  L[1]=string(M);
88  N.rows=L;
89return(N);}
90
91
92
93proc printGraph(graph G)
94{
95  print(netList(G.edges));
96  print("Graph with "+string(size(G.vertices))+" vertices and "+string(size(G.edges))+" edges")
97}
98
99
100
101proc makeGraph(list v, list e)
102{
103  graph G;
104  G.vertices = v;
105  G.edges = e;
106  return(G);
107}
108
109
110proc propagator(def xy, def d)
111{
112  if ((typeof(xy)=="list")||(typeof(d)=="int")) {
113    number x = xy[1];
114    number y = xy[2];
115    if (d<0) {ERROR("expected non-negative degree");}
116    if (d==0) {return(x^2*y^2/(x^2-y^2)^2);}
117    number p=0;
118    for (int j=1; j<=d; j++){
119       if (d%j==0){p=p+(j*x^(4*j)+j*y^(4*j))/(x*y)^(2*j);}
120    }
121    return(p);
122  }
123  if ((typeof(xy)=="graph")||(typeof(d)=="list"))  {
124    list xl = ringlist(R)[1][2];
125    list ed = xy.edges;
126    number f=1;
127    for (int j=1; j<=size(ed); j++){
128       execute("number xx1 = "+xl[ed[j][1]]);
129       execute("number xx2 = "+xl[ed[j][2]]);
130       f=f*propagator(list(xx1,xx2),d[j]);
131       kill xx1;
132       kill xx2;
133    }
134    return(f);
135  }
136  if ((typeof(xy)=="graph")||(typeof(d)=="int"))  {
137  }
138ERROR("wrong input type");}
139
140proc computeConstant(number f,number xx)
141{
142  int tst=0;
143  number ff=f;
144  int k;
145  int j;
146  poly de;
147  while (tst==0){
148     ff=f*xx^k;
149     for (j=1; j<=k; j++){
150        ff=diff(ff,xx)/j;
151     }
152  de = subst(denominator(ff),xx,0);
153  if (de!=0){
154     poly nu = subst(numerator(ff),xx,0);
155     return(number(nu/de));
156  }
157  k=k+1;
158  }
159ERROR("error in computeConstant");}
160
161proc evaluateIntegral(number P, list xL)
162{
163  number p = P;
164  for(int j=1; j<=size(xL); j++){
165     p=computeConstant(p,xL[j]);
166  }
167return(p);}
168
169
170proc permute (list N)
171{
172   int i,j,k;
173   list L,L1;
174   if (size(N)==1){
175     return(list(N));
176   } else {
177     k=1;
178     for (i=1; i<=size(N); i++){
179       L=permute(delete(N,i));
180       for (j=1; j<=size(L); j++){
181          L1[k]=L[j]+list(N[i]);
182          k=k+1;
183       }
184     }
185   }
186return(L1);}
187
188//permute(list(x1,x2,x3,x4));
189
190
191proc partitions(int n, int a){
192ring R = 2,(x(1..n)),dp;
193ideal I = maxideal(a);
194list L;
195for (int j=1;j<=size(I);j++){
196  L[j]=leadexp(I[j]);
197}
198return(L);}
199
200
201proc gromovWitten(def P,list #)
202{
203  if (typeof(P)=="number") {
204  list xl = ringlist(R)[1][2];
205  int j;
206  for(j=1; j<=size(xl); j++){
207     execute("number n= "+xl[j]);
208     xl[j]=n;
209     kill n;
210  }
211  list pxl = permute(xl);
212  number p = 0;
213  for(j=1; j<=size(pxl); j++){
214     p=p+evaluateIntegral(P,pxl[j]);
215  }
216  return(p);
217  }
218  if (typeof(P)=="graph"){
219     int d =#[1];
220     number s =0;
221     number p;
222     list pararg;
223     list re;
224     list pa = partitions(size(P.edges),d);
225     int ti;
226     for (int j=1; j<=size(pa); j++) {
227       ti=timer;
228       //pararg[j]=list(propagator(G,pa[j]));
229       re[j]=gromovWitten(propagator(G,pa[j]));
230       ti=timer-ti;
231       print(string(j)+" / "+string(size(pa))+"    "+string(pa[j])+"     "+string(re[j])+"     "+string(ti));
232     }
233     //list re = parallelWaitAll("gromovWitten", pararg, list(list(list(2))));
234     return(re);
235  }
236}
237
238proc sum(list L){
239  number s;
240  for(int j=1; j<=size(L); j++){
241     s=s+L[j];
242  }
243return(s);}
244
245
246
Note: See TracBrowser for help on using the repository browser.