Opened 8 years ago

Last modified 4 years ago

#10271 needs_work enhancement

Make big_oh notation work for any element that has a big_oh() method

Reported by: tkluck Owned by: boothby
Priority: trivial Milestone: sage-6.4
Component: commutative algebra Keywords: sd32
Cc: Merged in:
Authors: Tom Boothby Reviewers: Timo Kluck
Report Upstream: N/A Work issues: add doctest
Branch: Commit:
Dependencies: #11726, #11719 Stopgaps:

Description (last modified by boothby)

One can use the big-oh notation

O(xn)

when x is a generator of a power series or a laurent series. It is convenient to also be able to use this notation when the parent of x is another ring (for example, a subclass of a power series ring).

The current implementation in rings/big_oh.py imports a large number of types, which slows down the Sage startup. Elements should implement their own big_oh() methods, and the function O(x) should simply call x.big_oh().

Attachments (3)

bigoh.patch (447 bytes) - added by tkluck 8 years ago.
patch for sage.rings.big_oh
trac_10271_bigoh_extension.patch (730 bytes) - added by tkluck 8 years ago.
trac_10271.patch (13.7 KB) - added by boothby 7 years ago.
apply only this patch

Download all attachments as: .zip

Change History (20)

Changed 8 years ago by tkluck

patch for sage.rings.big_oh

comment:1 Changed 8 years ago by tkluck

  • Status changed from new to needs_review

Changed 8 years ago by tkluck

comment:2 Changed 8 years ago by tkluck

I just added the patch in the right format, i.e. the output of hg_sage.export() instead of a normal diff.

comment:3 Changed 7 years ago by mariah

  • Description modified (diff)

comment:4 Changed 7 years ago by mariah

  • Milestone set to sage-4.7.1
  • Reviewers set to Mariah Lenox
  • Status changed from needs_review to positive_review

Applied patch to sage-4.7.1.alpha2, did 'sage -b', then 'make testlong'. All tests passed. Positive review!

comment:5 Changed 7 years ago by jdemeyer

  • Status changed from positive_review to needs_work
  • Work issues set to add doctest

I think this patch needs an extra doctest to demonstrate what it does and that it works as expected.

comment:6 Changed 7 years ago by was

The following behavior is bad. In both cases, I think one should get an error.

sage: R.<x> = QQ[[]]
sage: O(1+x^10)
O(x^10)
sage: f = x*(1/x + x^9); type(f)
<type 'sage.rings.laurent_series_ring_element.LaurentSeries'>
sage: O(f)
O(x^0)

comment:7 Changed 7 years ago by boothby

  • Description modified (diff)
  • Owner changed from malb to boothby

comment:8 Changed 7 years ago by boothby

  • Summary changed from Make big_oh notation work for any element that has degree() and add_bigoh() properties to Make big_oh notation work for any element that has a big_oh() method

comment:9 Changed 7 years ago by was

Tom Boothby is currently working on this. See also #11726 and #11729.

comment:10 Changed 7 years ago by was

  • Keywords sd32 added

comment:11 Changed 7 years ago by boothby

  • Authors changed from Timo Kluck to Tom Boothby
  • Dependencies set to #11726, #11719

Changed 7 years ago by boothby

apply only this patch

comment:12 Changed 7 years ago by boothby

  • Status changed from needs_work to needs_review

comment:13 Changed 6 years ago by tkluck

  • Reviewers changed from Mariah Lenox to Timo Kluck
  • Status changed from needs_review to needs_work

I could have reviewed this sooner, sorry about that. However, the ticket's dependencies are still open, so maybe we should still wait for them to be accepted?

This doesn't apply to v5.4 anymore. I also couldn't easily fix that myself. I'll set the status to needs_work.

comment:14 Changed 5 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:15 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:16 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:17 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.