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

Commit

Permalink
Brought doctest coverage to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Sinclair committed Jul 19, 2017
1 parent f699d63 commit 195abcc
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/sage/rings/polynomial/padics/omtree/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,44 @@ def find_psi(self,val):
return psielt

def root(self):
"""
Returns the root frame reached by traversing up the tree from ``self``.
As a note, the leaves for a polynomial's OM Tree may have different roots.
Becuase optimal OM Trees remove 'improvement frames' (those for which
neither ramificaiton or inertia is found), an OM Tree may technically
be a forest.
See :meth: `OMTree.roots()` which returns this for each OM Tree leaf.
EXAMPLES::
In this example, the root is the default initial frame::
sage: from sage.rings.polynomial.padics.omtree.omtree import OMTree
sage: from sage.rings.polynomial.padics.omtree.frame import Frame
sage: Phi = ZpFM(2,20,'terse')['x'](x^32+16)
sage: T = OMTree(Phi)
sage: T.leaves()[0].root()
Frame with phi (1 + O(2^20))*x + (0 + O(2^20))
sage: Fr = Frame(Phi)
sage: Fr.seed(Fr.x)
sage: Fr.root() == Fr
True
sage: T.leaves()[0].root() == Fr
True
This may not be the case, and we may end up with a forest::
sage: R.<c> = ZqFM(125, prec = 30, print_mode='terse')
sage: Rz.<z>=R[]
sage: g=(z^3+2)^5+5
sage: om=OMTree(g)
sage: om.leaves()[0].root()
Frame with phi (1 + O(5^30))*z + (931322574615478515623 + O(5^30))
sage: om.leaves()[1].root()
Frame with phi (1 + O(5^30))*z + (0 + O(5^30))
"""
if self.is_first():
return self
else:
Expand Down
15 changes: 15 additions & 0 deletions src/sage/rings/polynomial/padics/omtree/omtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ def followsegment(next,Phi):
def Phi(self):
"""
The polynomial ``Phi`` underlying the OM Tree.
EXAMPLES::
sage: from sage.rings.polynomial.padics.omtree.omtree import OMTree
sage: Phi = ZpFM(2,20,'terse')['x'](x^8+2)
sage: T = OMTree(Phi)
sage: T.Phi()
(1 + O(2^20))*x^8 + (0 + O(2^20))*x^7 + (0 + O(2^20))*x^6 + (0 + O(2^20))*x^5 + (0 + O(2^20))*x^4 + (0 + O(2^20))*x^3 + (0 + O(2^20))*x^2 + (0 + O(2^20))*x + (2 + O(2^20))
"""
return self._Phi

Expand Down Expand Up @@ -186,6 +194,13 @@ def roots(self):
"""
The roots of the trees with the leaves the OMTree.
As a note, the leaves for a polynomial's OM Tree may have different roots.
Becuase optimal OM Trees remove 'improvement frames' (those for which
neither ramificaiton or inertia is found), an OM Tree may technically
be a forest.
See :meth: `Frame.root()` which is used to find the root for each leaf.
EXAMPLES::
sage: from sage.rings.polynomial.padics.omtree.omtree import OMTree
Expand Down

0 comments on commit 195abcc

Please sign in to comment.