diff --git a/src/sage/rings/polynomial/padics/omtree/frame.py b/src/sage/rings/polynomial/padics/omtree/frame.py index 1a0571fab0c..baa45c770a3 100644 --- a/src/sage/rings/polynomial/padics/omtree/frame.py +++ b/src/sage/rings/polynomial/padics/omtree/frame.py @@ -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. = ZqFM(125, prec = 30, print_mode='terse') + sage: Rz.=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: diff --git a/src/sage/rings/polynomial/padics/omtree/omtree.py b/src/sage/rings/polynomial/padics/omtree/omtree.py index ef124961a55..09b44ba868d 100644 --- a/src/sage/rings/polynomial/padics/omtree/omtree.py +++ b/src/sage/rings/polynomial/padics/omtree/omtree.py @@ -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 @@ -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