Changeset 7254:f69ced541e37
- Timestamp:
- 11/03/07 11:24:07 (6 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/rings/padics/padic_generic_element.pyx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/padics/padic_generic_element.pyx
r7016 r7254 776 776 def rational_reconstruction(self): 777 777 r""" 778 Returns a rational approximation to this p-adic number 779 778 Returns the unique rational approximation to this p-adic 779 number with certain properties, or raises a ValueError (see 780 OUTPUT below). Uses the rational reconstruction algorithm 781 applied to the unit part of this rational number. 782 780 783 INPUT: 781 784 self -- a p-adic element 785 782 786 OUTPUT: 783 rational -- an approximation to self 787 Numerator and denominator n, d of the unique rational 788 number r=n/d, if it exists, with 789 |n| and |d| <= sqrt(N/2), 790 where N = p^prec, i.e., where the *unit part* of self 791 is ... + O(p^prec). If no such r exists, a ValueError 792 is raised. 793 784 794 EXAMPLES: 785 795 sage: R = Zp(5,20,'capped-rel') … … 789 799 ... continue 790 800 ... assert i/j == R(i/j).rational_reconstruction() 801 802 A ValueError is raised when a rational reconstruction of 803 the unit part does not exist: 804 sage: R = Zp(5, 5) 805 sage: R(1413*5).rational_reconstruction() 806 Traceback (most recent call last): 807 ... 808 ValueError: Rational reconstruction of 1413 (mod 3125) does not exist. 791 809 """ 792 810 if self.is_zero(self.precision_absolute()):
Note: See TracChangeset
for help on using the changeset viewer.
