-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy paththeta.gp
262 lines (246 loc) · 4.01 KB
/
theta.gp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
p = 3
/*
We will use z and l as the variables, where l corresponds to what
is called lambda in the text; then we have
xi = z^p - l
in this notation.
*/
/*
This computes z^i xi^[n]
*/
monomial(t) =
{
local(i, n);
i = t[1];
n = t[2];
return( z^i * (z^p - l)^n * (n!)^(-1))
}
/*
This finds the "leading coefficient" c in the expansion
f = sum c_{i, n} z^i xi^[n]
*/
leading(f) =
{
local(d, c, i, n);
if(f == 0, return([0, 0, 0]));
d = poldegree(f, z);
c = polcoeff(f, d, z);
i = d % p;
n = (d - i)/p;
c = c * (n!);
return([i, n, c])
}
/*
This function associates to a polynomial f in z and l
the coefficients c_{i, n} such that
f = sum c_{i, n} z^i xi^[n]
*/
decompose(f) =
{
local(t, u);
t = leading(f);
u = [t];
while(t[1] + t[2] > 0,
f = f - t[3]*monomial(t);
t = leading(f);
u = concat(u, [t]);
);
return(u)
}
/*
This puts a sequence of coefficients c_{i, n}
back into a polynomial in z and l.
*/
putback(u) =
{
local(f, j);
f = 0;
j = 1;
while(j <= length(u),
f = f + u[j][3]*monomial(u[j]);
j = j + 1
);
return(f)
}
/*
Is each of the coefficients c_{i, n} p-adically integral?
*/
is_integral(u) =
{
local(j, c);
j = 1;
while(j <= length(u),
c = u[j][3];
if(valuation(c, p) < 0, return(0));
j = j + 1
);
return(1)
}
/*
Our choice of theta. Have to use capitalized theta as
theta already exits in pari/gp.
*/
Theta_monomial(t) =
{
local(j, m);
j = t[1];
m = t[2];
if(j >= p, error("Power z too high."));
if(m == 0, return([[j + 1, 0, p*t[3]/(j + 1)], [0, 0, 0]]));
if(j == p - 1, return([[0, m + 1, t[3]], [0, 0, 0]]));
return(
[[j + 1, m, p*t[3]/(j + 1 + p*m)], [j, m - 1, - t[3]*p*l/(j + 1 + p*m)]]
)
}
Theta(u) =
{
local(v, i, t, tt);
v = [];
i = 1;
while(i <= length(u),
t = u[i];
tt = Theta_monomial(t);
while(tt[2][3],
v = concat(v, [tt[1]]);
t = tt[2];
tt = Theta_monomial(t)
);
v = concat(v, [tt[1]]);
i = i + 1
);
return(v)
}
/*
Tests decompose and putback
*/
test_decompose_putback(m) =
{
local(i, j);
i = 0;
while(i <= p*m,
if(z^i - putback(decompose(z^i)), error("Problem with code!"));
i = i + 1
);
i = 0;
while(i <= p - 1,
j = 0;
while(j <= m,
if(z^i * (z^p - l)^j/(j!) - putback([[i, j, 1]]),
error("Problem with code!"));
j = j + 1
);
i = i + 1
)
}
/*
Tests that theta indeed is an right inverse to differentiation
with respect to z.
*/
test_theta(m) =
{
local(i, j, u, n, c, k);
i = 0;
while(i <= p - 1,
j = 0;
while(j <= m,
if(p*putback([[i, j, 1]]) -
deriv(putback(Theta([[i, j, 1]])), z),
error("Problem with code!"));
/* Test formula for theta in paper. */
if((i < p - 1) && (j > 0),
u = Theta([[i, j, 1]]);
n = 1;
while(n <= length(u),
if(u[n][1] <> i + 1,
error("Problem with code!"));
if(u[n][2] <> j - n + 1,
error("Problem with code!"));
c = (-1)^(n + 1)*l^(n - 1)*p^n;
c = c/prod(k = 1, n, i + 1 + p*(j - k + 1));
if(u[n][3] <> c,
error("Problem with code!"));
n = n + 1
)
);
j = j + 1
);
i = i + 1
)
}
/*
Tests that theta indeed is an right inverse to differentiation
with respect to z.
*/
test_integrality(m) =
{
local(i, j);
i = 0;
while(i <= p - 1,
j = 0;
while(j <= m,
u = decompose(Theta(putback([[i, j, 1]])));
if(is_integral(u),,
print("Not integral for [i, j] = [", i, "," j,"]");
print(u);
);
j = j + 1
);
i = i + 1
)
}
/*
Print nonzero values of p - theta o partial_z on basis elements
*/
test_factor(m) =
{
local(i, j, t, f, g, u, v, h);
i = 0;
while(i <= p - 1,
j = 0;
while(j <= m,
t = [i, j, 1];
f = p * putback([t]);
g = putback([t]);
h = deriv(g, z);
u = decompose(h);
v = Theta(u);
h = putback(v);
if(f - h,
print(t);
print(f - h)
);
j = j + 1
);
i = i + 1
)
}
/*
Print nonzero values o
(theta tensor 1) o d_1 - d_1 o theta
on basis elements
*/
test_horizontal(m) =
{
local(i, j, t, f, g, u, v, h);
i = 0;
while(i <= p - 1,
j = 0;
while(j <= m,
t = [i, j, 1];
f = putback([t]);
g = deriv(f, l);
u = decompose(g);
v = Theta(u);
h = putback(v);
u = Theta([t]);
f = putback(u);
g = deriv(f, l);
if(g - h,
print(t);
print(h - g)
);
j = j + 1
);
i = i + 1
)
}