Opened 5 years ago

Closed 5 years ago

#17955 closed defect (fixed)

LaurentSeriesRing and series_precision

Reported by: behackl Owned by:
Priority: trivial Milestone: sage-6.6
Component: commutative algebra Keywords: series_precision, asymptotics
Cc: Merged in:
Authors: Benjamin Hackl Reviewers: Ralf Stephan
Report Upstream: N/A Work issues:
Branch: 13b1867 (Commits) Commit: 13b1867998e2f1f172ffd9cb576e3ba4e8298735
Dependencies: Stopgaps:

Description

Currently, LaurentSeriesRing caches without replacing the default default_prec=None to the global series precision obtainable by sage.default.series_precision() . This leads to the following behavior:

sage: set_series_precision(5)
sage: R.<x> = LaurentSeriesRing(ZZ)
sage: 1/(1-x)
1 + x + x^2 + x^3 + x^4 + O(x^5)
sage: set_series_precision(3)
sage: R.<x> = LaurentSeriesRing(ZZ)
sage: 1/(1-x)
1 + x + x^2 + x^3 + x^4 + O(x^5)

Instead, the (second) output should be

sage: 1/(1-x)
1 + x + x^2 + O(x^3)

This is fixed by setting default_prec to the corresponding global series precision *before* caching the parent.

Change History (3)

comment:1 Changed 5 years ago by behackl

  • Authors set to Benjamin Hackl
  • Branch set to u/behackl/laurent_series_precision
  • Commit set to 13b1867998e2f1f172ffd9cb576e3ba4e8298735
  • Priority changed from major to trivial
  • Status changed from new to needs_review

comment:2 Changed 5 years ago by rws

  • Component changed from symbolics to commutative algebra
  • Reviewers set to Ralf Stephan
  • Status changed from needs_review to positive_review

Is fine and passes all tests in rings/ and doc/. Thanks for spotting this.

comment:3 Changed 5 years ago by vbraun

  • Branch changed from u/behackl/laurent_series_precision to 13b1867998e2f1f172ffd9cb576e3ba4e8298735
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.