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

The PI Thread

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.



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?
pi is a ratio.
it reflects a given that is arbitrary.
random.
meh.
 
Consider a continuous normal probability distribution. There are an ifinye number of points, the proability of any finite number in the distribution is zero.

A probability can be found only over an interval by integrating between two points.

In an infinite sequence like PI I'd say the probability of any finite sequence is zero out of an infinite number possibilities..
 
Nitpick. ... 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.
Well, that's if you take probability to be metaphysical (metamathematical?). If you take probability to be merely a measurement of our ignorance, then philosophically it all works out fine. The beauty of probability theory is that the math works out the same regardless of one's philosophy; contrariwise, rejecting its conclusions is a recipe for losing your shirt when you gamble, even if the outcomes you're betting on are past events, or predetermined, or otherwise already known to a sufficiently omniscient being.

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?
I don't know the name of the branch, but yes, it's pretty easy to show the Goldbach Conjecture is "almost certainly true". There's a page on the broader topic here:

https://www.lesswrong.com/posts/iNF...onjecture-is-probably-correct-so-was-fermat-s

A curious counterintuitive implication is that a conjecture being "almost certainly true" typically makes it harder to prove, not easier.
 
If PI is uniformly distributed then each digit has a 1 in ten chance of appearing.
Over millions of digots I am sure yu can find all sorts of apparent patterns, some of which you can fit a model to.

Rgar us what numerology does, see patens in math and nature that are just coincidences and assign meaning.

As Bomb says, the math works regardless. Unless you think you have a 'system' to beat the odds in LV. You watch the dice tables and when you think yu see the pattern you bet on it.

How many digits are there in a file somewhere? Somebody must have gone through the digits and simply counted the number of times each digit occurs.


You flip a coin 100 times. Regardless of the actual sequence of H-T in the long run it will be 50/50 or close to it. In PI any number of sequences may occur in any finite sample of digits. Like LV gamblrs, you can draw a conclusion based on that.


o.
 
[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.

this was a great video.
 
For a data et of uniformly distributed integers 0 9 as n gets large larger sequences appear.

For 1 million numbers a sequence of 3 numbers appear with a constant percentage. I'd have to look up the probabilities for a random sequence, don't have it off the top of my head.

Get a file of PI digits and have at it. One good experiment is wortha thousand speculations.

clear
n = 1000000
y = grand(n, 1, "uin", 0, 9)
seq =[ 8 2 9 1 2 3 ]
[d,seq_length] = size(seq)
seq_count = 0
for i = 1:n - seq_length
hit_count = 0
for j = 1:seq_length
if (y(i + j - 1) == seq(j)) then
hit_count = hit_count + 1;
end;
end
if(hit_count == seq_length) then
seq_count = seq_count + 1;
end;
end
disp(seq_count)
histplot(10,y)
 
I downloaded a million digit PI file. There is a trillion digit file.

For the million digit file the distribution of number s is:

99959.
99758.
100026.
100229.
100230.
100359.
99548.
99800.
99985.
100106

Looks pretty much like a uniform distribution. The algorithms are not perfect based on finite arithmetic, so I would not expect it to be perfect.

The digit counts go up and down depending on how many digits are checked. As n gets large they vary around 10%.

You can probbly look for and find pasterns, I'd attribute that to the algorithms. Like flipping a coin and getting a short term patern, but in the long run getting close to 50/50.

In Scilab language
clear
s = "end of file reached"
mclose('all')
FILE ="C:\Users\Documents\pi\PI1MILDS.TXT"
[u,err] = mopen(FILE,'rt')
if(err < 0) then disp(err);error('file open err');end;
file("rewind", u)
nc = 48 // char 0-9 decimal 48-57
for i = 1:10 num(i) = nc; nc = nc + 1.;end;
for i = 1:10 count(i) = 0; end;
for i = 1:1000000
x = mget(1,'c',u)
if(x < 48 || x > 57) then disp(s);break; end; // end of file check
for j = 1:10 // count the digits
if(x == num(j))
count(j) = count(j) + 1
end
end
end
sum = 0 // make sure the bit counts = 1 million
for k = 1:10 sum = sum + count(k);end;
mclose('all')
disp(sum,count)
 
I compared a 1 million poit uniform distribution and a million pi digiy=ts.

The number of singledigts, and n = 1,2,33...digit sequences tracked. At an n = 7 sequence of digits there were no occurences. I imagine it would take more points to see how far it gors.

As n increases the number of occurrences appear to go down by a factor of 10. Haven't looked at any theory.
 
I think that the oldest known algorithm for calculating pi is Archimedes's algorithm.

It uses the inequality
sin(a) < a < tan(a)
where a is in radians, and is between 0 and pi/2.

Start with some value a(0) where one knows its trigonometric-function values. For instance,
  • cos(pi/3) = 1/2
  • cos(pi/4) = 1/sqrt(2)
  • cos(pi/5) = (sqrt(5)+1)/4
with
  • sin(a) = sqrt(1 - (cos(a))^2)
  • tan(a) = sin(a)/cos(a)
Thus,
  • sqrt(3)/2 < pi/3 < sqrt(3)
  • 1/sqrt(2) < pi/4 < 1
Then find the next value a(n+1) = a(n)/2 and use trig identities for the trig functions.
  • tan(a/2) = sin(a))/(1 + cos(a))
  • cos(a) = 1/sqrt(1 + (tan(a))^2)
  • sin(a) = cos(a)*tan(a)
As one proceeds, sin(a) and tan(a) will get closer and closer to each other, improving one's estimate of pi.

Using Taylor series, one can estimate how different they will be:
  • sin(a) ~ a - a^3/6 + ...
  • tan(a) ~ a + a^3/3 + ...
 
For a uniform distribution with numbers ranging from 0-9 which PI appears to approximate...

If the size n of the array is sufficiently large for a sequence length m the number of sequences in the array will be n/10^m.

So this is how mathematicians make money, nice work if you can get it.
 
Archimedes's algorithm as Euclid-style geometry:

For circle C and number of polygon sides n, construct two n-gons. An inner one that touches the circle, an inscribed one P. An outer one that also touches the circle, a circumscribed one Q.

Area(P) < Area(C) < Area(Q)

Start with some regular n-gons where one can calculate the area, like an equilateral triangle or a square. From them, find 2n-gons. Repeat to infinity.

Starting n of 3 or 4 or 5, and doubling of n are all operations that can be done with straightedge and compass.

Starting with a triangle,
NInOut
02.59807625.1961524
13.00000003.4641016
23.10582853.2153903
33.13262863.1596599
43.13935023.1460862
53.14103203.1427146
63.14145253.1418730
73.14155763.1416627
83.14158393.1416102
93.14159053.1415970
103.14159213.1415937
113.14159253.1415929
123.14159263.1415927

After the triangle is a hexagon, and that is what gives the inscribed-polygon estimate of 3.
 
Mathematica source code:
Code:
(* Given a number and a tangent, fill out the record *)
fillrec[nm_,tg_] := Module[{sn,cs},
cs = 1/Sqrt[1+tg^2];
sn = cs*tg;
{nm,sn,cs,tg}
]

(* Initial record: initial number, numerical-evaluation function *)
initrec[nm_,nf_:N] := fillrec[nm,nf[Tan[Pi/nm]]]

(* Next one *)
nextrec[rec_] := Module[{nm,sn,cs,tg},
{nm,sn,cs,tg} = rec;
fillrec[2*nm,sn/(1+cs)]
]

(* Repeat this algorithm's steps *)
recs[ni_,nm_,nf_:N] := NestList[nextrec,initrec[nm,nf],ni]

(* Estimate pi at each step *)
piest[ni_,nm_,nf_:N] := Transpose[Join[{Range[0,ni]},Transpose[#[[1]]*{#[[2]],#[[4]]}& /@ recs[ni,nm,nf]]]]

(* BBCode table *)
bbtbl[tbl_] := "[ table=\"class:grid\"]\n" <> StringRiffle[Map["[ tr]"  <> (StringJoin @@ #) <> "[ /tr]"&, Map["[ td]"<>ToString[#]<>"[ /td]"&,tbl,{2}],{1}],"\n"] <> "\n[ /table]"

bbtbl[Prepend[piest[12,3,N[#,8]&],{"N","In","Out"}]]
I cheated for the initial values, because Mathematica returns their symbolic expressions:

Tan[Pi/{3, 4, 5, 6}]
returns
{Sqrt[3], 1, Sqrt[5 - 2 Sqrt[5]], 1/Sqrt[3]}

Even if it didn't, then all the rest of the calculation would have done in Archimedes fashion.

Also, the BBCodes in bbtbl[tbl_] I altered to keep vB's interpreter from considering them proper BBCodes.
 
Here is another trigonometry-based formula for pi:

Vieta's Formula for Pi - ProofWiki
 Viète's formula

pi = 2 * (2/sqrt(2)) * (2/sqrt(2 + sqrt(2))) * (2/sqrt(2 + sqrt(2 + sqrt(2)))) * ...

The proof uses the angle-doubling trigonometric identities:

cos(2*x) = 2*(cos(x))^2 - 1
sin(2*x) = 2*sin(x)*cos(x)

2 = 2 * sin(pi/2) = 2^2 * sin(pi/4)*cos(pi/4) = 2^3 * sin(pi/8)*cos(pi/8)*cos(pi/4) = (2^n * sin(pi/2^n)) * cos(pi/2^n) * ... * cos(pi/4)

The first term on the end tends to pi as n tends to infinity. Thus,

pi = 2 / ( cos(pi/4) * cos(pi/8) * cos(pi/16) * ... )

Results:
NV
02
12.8284271
23.0614675
33.1214452
43.1365485
53.1403312
63.1412773
73.1415138
83.1415729
93.141588
103.141591
113.141592
123.141593
 
Mathematica source code:
Code:
(* Cosine half-series *)
cshfser[ni_,nf_:N] := Rest[NestList[Sqrt[(nf[1]+#)/2]&,0,ni]]

(* Accumulated product *)
prdaccum[xser_] := Module[{prod=1},
Join[{prod},Table[prod *= x,{x,xser}]]
]

(* Partial results *)
vtpi[ni_,nf_:N] := 2/prdaccum[cshfser[ni,nf]]

(* With numbers *)
vtpino[ni_,nf_:N] := Transpose[{Range[0,ni],vtpi[ni,nf]}]

vtpino[12,N[#,8]&]

There are numerous more recent formulas for pi.

A genre of formulas is sums of inverse tangents.

pi = sum over x in xlist of arctan(x)

for some list xlist

Here is a simple way to check such formulas.

arctan(x) = arg(1 + i*x) = Im(log(1 + i*x))

So sum over x of arctan(x) is Im(log( product over x of (1+i*x) )) = arg( product over x of (1+i*x) )

The inverse-tangent function itself can be calculated with a series:

arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
 
The calculus-based formulas also use trigonometric functions, though often indirectly.

Let's take a closer look at them. Here is a geometric definition of them:

Consider triangle ABC in a Euclidean plane where angle ABC is a right angle. Then, size(CAB) + size(BCA) = size(right angle).

Using a = size(CAB), the trigonometric functions are defined with

sin(a) = (BC)/(AC), cos(a) = (AB)/(BC), tan(a) = (BC)/(AB), cot(a) = (AB)/(BC), sec(a) = (BC)/(AB), csc(a) = (AC)/(BC)

One can easily derive identities like tan(a) = sin(a)/cos(a), and with the help of Pythagoras's theorem, (AB)^2 + (BC)^2 = (AC)^2, one can derive such identities as (cos(a))^2 + (sin(a))^2 = 1.

For zero angle, sin(0) = 0, cos(0) = 1, etc. and by geometrical construction, one can derive several other special values, like sin(RA) = 1, cos(RA) = 0, sin(RA/2) = cos(RA/2) = 1/sqrt(2), sin(RA/3) = cos(2*RA/3) = 1/2, sin(2*RA/3) = cos(RA/3) = sqrt(3)/2, etc. where RA = right angle. Also, sin(RA-a) = cos(a) and cos(RA-a) = sin(a).

Using a geometrical construction, one can derive the addition identities
sin(a+b) = sin(a)*cos(b) + cos(a)*sin(b)
cos(a+b) = cos(a)*cos(b) - sin(a)*sin(b)

To find what happens when one reverses the sign, we set a+b = 0. Then, tan(b) = - tan(a) and 1 = cos(a)*cos(b)*(1 + (tan(a))^2) = cos(b)/cos(a). This means that cos(b) = cos(a) and sin(b) = - sin(a), or
sin(-a) = - sin(a), cos(-a) = + cos(a)
 
Using the addition identities, one can derive double-angle and half-angle identities:
cos(2a) = cos(a)^2 - sin(a)^2 = 2*cos(a)^2 - 1
sin(2a) = 2*sin(a)*cos(a)

For positive integer n, we find
cos(n*a) = ChebT(n,cos(a))
sin(n*a) = sin(a) * ChebU(n-1,cos(a))
where ChebT and ChebU are the Chebyshev polynomials. An important feature is that they are polynomials and not some more complicated sorts of functions.

Returning to the doubling formula, we start with the right-angle values cos(RA) = 0 and sin(RA) = 1. For two right angles, half a circle, cos(2*RA) = -1 and sin(2*RA) = 0, and for four right angles, a complete circle, cos(4*RA) = 1 and sin(4*RA) = 0 -- wrapping around to the values for argument 0. Thus, the sine and cosine functions are periodic with period (full circle), and the tangent function periodic with period (half circle).


Doing some complex arithmetic, we can collapse the addition identities to
cos(a+b) + i*sin(a+b) = (cos(a) + i*sin(a)) * (cos(b) + i*sin(b))

This suggests that trig functions are related to exponential functions: cos(a) + i*sin(a) = T^a for some T.

The next question is what is T? I'll show how one can find its value without using calculus.

We use the addition identities and find a multiplication identity:
cos(n*a) + i*sin(n*a) = (cos(a) + i*sin(a))^n
or
cos(a) + i*sin(a) = (cos(a/n) + i*sin(a/n))^n

Let us now find out how the trig functions behave as one shrinks their args to zero. For that, we try shrinking by factors of 2, since we can then use the half-angle formulas:

cos(a/2) = sqrt((1+cos(a))/2) (nonnegative branch)
sin(a/2) = sin(a)/(2*cos(a/2))

Both sin(a) and cos(a) range between -1 and +1 inclusive for real a.

For cos(a) over the full range, cos(a/2) ranges between 0 and 1 inclusive, and cos(a/4) between 1/sqrt(2) and 1 inclusive. As n increases, cos(a/2^n) will continually increase if it is less than 1, and as it increases, its limiting value will be 1.

This means that sin(a/2^n) will continually decrease if cos(a/2^n) is greater than 1/2, which it will be for all n but maybe 0 or 1.


Getting back to the earlier power expression,
cos(a) + i*sin(a) = (cos(a/n) + i*sin(a/n))^n = (cos(a/n))^n * (1 + i*tan(a/n))^n

Using t = tan(a/n),
cos(a) + i*sin(a) = (1 + t^2)^(-n/2) * (1 + i*t)^n

If t is O(1/n), then (1 + t^2) = 1 + O(1/n^2) and (1 + t^2)^(-n/2) = 1 + O(1/n) tending to 1 for large n

Thus,
cos(a) + i*sin(a) = (1 + i*t)^n = (1 + i*t)^(1/(i*t) * (i*n*t)) = ( (1 + i*t)^(1/(i*t)) ) ^ (i*n*t)
As t -> 0, (1 + i*t)^(1/(i*t)) -> e, the base of the natural logarithms.

Thus, cos(a) + i*sin(a) = e^(i*n*tan(a/n)) = e^(i*n*sin(a/n)) as n -> infinity

If a is O(1), then n*sin(a/n) must be O(1), and sin(a/n) -> S*(a/n) for some constant S.

For convenience, we measure a in radians, and that means that S = 1. Thus, sin(x) -> x for x -> 0 for x in radians. Thus,

cos(x) + i*sin(x) = e^(i*x)

I derived it without using calculus, though I did use some infinite limits.
 
Now for some calculus. Let us do differentiation first, since that is relatively easy compared to integration.

df(x)/dx = limit of h -> 0 of (f(x+h) - f(x))/h

d(sin(x))/dx = (sin(x+h) - sin(x))/h = sin(x)*(cos(h)-1)/h + cos(x)*sin(h)/h for h -> 0 = cos(x)
d(cos(x))/dx = (cos(x+h) - cos(x))/h = cos(x)*(cos(h)-1)/h - sin(x)*sin(h)/h for h -> 0 = - sin(x)
d(tan(x))/dx = sec(x)^2, d(cot(x))/dx = - csc(x)^2, d(sec(x))/dx = tan(x)*sec(x), d(csc(x))/dx = - cot(x)*csc(x)

For the inverse functions, let us first derive the general result.
Let function g invert function f: f(g(x)) = g(f(x)) = x
Start with f(g(x)) = x and take derivs. With the chain rule,
d(f(y))/dy * d(g(x))/dx = 1 with y = g(x)
giving us
d(f(y))/dy = 1/ ( d(g(x))/dx )

Now the inverse trig functions. arcsin(x) is the inverse of sin(x)

d(arcsin(x))/dx = 1 / (d(sin(y))/dy) = 1/cos(y) = 1/sqrt(1 - x^2) where x = sin(y)
Etc.

Collecting these results,
d(arcsin(x))/dx = 1/sqrt(1 - x^2), d(arccos(x))/dx = - 1/sqrt(1 - x^2)
d(arctan(x))/dx = 1/(1 + x^2), d(arccot(x))/dx = - 1/(1 + x^2)
d(arcsec(x))/dx = 1/(x*sqrt(x^2-1)), d(arccsc(x))/dx = - 1/(x*sqrt(x^2-1))

Integration undoes differentiation, and I will do the arctan result, since it is relatively simple.
arctan(x) = integral from 0 to x over t of 1/(1 + t^2)

The integrand has a simple sort of series: 1 - t^2 + t^4 - t^6 + t^8 - ...
Integrating it gives us
arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 - ...
 
The perimeter of a circle one can approximate as the perimeter of a polygon in Archimedes fashion. For an n-gon, perimeter p is in terms of radius r:

2*n*r*sin(a) < p < 2*n*r*tan(a) where a = 2*(RA)/n where RA = right angle.

Since p = pi*(diameter) = 2*pi*r, we have n*sin(a) < pi < n*tan(a)

We can now find the size of a right angle in radians. sin(a) and tan(a) are close to a for small a, and we find
pi = 2*(RA)
giving us
RA = pi/2 radians

More generally, the length of an arc of a circle is r*a for radius r and angle at center a in radians.


That means that one can use integrals to calculate pi.

pi/2 = arcsin(1) = integral with x over 0 to 1 of 1/sqrt(1 - x^2)

pi/4 = arctan(1) = integral with x over 0 to 1 of 1/(1 + x^2) = 1 - 1/3 + 1/5 - 1/7 + 1/9 - ...

  List of formulae involving π has oodles of them
 
The number e is Euler's number, and an analogous name for pi is Archimedes's number.

 Proof that e is irrational
Euler's Number is Irrational - ProofWiki

More generally, e^x is irrational for every nonzero rational x

Uses the series e^x = 1 + x/1! + x^2/2! + x^3/3! + x^4/4! + ...

 Proof that π is irrational
Pi is Irrational - ProofWiki

Has several proofs, involving integrals of polynomials and trigonometric functions.

 Transcendental number
Euler's Number is Transcendental - ProofWiki

 Lindemann–Weierstrass theorem
Pi is Transcendental - ProofWiki

The Lindemann-Weierstrass theorem states that for a set of distinct algebraic numbers x, the set of e^x is linearly independent over the algebraic numbers. The x's may be complex.

It has the consequence that e^x is transcendental for all nonzero algebraic x.

Since e^(pi*i) = -1 and -1 is algebraic, then pi*i must be transcendental. Since i is algebraic, then pi must be transcendental.
 
 Gelfond–Schneider theorem
Gelfond-Schneider Theorem - ProofWiki

Let x be an algebraic number other than 0 and 1
Let y be an irrational algebraic number
Both x and y may be complex, and y can be a complex rational number with nonzero imaginary part

Then x^y is transcendental.

 Baker's theorem

It has this consequence. Consider a set of pairs of numbers (x,y) that satisfy the conditions for the G-S theorem, and also that the y's along with 1 are linearly independent over the rational numbers.

Then the product over the (x,y)'s of x^y is transcendental.


These are all special cases of  Schanuel's conjecture, but it's still a conjecture.


Getting back to trig functions and pi,

(any trig function) of ( (nonzero rational number) * pi ) is algebraic
Proof: using Chebyshev polynomials

(any trig function) of (nonzero algebraic number) is transcendental
 
Back
Top Bottom