Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

This is one of my favourites: in 1840 the German mathematician Dirichlet proved an elegant theorem, known as “Dirichlet’s approximation theorem“. The proof is surprisingly simple, but the usefulness of the proposition in some fields of mathematics, such as Diophantine analysis is remarkable. It goes as follows:

Let a be a real number and N be a positive integer. Then, there exist two integers p and n with 1 <= n < N such that |na – p| < 1/N

It is clear that without loss of generality, the value of a can be assumed in (0,1). In this case also 1 <= p < N. So we are actually looking for integers 1 <= n,p <= N-1, or (N-1)^2 pairs. At least one of them, says Dirichlet, satisfies the above inequality. Now let’s see how many there are, or how far from “Exactly one” is this “at least one”. This is something Dirichlet could not have done by hand. The following R code is for N = 3 to 100. It is quite slow, probably because of the many for-loops.

It seems that the two frequencies converge; in about 48% of the cases there exists exactly one pair (n,p) satisfying the inequality and in about 39% of the cases there exist exactly two. I wonder if it is possible to work with these two probabilities theoretically.

Related

To leave a comment for the author, please follow the link and comment on their blog: infoRύχος » R.