Skip to content

Commit

Permalink
refactor exponential and logarithm
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAyotte committed May 14, 2023
1 parent e85227e commit 2b242fb
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/sage/rings/function_field/drinfeld_modules/drinfeld_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,15 @@ def exponential(self, name='z'):
L = LazyPowerSeriesRing(self._base, name)
zero = self._base.zero()
q = self._Fq.cardinality()
exp = lambda k: self._compute_coefficient_exp(ZZ(k).log(q)) if ZZ(k).is_power_of(q) or k == 0 else zero
return L(exp, valuation=1)

def coeff_exp(k):
# Return the k-th coefficient of the exponential.
k = ZZ(k)
if k.is_power_of(q):
return self._compute_coefficient_exp(k.log(q))
else:
return zero
return L(coeff_exp, valuation=1)

def gen(self):
r"""
Expand Down Expand Up @@ -1332,8 +1339,15 @@ def logarithm(self, name='z'):
L = LazyPowerSeriesRing(self._base, name)
zero = self._base.zero()
q = self._Fq.cardinality()
log = lambda k: self._compute_coefficient_log(ZZ(k).log(q)) if ZZ(k).is_power_of(q) or k == 0 else zero
return L(log, valuation=1)

def coeff_log(k):
# Return the k-th coefficient of the logarithm
k = ZZ(k)
if k.is_power_of(q):
return self._compute_coefficient_log(k.log(q))
else:
return self._base.zero()
return L(coeff_log, valuation=1)


def morphism(self):
Expand Down

0 comments on commit 2b242fb

Please sign in to comment.