Opened 6 years ago
Last modified 5 years ago
#14889 new defect
Equality in PowerSeriesRing can be unpredictable
Reported by: | darij | Owned by: | AlexGhitza |
---|---|---|---|
Priority: | minor | Milestone: | sage-6.4 |
Component: | algebra | Keywords: | power series, halting problem, discreteness, equality |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
I know this is unavoidable, but I'd say it should be better documented...
Over a finite field:
sage: K.<u> = PowerSeriesRing(GF(5)) sage: u = K.gen() sage: u ** 25 u^25 sage: u ** 25 == 0 False sage: (1 + u) ** 25 1 + u^25 sage: (1 + u) ** 25 == 1 False sage: (1 / (1 - u)) ** 25 1 + O(u^20) sage: (1 / (1 - u)) ** 25 == 1 True
I suspect the last True
is due to 1 / (1 - u)
being a dense series, which leads to Sage keeping precision at O(u^20)
rather than moving to a higher exponent.
Change History (7)
comment:1 Changed 6 years ago by
- Description modified (diff)
comment:2 Changed 6 years ago by
- Description modified (diff)
comment:3 Changed 6 years ago by
- Description modified (diff)
comment:4 Changed 6 years ago by
- Description modified (diff)
comment:5 Changed 5 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:6 Changed 5 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:7 Changed 5 years ago by
- Milestone changed from sage-6.3 to sage-6.4
Note: See
TracTickets for help on using
tickets.
The power series ring tries to keep arbitrary precision if possible, and only switches to series expansion if necessary. So
u^25
is kept as exact, even though it is zero to thedefault_prec=20
.For interactive use, I think this is what one would want. However, for non-interactive use an "always approximate" mode where
u^25
is immediately zero would be nice. I have written lots of code where many lines end in+O(u^prec)
to get the precision back down.