Opened 4 years ago

Last modified 2 months ago

#18416 new defect

UniqueRepresentation issue with PowerSeriesRing

Reported by: vdelecroix Owned by:
Priority: critical Milestone: sage-8.9
Component: algebra Keywords:
Cc: niles, SimonKing Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by vdelecroix)

The power series ring (sage.rings.power_series_ring.PowerSeriesRing) inherits from UniqueRepresentation. In the argument of the constructor there is the precision (prec) but it can be modified! Which leads to wrong behavior

sage: R = PowerSeriesRing(QQ, 'x', 3)
sage: R.default_prec()
3
sage: R.set_default_prec(19)
sage: PowerSeriesRing(QQ, 'x', 3).default_prec()
19

Moreover, a function can modify a power series in use

sage: def haha()
....:     PowerSeriesRing(QQ, 'x').set_default_prec(1)
sage: R = PowerSeriesRing(QQ, 'x')
sage: R.default_prec()
20
sage: haha()
sage: R.default_prec()
1

Change History (8)

comment:1 Changed 4 years ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 4 years ago by vdelecroix

  • Cc niles SimonKing added

comment:3 Changed 6 months ago by alexjbest

  • Milestone changed from sage-6.7 to sage-8.7

Does anyone know the status of this?

The corresponding behavior for LaurentSeries? was deprecated in #16201 (which also mentions power series) and finally removed in #26915 .

So now we are in the situation where PowerSeries? and LaurentSeries? work quite differently here, I can't see any real reason for this.

comment:4 Changed 6 months ago by tscrim

+1 on deprecating the set_default_prec for PowerSeriesRing for the same reasons as for LaurentSeriesRing.

comment:5 Changed 6 months ago by tscrim

Even worse in terms of hidden side effects:

sage: R.<x> = LaurentSeriesRing(QQ,50)
sage: R.default_prec()
50
sage: S = PowerSeriesRing(QQ,50,names='x')
sage: S.set_default_prec(10)
sage: R.default_prec()
10

comment:6 Changed 6 months ago by niles

yes, this should definitely be changed

comment:7 Changed 6 months ago by embray

  • Milestone changed from sage-8.7 to sage-8.8

Moving all blocker/critical issues from 8.7 to 8.8.

comment:8 Changed 2 months ago by embray

  • Milestone changed from sage-8.8 to sage-8.9

Moving open critical and blocker issues to the next release milestone (optimistically).

Note: See TracTickets for help on using tickets.