-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathf4.py
182 lines (97 loc) · 2.22 KB
/
f4.py
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
# coding: utf-8
# In[1]:
import sympy as sy
from sympy import Symbol, Eq, Rational, sqrt, solve
from sympy.abc import a, b, c, d, e, f, g, h, m, x, y, alpha, beta, gamma
from IPython.display import display, Latex
from util import *
from transform import *
from ec import EllipticCurve, Point
__all__ = [
'gammas_at',
'gammas',
'gamma_nice',
'gamma',
'beta',
'beta_',
'aa_',
'bb_',
'qq',
'factor',
'check_newly',
'up55',
'lo55',
'nice',
]
for subscript in range(10):
for var in 'abcdefgh':
name = '{}{}'.format(var, subscript)
globals()[name] = Symbol(name)
def displ(*x):
if __name__ == '__main__':
display(*x)
def show(eqs):
displ(Latex('\n'.join(
[r'\begin{align}']
+ list(r'{} &= {} \\'.format(sy.latex(eq.lhs), sy.latex(eq.rhs)) for eq in eqs)
+ [r'\end{align}']
)))
def mk_p(n, var, alt=False):
assert n > 0
cs = iter(sy.symbols(' '.join(string.ascii_lowercase)))
p = 0
for i in range(n):
t = next(cs)*var**i
if alt and i%2:
t = -t
p += t
return p + var**n
# In[2]:
p1_ = mk_p(8, xg)
p1_
# In[3]:
p2_ = mk_p(8, xg, alt=True)
p2_
# In[4]:
eqs = nontriv(equate(f_it(4), p1_*p2_, xg))
show(eqs)
# In[5]:
eqs = nontriv(bigsubs(eqs, g, only(solve(eqs[-1], g))))
show(eqs)
# In[6]:
eqs = nontriv(bigsubs(eqs, e, only(solve(eqs[-1], e))))
show(eqs)
# In[7]:
eqs = nontriv(bigsubs(eqs, c, only(solve(eqs[-1], c))))
show(eqs)
# In[8]:
eqs = nontriv(bigsubs(eqs, a, only(solve(eqs[-1], a))))
show(eqs)
# In[9]:
show(Eq(e.lhs, e.rhs.expand()) for e in eqs)
# In[10]:
solve(eqs[-1], d)
# In[11]:
# eqs = nontriv(bigsubs(eqs, b, only(solve(eqs[-1], b))))
# show(eqs)
# In[12]:
eqs = nontriv(bigsubs(eqs, h, 0))
show(eqs)
# In[13]:
show(Eq(e.lhs, e.rhs.expand()) for e in eqs)
# In[14]:
eqss = [ Eq(0, e.rhs.expand()-e.lhs) for e in eqs ]
show(eqss)
# In[15]:
b_2_ = eqss[1].rhs+b**2
b_2_
# In[16]:
ga_ = eqss[0].rhs+gamma
ga_
# In[17]:
b_2_.as_poly(d)
# In[23]:
eqsss = [ Eq(e.lhs, e.rhs.expand()) for e in nontriv(bigsubs(eqss, b, only(solve(eqss[-1], b)))) ]
show(eqsss)
# In[24]:
show(nontriv(bigsubs(eqss, m, 0)))