• Welcome to the new Internet Infidels Discussion Board, formerly Talk Freethought.

The PI Thread

steve_bank

Diabetic retinopathy and poor eyesight. Typos ...
Joined
Nov 9, 2017
Messages
13,834
Location
seattle
Basic Beliefs
secular-skeptic
A lot of interest and a lot of historical work

https://en.wikipedia.org/wiki/Approximations_of_π

Approximations for the mathematical constant pi (π) in the history of mathematics reached an accuracy within 0.04% of the true value before the beginning of the Common Era (Archimedes). In Chinese mathematics, this was improved to approximations correct to what corresponds to about seven decimal digits by the 5th century.
Further progress was not made until the 15th century (through the efforts of Jamshīd al-Kāshī). Early modern mathematicians reached an accuracy of 35 digits by the beginning of the 17th century (Ludolph van Ceulen), and 126 digits by the 19th century (Jurij Vega), surpassing the accuracy required for any conceivable application outside of pure mathematics
Further progress was not made until the 15th century (through the efforts of Jamshīd al-Kāshī). Early modern mathematicians reached an accuracy of 35 digits by the beginning of the 17th century (Ludolph van Ceulen), and 126 digits by the 19th century (Jurij Vega), surpassing the accuracy required for any conceivable application outside of pure mathematics.
The record of manual approximation of π is held by William Shanks, who calculated 527 digits correctly in the years preceding 1873. Since the middle of the 20th century, the approximation of π has been the task of electronic digital computers (for a comprehensive account, see Chronology of computation of π). In March 2019 Emma Haruka Iwao, a Google employee from Japan, calculated to a new world record length of 31 trillion digits with the help of the company's cloud computing service.[1] The record was surpassed on January 29, 2020 by Timothy Mullican,[2] who calculated to 50 trillion digits using retired enterprise server equipment and the software y-cruncher.[3]
 
Gregory-Liebnitz
PI/4 = 1/1 - 1/3 + 1/5 - 1/7 + ...

It is not very efficient. The iteration was sampled at 10, 100,1000..,, Tok a few minutes to run. A dedicated board could be designed just to compute pi as fast as possible.
-----------------------------------------
3.23231580940559393 10
3.15149340107099141
3.14259165433954424
3.14169264359053457 10,000
3.14160265348972034
3.14159365358877452
3.14159275358978141
3.14159266358932587 100,000,000
-----------------------------------------
3.1415926535 8979323846 …...PI

clear
// Gregory-Liebnitz
//PI/4 = 1/1 - 1/3 + 1/5 - 1/7 + ...
dp = 10
_sum = 1
n = 3
n_terms = 100000000
_sign = 0
k = 1
for(i = 1:n_terms)
.... if(_sign == 0) then
......._sum = _sum - (1/n)
........_sign = 1
.... else
.... _sum = _sum + (1/n)
......._sign = 0
.... end
....n = n + 2
.... if(i == dp)
......._p(k) = 4 * _sum
.......k = k + 1
........dp = dp * 10
....end
end
_pi = _sum * 4
format(20)
disp(_pi,dp)
 
Gregory-Liebnitz
PI/4 = 1/1 - 1/3 + 1/5 - 1/7 + ...

It is not very efficient. The iteration was sampled at 10, 100,1000..,, Tok a few minutes to run. A dedicated board could be designed just to compute pi as fast as possible.
-----------------------------------------
3.23231580940559393 10
3.15149340107099141
3.14259165433954424
3.14169264359053457 10,000
3.14160265348972034
3.14159365358877452
3.14159275358978141
3.14159266358932587 100,000,000
-----------------------------------------
3.1415926535 8979323846 …...PI

clear
// Gregory-Liebnitz
//PI/4 = 1/1 - 1/3 + 1/5 - 1/7 + ...
dp = 10
_sum = 1
n = 3
n_terms = 100000000
_sign = 0
k = 1
for(i = 1:n_terms)
.... if(_sign == 0) then
......._sum = _sum - (1/n)
........_sign = 1
.... else
.... _sum = _sum + (1/n)
......._sign = 0
.... end
....n = n + 2
.... if(i == dp)
......._p(k) = 4 * _sum
.......k = k + 1
........dp = dp * 10
....end
end
_pi = _sum * 4
format(20)
disp(_pi,dp)

The fraction 355/113 appears to be about as accurate as your million iterations.

It’s easy to remember because of the doubles of the first three odd whole numbers 1, 3, and 5.
 
So a philosophical question: if Pi continues forever, is every possible combination of digits present? And if so, does Pi ever repeat itself. We’ve gotten an answer of no out to 50 trillion digits, every digit further makes it that much less likely to happen.

As an aside, in the book Contact, not the movie, Ellie is told by the aliens that there’s a message in Pi, but only in base 11 digits and is out at something like 10^12, about the same as Mullican has gotten. A series of ones and zeros that image a line through a circle.
 
...
The fraction 355/113 appears to be about as accurate as your million iterations.

It’s easy to remember because of the doubles of the first three odd whole numbers 1, 3, and 5.

Very cool:
Milü (Chinese: 密率; pinyin: mì lǜ; "close ratio"), also known as Zulü (Zu's ratio), is the name given to an approximation to pi found by Chinese mathematician and astronomer, Zǔ Chōngzhī (祖沖之), born 429 AD. Using Liu Hui's algorithm (which is based on the areas of regular polygons approximating a circle), Zu famously computed pi to be between 3.1415926 and 3.1415927 and gave two rational approximations of π, 22/7 and 355/113, naming them respectively Yuelü 约率 approximate ratio) and Milü.

355/113 is the best rational approximation of pi with a denominator of four digits or fewer, being accurate to 6 decimal places. It is within 0.000009% of the value of pi, ...
 
I stared the thread because it may be of some interest. I coded one of the algorithms out of curiosity, one of apparently many algorithms that exist.
There are a number of simple ratios.

I remember 3.14159. If I need more accuracy I press the PI key on a calculator. or use the built in constant in the tool I use.


Based on a search it appears the digits are a uniform distribution, but some claim there are patterns or sequence that can appear more often.
 
So a philosophical question: if Pi continues forever, is every possible combination of digits present? And if so, does Pi ever repeat itself. We’ve gotten an answer of no out to 50 trillion digits, every digit further makes it that much less likely to happen.

As an aside, in the book Contact, not the movie, Ellie is told by the aliens that there’s a message in Pi, but only in base 11 digits and is out at something like 10^12, about the same as Mullican has gotten. A series of ones and zeros that image a line through a circle.

Pi is not rational. It has been proved irrational. Pi will never "repeat itself" except in the way, say, "31415962" might reappear somewhere in the series.

As to digital bases and the value of a subseries though, that's all just numerology at that point; just find the base that gives you the result you wish and you will find that result.
 
[YOUTUBE]gMlf1ELvRzc[/YOUTUBE]
Here's a YouTube showing how Sir Isaac Newton applied his methods to develop a series formula for pi that converges much faster than anything previous. (Integrating a binomial expansion to find a formula for the area of a quarter-circle may have been easy for a guy like him, but he cleverly realized that integrating to 1/2 instead of 1 would give much faster convergence.)

Some two centuries later, Srinivasa Ramanujan came up with a ridiculous formula for pi that converges ridiculously fast.
 
It is supposed — though no proof is known — that pi is a  Normal number in every base, and contains, somewhere in its base-n expansion, every possible string of digits. If those digits are mapped to Ascii (or Unicode) the original text to The Tragedy of Hamlet, Prince of Denmark will be found, infinitely many times. However, when you scan the digits, before reaching the first authentic Hamlet you will encounter zillions of bogus versions in which Hamlet, like Oedipus, killed his father and marries his mother.
 
So a philosophical question: if Pi continues forever, is every possible combination of digits present? And if so, does Pi ever repeat itself. We’ve gotten an answer of no out to 50 trillion digits, every digit further makes it that much less likely to happen.

As an aside, in the book Contact, not the movie, Ellie is told by the aliens that there’s a message in Pi, but only in base 11 digits and is out at something like 10^12, about the same as Mullican has gotten. A series of ones and zeros that image a line through a circle.

Pi is not rational. It has been proved irrational. Pi will never "repeat itself" except in the way, say, "31415962" might reappear somewhere in the series.

As to digital bases and the value of a subseries though, that's all just numerology at that point; just find the base that gives you the result you wish and you will find that result.

The fact that Pi is irrational does not preclude the possibility that it repeats itself, but that it cannot repeat itself ad infinitum. It could repeat itself 200 times and then suddenly start spitting out random digits again and then the Koran in ASCII. The question of whether it repeats itself even once in an infinite series is a serious question of mathematical philosophy. If it’s infinite, then aren’t all possibilities eventually met?
 
So a philosophical question: if Pi continues forever, is every possible combination of digits present? And if so, does Pi ever repeat itself. We’ve gotten an answer of no out to 50 trillion digits, every digit further makes it that much less likely to happen.

As an aside, in the book Contact, not the movie, Ellie is told by the aliens that there’s a message in Pi, but only in base 11 digits and is out at something like 10^12, about the same as Mullican has gotten. A series of ones and zeros that image a line through a circle.

Pi is not rational. It has been proved irrational. Pi will never "repeat itself" except in the way, say, "31415962" might reappear somewhere in the series.

As to digital bases and the value of a subseries though, that's all just numerology at that point; just find the base that gives you the result you wish and you will find that result.

The fact that Pi is irrational does not preclude the possibility that it repeats itself, but that it cannot repeat itself ad infinitum. It could repeat itself 200 times and then suddenly start spitting out random digits again and then the Koran in ASCII. The question of whether it repeats itself even once in an infinite series is a serious question of mathematical philosophy. If it’s infinite, then aren’t all possibilities eventually met?

Well that's the question; is pi 'Normal' or not? It is, arguably, a question of little value except in esoteric statistical theorems. Ipetrich? Can you Wiki it for us and tell us how certain definable numbers are proved to be normal?

IIRC, it has been proven that almost all numbers are normal.

Trivially, a gurble at the heart of pi number theory MIGHT make it impossible to have one particular 21-digit number (900,666,666,666,666,666,009) to ever occur. Is such a gurble possible? Surely the odds are against it, but might other more complex and clever gurbles exist, which inhibit normality?

Pi's mysteries are far from completely explored.

Instead of pi, suppose we're speaking of some number x, a "perfectly random" infinite sequence of digits.

Careful now! In the art, perfect random digits may be DEFINED as those best at passing whatever RNG test ensembles are devised. This leads to a circular argument? : IF the digits are "random" THEN x is Normal. (Otherwise the RNG would have flunked a sufficiently stringent Tester.)
 
The fact that Pi is irrational does not preclude the possibility that it repeats itself, but that it cannot repeat itself ad infinitum. It could repeat itself 200 times and then suddenly start spitting out random digits again and then the Koran in ASCII. The question of whether it repeats itself even once in an infinite series is a serious question of mathematical philosophy. If it’s infinite, then aren’t all possibilities eventually met?
So by "repeat itself", I take it you mean to ask for any M and B, whether there exists N such that pi = [d-1]d0.d1...dM...dNdM...dNdX... . I.e., B is the base of the number system, M is the number of digits you disregard at the beginning of the sequence, and (N - M + 1) is the length of the repeated sequence. The answer, of course, is it depends on what M and B you pick. For instance, in base 2,

pi = 11.00100100001111110...

So for M=1 and B=2, yes, pi repeats itself: 001 001

Naturally, you can certainly find an arbitrarily long repeated sequence like this in any base you please provided you allow M to be sufficiently large. So the question is only interesting if we require M to be 1, i.e. we don't include the "3" at the front, or else we require M to be 0 (-1 in bases 2 and 3) if we do include the "3".

When you lay out the question like this and pick an M, it has a probabilistic answer. The chance it repeats with N=1 is 1/B; the chance it repeats with N=2 is 1/B2, and so forth. So the chance that it ever repeats at all is roughly the infinite sum (1/B + 1/B2 + ...) minus the terms corresponding to any N that you've already inspected and verified that pi doesn't repeat after N digits. For some bases it repeats early; in base 8 it's 3.11...; in base 22 it's 3.3..., for instance. For most bases it doesn't repeat early, which wipes out all the big terms in the above infinite series, which means it probably never repeats at all.

Point being, I'm not seeing any philosophical question here. It's either "Yes, here's N.", or else it's "Maybe, maybe not; here are the current odds; here's how to reduce the uncertainty.".
 
The fact that Pi is irrational does not preclude the possibility that it repeats itself, but that it cannot repeat itself ad infinitum. It could repeat itself 200 times and then suddenly start spitting out random digits again and then the Koran in ASCII. The question of whether it repeats itself even once in an infinite series is a serious question of mathematical philosophy. If it’s infinite, then aren’t all possibilities eventually met?
So by "repeat itself", I take it you mean to ask for any M and B, whether there exists N such that pi = [d-1]d0.d1...dM...dNdM...dNdX... . I.e., B is the base of the number system, M is the number of digits you disregard at the beginning of the sequence, and (N - M + 1) is the length of the repeated sequence. The answer, of course, is it depends on what M and B you pick. For instance, in base 2,

pi = 11.00100100001111110...

So for M=1 and B=2, yes, pi repeats itself: 001 001

Naturally, you can certainly find an arbitrarily long repeated sequence like this in any base you please provided you allow M to be sufficiently large. So the question is only interesting if we require M to be 1, i.e. we don't include the "3" at the front, or else we require M to be 0 (-1 in bases 2 and 3) if we do include the "3".

When you lay out the question like this and pick an M, it has a probabilistic answer. The chance it repeats with N=1 is 1/B; the chance it repeats with N=2 is 1/B2, and so forth. So the chance that it ever repeats at all is roughly the infinite sum (1/B + 1/B2 + ...) minus the terms corresponding to any N that you've already inspected and verified that pi doesn't repeat after N digits. For some bases it repeats early; in base 8 it's 3.11...; in base 22 it's 3.3..., for instance. For most bases it doesn't repeat early, which wipes out all the big terms in the above infinite series, which means it probably never repeats at all.

Point being, I'm not seeing any philosophical question here. It's either "Yes, here's N.", or else it's "Maybe, maybe not; here are the current odds; here's how to reduce the uncertainty.".
No. By repeat itself, I mean the digits start all over ...31415... for example, sqr(2) repeats itself right off the bat. 1.414... after that it never does, at least as far as we know.
 
So by "repeat itself", I take it you mean to ask for any M and B, whether there exists N such that pi = [d-1]d0.d1...dM...dNdM...dNdX... ....

When you lay out the question like this and pick an M, it has a probabilistic answer. The chance it repeats with N=1 is 1/B; the chance it repeats with N=2 is 1/B2, and so forth. So the chance that it ever repeats at all is roughly the infinite sum (1/B + 1/B2 + ...) minus the terms corresponding to any N that you've already inspected and verified that pi doesn't repeat after N digits. ...

Point being, I'm not seeing any philosophical question here. It's either "Yes, here's N.", or else it's "Maybe, maybe not; here are the current odds; here's how to reduce the uncertainty.".
No. By repeat itself, I mean the digits start all over ...31415... for example, sqr(2) repeats itself right off the bat. 1.414... after that it never does, at least as far as we know.
That's a particular case of the general problem as I laid it out -- you're specifying M=0 and B=10. So in base 10, for that definition of "repeat itself", pi almost certainly never repeats itself: the probability that it does is about (1/10K + 1/10K+1 + ...), i.e. (10 / 9) / 10K, where K is currently about 31 trillion. That's pretty dang close to certainty. On the other hand, there are other bases where it does repeat itself, such as base 22.

(Incidentally, the fact that it repeats in base 22 is not an accident -- it's a consequence of the fact that 22/7 is a decent approximation of pi.)
 
So by "repeat itself", I take it you mean to ask for any M and B, whether there exists N such that pi = [d-1]d0.d1...dM...dNdM...dNdX... ....

When you lay out the question like this and pick an M, it has a probabilistic answer. The chance it repeats with N=1 is 1/B; the chance it repeats with N=2 is 1/B2, and so forth. So the chance that it ever repeats at all is roughly the infinite sum (1/B + 1/B2 + ...) minus the terms corresponding to any N that you've already inspected and verified that pi doesn't repeat after N digits. ...

Point being, I'm not seeing any philosophical question here. It's either "Yes, here's N.", or else it's "Maybe, maybe not; here are the current odds; here's how to reduce the uncertainty.".
No. By repeat itself, I mean the digits start all over ...31415... for example, sqr(2) repeats itself right off the bat. 1.414... after that it never does, at least as far as we know.
That's a particular case of the general problem as I laid it out -- you're specifying M=0 and B=10. So in base 10, for that definition of "repeat itself", pi almost certainly never repeats itself: the probability that it does is about (1/10K + 1/10K+1 + ...), i.e. (10 / 9) / 10K, where K is currently about 31 trillion. That's pretty dang close to certainty. On the other hand, there are other bases where it does repeat itself, such as base 22.

(Incidentally, the fact that it repeats in base 22 is not an accident -- it's a consequence of the fact that 22/7 is a decent approximation of pi.)

But how can you talk about probabilities for an infinite sequence of digits?
 
I don't see how you can derive a finite probability for an infinite number. PI is not a number. The usage of PI is alwas a finit number.
 
But how can you talk about probabilities for an infinite sequence of digits?
Loosely speaking*, the probability that pi ever repeats in the way you describe is simply the probability that it repeats after 1 digit, plus the probability that it repeats after 2 digits, plus the probability that it repeats after 3 digits, and so forth, forever. Each of those individual terms is a probability about a finite sequence of digits; so the only infinity here is that it's a sum of infinitely many terms. So the probability is simply an "infinite series"; mathematicians have known how to add those up for centuries. You have to do some algebra to derive a formula for the "limit", which is a number that you expect the successive sums as you include more and more terms to get closer and closer to, and then you have to show "convergence", i.e., that the difference between the sum of a finite number of terms and the limit will eventually get smaller than any positive number, and stay smaller.

(* There's an ugly complication when you do this for probabilities. Let's imagine we're back in the 1500s and all we know is that pi is a smidgen over 3.14. Then the probability that it repeats after 6 digits is the probability that digits 0 through 5 are 3 1 4 x y z, which is a certainty since we'll just label the unknown digits 3, 4 and 5 "x, y and z", times the probability that the unknown digits 6 through 11 are also 3 1 4 x y z. How likely is that? Easy-peasy: one in a million.

Likewise, the probability that it repeats after 3 digits is simply the probability that x, y, and z are 3, 1, and 4. That's one in a thousand: 0.1%. So far so good. Now comes the ugly complication. What's the chance that it repeats after either 3 or 6 digits? The sum of the two probabilities, 0.1001%, right? Wrong. You have to take into account the possibility that it repeats after 6 digits AND x, y, and z are 3, 1, and 4. (1 in a billion.) Pi just might repeat after 3 digits and ALSO repeat after 6 digits: 3.14314314314uvw... So if you just casually add the probabilities 1/1000 to 1/1000000, then you've counted that possibility twice, so you'll very slightly overestimate the total probability. Properly taking that sort of possibility into account is a pain in the ass and it's a tiny correction, so we might as well neglect it.

If we neglect that tiny correction, back when all the digits we had were 3.14, the total probability that pi ever repeated was 0.111...%, which is to say, one chance in nine hundred. Each time we discovered a new digit and didn't see it repeat, the odds against it ever repeating got longer.)
 
Having nothing better to do right now I calculated PI by integrating a quarter circle radius 1.

With enough resolution, upwards of 10000, it was accurate to 10 places. Rectangle and trapezoid integration got 5 or 6 decimal places.

Using a Scilab spline interpolation integration function I got 10 decimal places.

PI = area iuth r = 1.
 
Having nothing better to do right now I calculated PI by integrating a quarter circle radius 1.

With enough resolution, upwards of 10000, it was accurate to 10 places. Rectangle and trapezoid integration got 5 or 6 decimal places.

Using a Scilab spline interpolation integration function I got 10 decimal places.

PI = area iuth r = 1.
yeah that is fascinating.
 
Having nothing better to do right now I calculated PI by integrating a quarter circle radius 1.

Did you watch the video I linked above? The long video is tedious, but the details of Newton's pi calculation are interesting. He had no calculator with a SQRT button; he used binomial expansion.

YOUTUBE: gMlf1ELvRzc
Here's a YouTube showing how Sir Isaac Newton applied his methods to develop a series formula for pi that converges much faster than anything previous. (Integrating a binomial expansion to find a formula for the area of a quarter-circle may have been easy for a guy like him, but he cleverly realized that integrating to 1/2 instead of 1 would give much faster convergence.)

He got the super-fast convergence by calculating the area of a 30° segment (and the area-¼ triangle to its side) instead of a 90° segment.

In the same post I linked to Ramanujan's famous formula. Checking my folders I find a 'bc' script I wrote years ago to implement that formula:
Code:
scale = 65
b = 1103
k = 0; a = 1; c = 1; d = 1; s = b;

define iter () {
        k += 1
        a *= 4*k * (4*k-1) * (4*k-2) * (4*k-3)
        b += 26390
        c *= k
        d *= 396^4
        s += a * b / d / c^4
        return 99 * 99 / s / sqrt(8)
}

iter()
iter()
iter()
Here's the output, with wrong digits dimmed:
3.14159265358979387799890582630601309421664502932284887917396379150
3.14159265358979323846264906570275889815667748046233478116839959564
3.14159265358979323846264338327955527315997421042037991121670389600

... and keep getting EIGHT more digits of precision for every additional call to iter().


But how can you talk about probabilities for an infinite sequence of digits?
Loosely speaking*, the probability that pi ever repeats in the way you describe is simply the probability that it repeats after 1 digit, plus the probability that it repeats after 2 digits, plus the probability that it repeats after 3 digits, and so forth, forever. Each of those individual terms is a probability about a finite sequence of digits; so the only infinity here is that it's a sum of infinitely many terms.

Nitpick. I saw the asterisk after "Loosely speaking" and assumed you'd made the following point in a footnote. But no.
You describe a probability calculation applied to random digits. But pi is not random, even though it appears to be. For starters the "probability" you seek about pi isn't the sum of an infinite series, it is — at least for a sufficiently omniscient being — either exactly Zero or exactly One.

I think there's a little branch of mathematics which tries to estimate "probabilities" of truth for things like Goldbach Conjecture. I know nothing about it: Report, please?
 
Back
Top Bottom