Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fixed tiny bug in composition code
Browse files Browse the repository at this point in the history
  • Loading branch information
tejasvicsr1 committed Aug 3, 2021
1 parent 3b3e0cd commit ee9d593
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sage/rings/lazy_laurent_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,15 @@ def __call__(self, g):
sage: f = L(lambda n: n, 0)
sage: f(g)
0 + ...
We cannot compose if `g` has a negative valuation::
sage: f = L(lambda n: n, 1)
sage: g = 1 + z
sage: f(g)
Traceback (most recent call last):
...
ValueError: can only compose with a positive valuation series
"""
# f = self and compute f(g)
Expand Down Expand Up @@ -1185,7 +1194,7 @@ def __call__(self, g):
raise NotImplementedError("can only compose with a lazy Laurent series")
# Perhaps we just don't yet know if the valuation is positive
if g._coeff_stream._approximate_valuation <= 0:
if any(g._coeff_stream[i] for i in range(self._coeff_stream._approximate_valuation, 1)):
if any(g._coeff_stream[i] for i in range(min(self._coeff_stream._approximate_valuation, 0), 1)):
raise ValueError("can only compose with a positive valuation series")
g._coeff_stream._approximate_valuation = 1

Expand Down

0 comments on commit ee9d593

Please sign in to comment.