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

Commit

Permalink
implement exact_part
Browse files Browse the repository at this point in the history
  • Loading branch information
behackl committed Jan 21, 2016
1 parent 1961f94 commit 8aa55e2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/sage/rings/asymptotic/asymptotic_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,40 @@ def convert_terms(element):
return self.parent()(summands, simplify=True, convert=False)


def exact_part(self):
r"""
Return the expansion consisting of all exact terms of this
expansion.
INPUT:
Nothing
OUTPUT:
An asymptotic expansion.
EXAMPLES::
sage: R.<x> = AsymptoticRing('x^QQ * log(x)^QQ', QQ)
sage: (x^2 + O(x)).exact_part()
x^2
sage: (x + log(x)/2 + O(log(x)/x)).exact_part()
x + 1/2*log(x)
TESTS::
sage: R.<x, y> = AsymptoticRing('x^QQ * y^QQ', QQ)
sage: (x + y + O(1/(x*y))).exact_part()
x + y
sage: O(x).exact_part()
0
"""
from term_monoid import ExactTerm
return self.parent([term for term in self.summands.elements_topological()
if isinstance(term, ExactTerm)])


def __pow__(self, exponent, precision=None):
r"""
Calculate the power of this asymptotic expansion to the given ``exponent``.
Expand Down

0 comments on commit 8aa55e2

Please sign in to comment.