Skip to content

Add inverse_of_unit() for padics #13539

@saraedum

Description

@saraedum

Currently, the padics lack an inverse_of_unit() method:

sage: (-1).inverse_of_unit()
-1
sage: ZpCA(3)(-1).inverse_of_unit()
AttributeError

The drawback with simply using ~ is that it puts the result in the fraction field and it can be annoying to always convert it back to the original ring when implementing general algorithms for all padics rings and fields:

sage: t = ZpCA(3,2)(-1)
sage: t
2 + 2*3 + O(3^2)
sage: t.parent()
3-adic Ring with capped absolute precision 2
sage: ~t
2 + 2*3 + O(3^2)
sage: (~t).parent()
3-adic Field with capped relative precision 2

The attached patch implements a method inverse_of_unit() and fixes a conversion error that came up when testing it.

Depends on #13600

Component: padics

Author: Julian Rueth

Reviewer: David Roe

Merged: sage-5.8.beta2

Issue created by migration from https://trac.sagemath.org/ticket/13539

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions