Anonymous user
P-Adic numbers, basic: Difference between revisions
changed the intro and a few examples.
(Added Wren) |
(changed the intro and a few examples.) |
||
Line 17:
If we convert a natural number, the familiar p-ary expansion is obtained:
10 decimal is 1010 both binary and 2-adic. To convert a rational number a/b
we perform p-adic long division
The inverse of b modulo p is then used in the conversion.
'''Recipe:''' at each step the most significant digit of the partial remainder
(initially a) is zeroed by subtracting a proper multiple of the divisor b.
Shift out the zero digit (divide by p) and repeat until the remainder is zero
or the precision limit is reached.
the 'proper multiplier' is simply
d = partial remainder * 1/b (mod p).
The d's are the successive p-adic digits to find.
where it has least magnitude and just drops off. We can work with approximate rationals
and obtain exact results. The routine for rational reconstruction demonstrates this:
Line 315:
cls
'rational reconstruction
'
'until the dsum-loop overflows.
data 2,1, 2,4
data 1,1
Line 329 ⟶ 330:
data 4,9, 5,4
data 8,9
data 26,25, 5,4
Line 345 ⟶ 343:
data -101,384
'
data 2,7, 10,7
data -
data 34,21, 10,9
Line 359 ⟶ 354:
data 679001,207
data
data
data -22,7, 3,23
data 46071,379
data -22,7,
data 46071,379
data
data
data -101,109, 61,7
data 583376,6649
data -
data
data 1,4, 7,11
data 9263,2837
data 122,407, 7,11
data -517,1477
'more subtle
data 5,8, 7,11
data 353,30809
data 0,0, 0,0
Line 447 ⟶ 446:
3 1 3 3
4/3
Line 494 ⟶ 484:
5 7 1 4 2 8
-
+ =
2 8 5 7 1 4 3
1/7
Line 530 ⟶ 511:
2 12 17 20 10 5 2 12 17
5 17 5 17 6 0 10 12. 2
+ =
18 12 3 4 11 3 0 6. 2
2718281/828
Line 566 ⟶ 529:
-22/7 + O(
28070 18713 23389
46071/379 + O(
4493 8727 10145
+ =
32563 27441 785
314159/2653
+ =
577215/6649
Line 593 ⟶ 556:
-
2 6 5 0 5 4 4 0 1 6 1 2 2
3 2 4 1 4 5 4 2 2 5 5 3 5
+ =
6 2 2 2 3 3 1 2 4 4 6 6 0
141421/3562
1/4 + O(7^11)
1 5 1 5 1 5 1 5 1 5 2
9263/2837 + O(7^11)
6 5 6 6 0 3 2 0 4 4 1
+ =
1 4 1 4 2 1 3 5 6 2 3
39889/11348
122/407 + O(7^11)
6 2 0 3 0 6 2 4 4 4 3
-517/1477 + O(7^11)
1 2 3 4 3 5 4 6 4 1. 1
+ =
3 2 6 5 3 1 2 4 1 4. 1
-27584/90671
5/8 + O(7^11)
4 2 4 2 4 2 4 2 4 2 5
353/30809 + O(7^11)
2 3 6 6 3 6 4 3 4 5 5
+ =
6 6 4 2 1 2 1 6 2 1 3
47099/10977
</pre>
|