Showing posts with label P-adic numbers. Show all posts
Showing posts with label P-adic numbers. Show all posts

Thursday, October 16, 2014

Divergent series

There is a brilliant post about divergent series, generalized Abel summation (conformal summation), zeta summation and non-trivial mappings that can be discovered by looking at series:
http://cornellmath.wordpress.com/2007/07/28/sum-divergent-series-i/
http://cornellmath.wordpress.com/2007/07/30/sum-divergent-series-ii/
http://cornellmath.wordpress.com/2007/08/02/sum-divergent-series-iii/

Highly recommend this reading.

Thursday, September 5, 2013

Numbers and Naturalty, part 3

After we leaned a bit about p-adic numbers, it's about time to return to the naturalty. Let me just discuss some hypotheses about the structure of the world we live in

Assume we live in the world that made of p-adic numbers. Yep, instead of $\mathbb{R}^3$, for instance we could live in $\mathbb{Z}_p^3$. Sounds crazy, because we are so accustomed to thinking about lines, axes and so on which in our geometrical imagination are tightly connected with the real numbers.

But can we treat it (our geometrical imagination) as the argument to reject the hypothesis of p-adic space? Well, we can't. There are many examples in which our geometrical intuition fails to discover the real world (non-Euclidean geometry is probably the most vivid one).

But there is another argument.
Let's look at special relativity theory. The key moment is we have spacetime instead of time separately and space separately. The space and the time have similar nature, but the time can't be p-adic variable, because it should be ordered (otherwise we can't talk about causality principle).

To be more precise, the elements of spacetime are partially ordered, but this ordering is based on comparison distance in Minkowski space (which is obtained using arithmetic operations) and zero. Anyway, ordering is needed, and we don't have it in p-adic numbers.

I wrote much about simplicity of real numbers and the simplicity of their definition. It's about time to talk about why they can't substitute real numbers (which doesn't imply they are useless).


  1. Real numbers do not depend on the radix you use, and this is essential. If I state that p-adic numbers should be used in some physical theory, I should also name the prime p. 2? 3? 5? I can't see any reason to prefer one number to another. The real numbers are the only.
  2. Ordering once again. The first step in theoretical physics is least action principle, which states that some function (action, helps Captain the Obvious) should be (locally) minimal on the solution trajectory. If you don't have ordering, the assertion like this cannot be stated.
  3. Every time we talk about optimization, we mean real values. The optimization criteria result should be in ordered field, and, based on the optimization theory, it's much better if the set or results is complete (otherwise there is no guarantee that solution exist).
    How many fields are there that are both ordered and complete?

    The answer is known: there is only one. It is $\mathbb{R}$
    (but note: the result doesn't have to belong to some field)


Saturday, August 10, 2013

Soviet computer "Сетунь"


P-adic numbers and numeric systems turned out to be very fruitful theme, and this post continues developing the ideas touched in the previous two articles.

It’s a common knowledge that all computers have a binary representation of numbers inside in accordance with von Neumann principles. Right?

Nope. There was computer that had inside ternary representation, this computer was developed in the USSR in 1958 at my alma mater faculty under the lead of Nikolay Petrovich Brusentsov. The computer was named „Setun” (Сетунь). Unfortunately all of the innovative ideas it was based on were buried, and computer industry followed the way we know today. But the history keeps these ideas for us, and some people (including me) believe that once these ideas would be used in industry again.

Let us start from ternary representation. The integer in radix-3 is represented as a finite sequence of digits from 0 to 2. Something like
21201
-1220
0
   
Right?

Nope. Well, that what we are so accustomed to, but that is not the only way. And definitely not the best one. I mentioned the 2-complement representation of negative integers that is used in modern computers. Now compare it with the trick. Let us use not digits 0,1,2 but 0, 1 and -1. This is called balanced ternary system. This would give the following representation for numbers (hereinafter I will write ! to denote -1, because blogger fails to represent usual $\overline{1}$)


1!1 = 9-3+1=7
11 = 4
10 = 3
1! = 2
01 = 1
00 = 0
0! = 1
!1 = -2
!0 = -3
!! = -4
      

Each number has the only representation, as usual. Note the symmetry of representation under negation (isn’t it awesome?). Moreover, there is no global sign ’minus’, all integer numbers are represented in some universal form!

There is one minor drawback: addition rules are a bit more complicated. For instance
  1
+ 1
---
 1!
     

It doesn’t play any role when implementing in microchip. But let’s now take a look at multiplication. Usual binary representation has a great advantage in multiplication that all results in multiplication table are of one digit. Compare it with ’usual’ radix-3 multiplication table.
  | 0  1  2
--------------
0 | 0  0  0
1 | 0  1  2
2 | 0  2 11
      
The 11 in the last row gives us unwanted curry we would have to take in account while implementing it in microchip.
BUT the numeral system implemented in „Сетунь” doesn’t have this drawback. Seems that it is the only non-binary system that doen’t have curry in multiplication:
  | 0  1  !
----------------
0 | 0  0  0
1 | 0  1  !
! | 0  !  1
      
What about other advantages? First is we need less digits to hold the same numbers. The ternary system is considered to be the most effective numeral system in the the sense of coding density (derivation of this fact can be found in Russian here, but to tell the truth I don’t consider this assertion to be right at all, the term „effective” is very disputable. The same information can be found on wikipedia, but still no answer for the question: why do we think that digit costs proportionally to the numeral system base?).

The negation in this system is extremely simple, moreover it is always correct.

Yes, the negation is incorrect operation sometimes in usual binary system. If you take $x = -2^{31}$ (assuming x is 32-bit integer), I think you would be surprised find out that $x == -x$. This is due to the asymmetry of the interval of possible values.

Some disadvantage is you can’t distinguish whether the number is negative or not by simply looking at the first bit. Comparison procedure is more complex, but multiplication operation doesn’t need some workarounds to work with negative numbers.

Back to p-adic numbers

One of the most important properties of real numbers is that they are ordered, that is we have comparison operation. There is much interesting connected with ordering if real numbers, once I will return to this topic.
Before reading further, I want you to think on the following problem: is there some natural ordering of p-adic numbers?


Think.

Well, the first idea is of course to use lexicographical ordering, but the numbers should be compared from the rightest digits.

For instance the following 7-adic numbers are ordered by ascending
...3515400.0
...0050250.0
...6425443.0
...6625443.0
...0000543.0
...0000000.01
      

Until this moment everything looks fine, but we forgot that the ordering by itself isn’t needed (remember that we can order any set?) until it is not connected somehow with other operations. For instance, for real numbers we have

a > b iff a+c > b+c for every a,b,c.


Exercise#1. Show that this doesn’t hold for p-adic numbers, even for p-adic integers, with such ordering.


Let’s now talk about another way to believe that there is no simple ordering rule.

I wrote about understanding p-adic integers as the inverse limit of residues. As we know already the group of residues modulo 3 may be represented not only by 0,1 and 2, but also by the set -1, 0, 1. This fact gives rise to another representation of 3-adic integers as infinite sequences of these three digits.

I’d rather start from some examples with integers
Decimal  Ternary     Balanced ternary
0        ...00000.0  ...00000.0
2/3      ...00000.2  ...00001.!
2        ...00002.0  ...0001!.0
-1       ...22222.0  ...0000!.0
-5       ...22211.0  ...001!!.0
      
Note that all integer numbers, including negative, have the infinite number of zero digits to the left. Looks much better, to my mind.

Of course, every 3-adic integer should have the corresponding representation in balanced ternary system and visa versa.


Exercise#2. Find out the conversion rules between these two 3-adic systems. Rigorify the answer by using the inverse limit of residues. Hint: look at the third and fourth lines of conversion table.


All the p-adic numbers are obtained by multiplying p-adic integers by $p^{-k}$, that is by shifting the sequences, thus we got the representation for all 3-adic numbers, not only integer ones.

Pros of symmetrization for 3-adic numbers are just the same: simplicity of negation, no curries at multiplication table.

But let’s return to the point we started from — we wanted to order p-adic numbers. The non uniqueness of the representation which seems very natural for 3-adic numbers, makes me believe that there is no appropriate lexicographical ordering or other simple way to order them. Just take a look again at the conversion table.

Monday, July 22, 2013

Numbers and Naturalty, part 2.

Well, the last time I wrote about p-adic and real numbers. As I mentioned there, p-adic numbers are simpler in the sense that you can easily compute last $n$ digits of the result having only the last digits of summands or multipliers.

And this is great advantage of their definition. To define the multiplication and summation of real numbers, you should have these operations defined on rational numbers (and some properties of these operations proved). Then, having defined the metric on $\Bbb{Q}$, one completes this set and redefines the operations by continuity. Well, this is not the simple thing, I hope you remember it from university mathematics courses.

Just the opposite thing with p-adic numbers. The definition of addition and multiplication is quite straightforward. But what is more interesting, there is an abstract construction, which can be used to define p-adic numbers. The construction is called the inverse limit

Remember I was talking about understanding a p-adic number as some limit? Let us consider now only p-adic integers, these are not usual integers. They may have infinitely many nonzero digits, but all the digits after the dot should be zero. Hereinafter in all the examples p=7.
 
  ...4123490       integer
  ...3459902.0     integer
  ...3459902       integer (the same as previous one)
      ...234       integer
  ...2314123.456   non-integer
      ...000.001   non-integer
Let us now consider only integer numbers. This set is closed under the operations of addition and multiplication. Moreover, the last $n$ digits of the result is fully defined by the last $n$ digits of operands.

   ...35143  +  ...01251  =  ...36424

          3  +         1  =         4
         43  +        51  =        24 
        143  +       251  =       424
       5143  +      1251  =      6424
      35143  +     01251  =     36424
        ...  +       ...  =       ...
Easy to see (and easy to prove using series representation) that truncations in $n$th line behave as residues modulo $7^n$. And the same is right for multiplication.
Why like residues? They are residues! Every p-adic integer can be considered as a sequence of residuals modulo $p^n, \; n=1,2, \dots$. For instance,

    3 mod $7$
   43 mod $7^2$
  143 mod $7^3$
 5143 mod $7^4$
35143 mod $7^5$
result: ...35143

Note that you cannot just take a sequence of arbitrary residues like

$x_1$    3 mod $7$
$x_2$   52 mod $7^2$
$x_3$  413 mod $7^3$
$x_4$ 6556 mod $7^4$
result: ...???

The residues should be consistent one with the others, namely, $x_n = x_{n+1}\mod p^n$, and that is what inverse limit is. To put is simply, there is a sequence of sets $X_1, X_2, \dots$. And some morphisms $f_{n+1,n}$ from $X_{n+1}$ to $X_n$. The inverse limit (denoted by $\varprojlim X_i$) is a set of all sequences $\{x_i\}: x_i \in X_i$, such that the following consistency properties are satisfied:
$$  f_{n+1,n}(x_{n+1}) = x_n $$
In the case under consideration $X_n = \Bbb{Z} / {p^n}\Bbb{Z}$, $f_{n+1,n} (x) = x \mod p^n$.
The most important moment: we have addition and multiplication defined on each $X_n$, and $f_{n+1,n}$ preserve these operations (they are homomorphisms). That's how we obtain multiplication and addition in the ring p-adic integers:  the result would satisfy consistency properties.

This is the simplest and the most vivid example of inverse limit, wikipedia article contains the general case with posets. Well, as you can see, this is purely algebraic construction, and mathematically it is more natural.

Exercise#1 (very easy): find cardinality of the set of p-adic numbers.
Exercise#2: recall that the distance between two p-adic numbers was defined as $p^{-n}$, where $n$ is the number of rightest digit in which two numbers do not coincide. Can we take $2^{-n}$ as the distance?
Exercise#3: prove that one can subtract two p-adic integer numbers.

Mapping Rational Numbers


The thing that is maybe not so obvoius is that all nonzero p-adic numbers are invertible (thus we have division operation). It is small but very helpful exercise. The second fact is p-adic numbers contain natural ones

Let us take some natural number in radix-7:  41524, for instance. The corresponding p-adic is ...000041524 = (0)41524, that is just has infinite number of zeros added to the left.

Now try to guess what is this number equal to:   .....666666?

The answer is -1. You may be wondering why. Try to add 1 and you will obtain zero. Or subtract one from zero.
The second way to see this is to compute -1 modulo $7^n$. Each time you will get $\underbrace{66...6}_{n}$.

If you have ever learned something about C programming language or assembler, this should remind you something...

If it doesn't, I will help you
00000001 = 1
00000000 = 0
11111111 = -1
11111110 = -2

Right, it is the two-complement number representation. The ...666666 is the 7-complement notion of -1.  It arises naturally in the p-adic numbers though in CS courses looks a bit strange.

Let's now think of rational numbers. Once we have division, our field of p-adic numbers should contain $1/2, 1/3, 1/5$ and so on.

What we can say immediately is that 7-adic form of $1/7$ is
...00000.1
and the form of $1/49$ is
...00000.01
and so on. But what about $1/4$? Let us compute it from the equation (remember all the numbers are in radix-7!)
$$...0004 \times x = ...0001  = (-1)\times(-1) = (-1) \times ...66666$$ $$x = (-1) \times ...66666 / 4 = (-1) \times ...010101 \times 66_7 / 4_7 $$ Some simple computations now: $$ 66_7 / 4_7 = 48_{10} / 4_{10} = 12_{10} = 15_7 $$ And the last step: $$ x = (-1) \times ...010101 \times 15_7 = ...151515 = ...515152 $$

Exercise#4: Make sure that $4 \times ...515152 = ...000001$
Exercise#5: Compute $1/5$ in the same way. Hint: $6666_7 = 2400_{10} = 5 \times 480_{10} =  1251_7$

This is not the only way to divide p-adic numbers, you may try to invent the other procedure (long division in p-adic numbers). As one can notice, the rational numbers in p-adic notion look very similar to their notion in real numbers, namely, their notion is periodic to the left starting from some point.


Sunday, July 21, 2013

Numbers and Naturalty, part 1.

Real numbers is the object that everyone deals with and knows well. They seem to be so natural (not in the mathematical sense) that nearly no one can think that our world is not "made" of real numbers.

The history remembers the time when people had no idea about real numbers. In the ancient Greece only rational ones were known and that were Pythagoreans who established, that the length of unit square diagonal is not rational.

Quantum physics (as the majority of today's physics theories) is based on real numbers (and complex one of course), for instance the space-time is considered to be $\mathbb{R}^4$.


It is a very common and strong belief that correct theory in theoretical physics should be "beautiful". Mathematically both simple and beautiful. But are real numbers so simple? This question raised up after I heard of p-adic quantum mechanics.

Let us compare these two objects. Start from real numbers. What is real number? That is something like
 3.14159265358979323846264...
 1.00000000000000000000000...
 0.99999999999999999999999...

That is some natural number and an infinite sequence of digits. The first moment is some rational numbers have more than two representations in such notion.

Ok, let's add the two numbers
 1.00000...
 0.99999...

Hmm... Guess the first symbol! One? Wrong!
 1.000002...
+0.999999...
------------
 2,00000....


Two then? Wrong again.
 1.000000...
+0.999998...
------------
 1,99999....


The confusing moment is you can never guarantee that given $n$ first digits of summands you would be able to compute at least first digit of the result. Before we proceed to p-adic numbers let's look on the real number in the following way, first we write it in an exponential form:
  $3.14159265358979... = 10^1 \times 0.314159265358979...$

And omit $10^1$ for a while. The essential information kept in 0.314159265358979... is simply the sequence of digits: 314159265358979...  (note: no natural number here, only the sequence now!). The sequence starts from some nonzero digit due to the exponential form.
 
 3
 31
 314
 3141
 31415
 314159
 3141592
 31415926
 314159265
 ...

Everything is finite now. We may think of it like we have some sequence of decimal rational numbers, which converge to initial real one.

Ok. How does it relates to p-adic number? First we choose some prime p, I will consider p=7 for example. This p is something like base of numeral system.

P-adic numbers look so (note the digits are 0,1,..,6, because p=7):
 ...341564461.54265
 ...6342360000.0
 ...360340.6

This looks very similar to real number with the only difference that the sequence is infinite to the left. Let's add some numbers. Just like in the school
 ...4461.42
+...1060.1
------------
 ...5551.52

What is more important, if you have last $n$ digits of summands, you can compute the last $n$ digits of their sum (which is really different from real numbers). The same story with multiplication. Moreover, each number  has the only representation. Sounds much simpler, right?

And the p-adic number is also a limit of it's truncations
       ...1.42
      ...51.42
     ...151.42
    ...3151.42
   ...23151.42
  ...423151.42
One may think so: latter digits are more important (unlike those in real number).

Series representation 

As we said, the real number may be written in the following form
$$10^k \times 0.x_1 x_2 x_3 x_4 \dots$$
Which means that the number can be also written in the following way
$$ \sum_{n=1}^{+\infty}   10^{k-n} x_n $$

And the same for p-adic numbers
$$10^{-k} \times \dots x_4 x_3 x_2 x_1.0  = \sum_{n=1}^{+\infty}   10^{n-k} x_n $$

"WAIT!" — you say, — "the series diverges!". Well, the convergence depends on the metric you use. And that is the part of the trick. P-adic numbers use their own metrics. In a nutshell, the distance between two p-adic numbers can be defined as $p^{-k}$, where k is the number of the rightest digit that is different in numbers, for instance

 ...1343.3
 ...1643.3      k=2, d = 1/49 

 ...4461.4531
 ...1060.6231   k=-1, d = 7

 ...3451.52
 ...5350.0      k=-2, d = 49 

Well. The post is already big enough, inverse limits and simplicity will be discussed later.