Skip to content

Commit 4e3c9ce

Browse files
committed
Fix polynomial and rational function approximation methods to MeromorphicFunctionsElement and ThetaOC classes
1 parent a05b246 commit 4e3c9ce

File tree

2 files changed

+40
-11
lines changed

2 files changed

+40
-11
lines changed

darmonpoints/meromorphic.py

+33-10
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,27 @@ def power_series(self):
9595
def __call__(self, D):
9696
return self.evaluate(D)
9797

98+
def polynomial_approximation(self, z, m):
99+
K = self.parent().base_ring()
100+
a, b, c, d = self._parameter.list()
101+
phi = lambda Q: K(a) / c if Q == Infinity else (a * Q + b) / (c * Q + d)
102+
try:
103+
pt = phi(self.normalize_point)
104+
pole = -d / c
105+
# valinf = evalpoly(self._value, pt) * (self.normalize_point - pole)
106+
except AttributeError:
107+
pole = None
108+
# if c == 0:
109+
# valinf = 1
110+
# else:
111+
# valinf = evalpoly(self._value, K(a) / c)
112+
valinf = 1
113+
assert pole is None
114+
fac = (z - pole) if pole is not None else 1
115+
phiz = phi(z)
116+
ans = fac * (sum(a*phiz**n for n, a in enumerate(self._value[:m]))) / valinf
117+
return ans
118+
98119
def evaluate(self, D): # meromorphic functions
99120
K = self.parent().base_ring()
100121
if type(D) in (int, Integer):
@@ -104,13 +125,14 @@ def evaluate(self, D): # meromorphic functions
104125
try:
105126
pt = phi(self.normalize_point)
106127
pole = -d / c
107-
valinf = evalpoly(self._value, pt) * (self.normalize_point - pole)
128+
# valinf = evalpoly(self._value, pt) * (self.normalize_point - pole)
108129
except AttributeError:
109130
pole = None
110-
if c == 0:
111-
valinf = 1
112-
else:
113-
valinf = evalpoly(self._value, K(a) / c)
131+
# if c == 0:
132+
# valinf = 1
133+
# else:
134+
# valinf = evalpoly(self._value, K(a) / c)
135+
valinf = 1
114136
assert pole is None
115137

116138
def ev(P):
@@ -135,13 +157,14 @@ def eval_derivative(self, D):
135157
try:
136158
pt = phi(self.normalize_point)
137159
pole = -d / c
138-
valinf = evalpoly(self._value, pt) * (self.normalize_point - pole)
160+
# valinf = evalpoly(self._value, pt) * (self.normalize_point - pole)
139161
except AttributeError:
140162
pole = None
141-
if c == 0:
142-
valinf = 1
143-
else:
144-
valinf = evalpoly(self._value, K(a) / c)
163+
# if c == 0:
164+
# valinf = 1
165+
# else:
166+
# valinf = evalpoly(self._value, K(a) / c)
167+
valinf = 1
145168
assert pole is None
146169
chainrule = (a * d - b * c) / (c * D + d) ** 2
147170
return (

darmonpoints/theta.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ def _latex_(self):
219219
def __call__(self, z, **kwargs):
220220
return self.evaluate(z, **kwargs)
221221

222+
def rational_function_approximation(self, z, m):
223+
ans0 = self.val.rational_function(as_map=False, z=z)
224+
ans1 = prod(F.polynomial_approximation(z,m) for FF in self.Fnlist for F in FF.values())
225+
return ans0 * ans1
226+
222227
def evaluate(self, z, **kwargs):
223228
if not isinstance(z, DivisorsElement):
224229
z = self.Div([(1, z)])
@@ -262,6 +267,7 @@ def eval_derivative(self, z, return_value=False):
262267
)
263268
ans *= valder * Fnzall + tmp * v0
264269
if return_value:
265-
return ans, v0
270+
value = self.evaluate(z0) # DEBUG: should be the same as v0
271+
return ans, value
266272
else:
267273
return ans

0 commit comments

Comments
 (0)