algorithm that can distinguish between a sequence of PI digits and a sequence of pseudorandom digits of equal length

It doesn't seem to fade away quite as quickly as I would have expected. But I am not convinced his algorithm is showing what he claims.

If you want to try something that might work try binning the values taken one digit, two digits, three digits at a time etc.

Entropy dedined as sum -p[i].log(p[i])

Where p[i] = n[i]/{sum n[i]}

Maximum entropy with N bins is log(N) when p[i]=1/N

You should see that the number of counts falling in each bin obeys fairly consistent statistics with equal probability to within the sampling limitations as the sequence length is increased.

Compressibility is just a crude proxy for entropy.

It is a very hard problem to prove the normality of pi or log(2) see

formatting link

--
Regards, 
Martin Brown
Reply to
Martin Brown
Loading thread data ...

I should have added, that you should apply the same algorithm to other irrationals. I suspect that 1% is an insignificant coincidence.

Reply to
Tom Del Rosso

Kinda silly, what if you write down pi is base 8, or base 16. Do you think there is something special about base 10?

George H.

Reply to
George Herold

Hi,

Thanks, that paper mentions "chaotic dynamics" in the pi sequence, which I agree it appears that pi is a fractal sequence.

The way I think pi is a fractal sequence is that from all locations n in the sequence, as you increase the sample of digits taken, there is what looks like a corresponding sine wave modulation in the periodicity of the sample, and this modulation pattern of periodicity change is common to all initial digit locations in the sequence, ie the starting point for n could be at digit zero or digit 100million etc.

Graph of averaged different n's for pi at multiple sequence lengths compared to pseudorandom sequence:

formatting link

cheers, Jamie

Reply to
Jamie M

I don't see how your data indicates anything like consistent periodicity. I think you are confusing compressibility with periodicity. It is very likely that the patterns that can be compressed out vary with the different sample sets. If you are looking for repetition of some sort, why don't you perform auto regression analysis?

--

Rick
Reply to
rickman

Hi,

The periodic pattern is a pattern apparently centered on each digit of pi, where the periodicity decreases with possible sine wave modulation as the surrounding digits are added to the sample.

The algorithm I used is a periodicity detecting compression algorithm. It has no dictionary so is a bit strange, and is implemented with recursion. I made the algorithm for basic AI research, and was testing it on some sequences of numbers when I noticed the discrepancy in compression between pi and pseudorandom sequences.

Here's the 32bit version of the recursive compressor code in C#:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace ConsoleApplication1 { public class ChirpletInfo { public ChirpletInfo(int position) { this.Count = 1; this.Position = position; } public int Count { get; private set; } public int Position { get; private set; } public void IncrementCount() { Count++; } } public class ChirpletPair { public ChirpletPair(int v1, int v2) { this.Value1 = v1; this.Value2 = v2; } public int Value1 { get; private set; } public int Value2 { get; private set; }

public override bool Equals(object obj) { ChirpletPair p = obj as ChirpletPair; if(p!= null) { return p.Value1 == this.Value1 && p.Value2 == this.Value2; } else { return false; } } public override int GetHashCode() { return Value1 * 31 + Value2 * 13; } public override string ToString() { return String.Format("{0},{1}", Value1, Value2); } } public class Node { public Node(int position, ChirpletPair pair) { this.Position = position; this.Pair = pair; } public int Position { get; private set; } public ChirpletPair Pair { get; private set; } public List Noise { get; private set; } public List GapOccurrence { get; private set; } public List Children { get; private set; } public override string ToString() { return String.Format("C{0}({1})", Position, Pair == null ? "null": Pair.ToString()); }

public string GetChirpletString(int depth = 0) { string indent = String.Concat(Enumerable.Range(0, depth).Select(a => " ").ToList()); StringBuilder results = new StringBuilder(); results.AppendLine(indent + ToString() + GetNoiseString()); if(Children!= null) { foreach (var c in Children) { results.Append(indent + c.GetChirpletString(depth +

1)); } }

return results.ToString(); } public string GetNoiseString() { return string.Format("[{0}]", string.Join(",", Noise)); //return null; } public void DeleteGapOccurrence() { GapOccurrence.Clear(); GapOccurrence = null; } public void SetNoise(IEnumerable noise) { Noise = noise.ToList(); } public IEnumerable GetIndices() { yield return Position; yield return Position + 1; int pos = Position; for (int i = 0; i < GapOccurrence.Count; i++) { yield return pos + GapOccurrence[i]; yield return pos + GapOccurrence[i] + 1; pos += GapOccurrence[i]; } } public void AddGap(int gap) { if(GapOccurrence == null) { GapOccurrence = new List(); } GapOccurrence.Add(gap); } public void AddChild(Node n) { if(Children == null) { Children = new List(); } this.Children.Add(n); } }

public class ChirpletCompressor { public IEnumerable GetNoise(IList nodes, IList data) { HashSet indices = new HashSet(); foreach(var n in nodes) { foreach(int i in n.GetIndices()) { indices.Add(i); } }

for(int i = 0; i 2) { Node n = newNodes[c]; int gap = i - n.GapOccurrence.Sum() - 1 - info.Position; n.AddGap(gap); } } else { chirpletCounts.Add(c, new ChirpletInfo(i - 1)); } } } var noise = GetNoise(newNodes.Values.ToList(), data); node.SetNoise(noise); foreach (var n in newNodes) { node.AddChild(n.Value); Compress(n.Value, n.Value.GapOccurrence); if (n.Value.Children != null && n.Value.Children.Count > 0) { // n.Value.DeleteGapOccurrence(); } } } } }

cheers, Jamie

Reply to
Jamie M

You can't just use word salad like that.

TBH I suspect that pi will eventually be proved to be not normal at least in base 16 since there is a clever way known to compute the Nth digit of pi in that base without summing up all the terms.

It is a curious problem. I doubt that he is seeing anything more than coincidental matches here and there. As someone else pointed out e has even more statistically improbable 4 digit sequences back to back.

It helps make it easier to remember but that is all.

--
Regards, 
Martin Brown
Reply to
Martin Brown

hi,

Here is a spreadsheet I made showing a version of the compression algorithm from when I was designing it:

formatting link

The input test sequence is in column B, and then the steps of compression progress through the spreadsheet to the right, and the final compressed result is at column GD :D

It is a recursive tree compression algorithm, good to find periodicity and fractals etc.

cheers, Jamie

Reply to
Jamie M

I wonder if the BPP polynomial for pi looks like the sine wave curve in the graph I made?

cheers, Jamie

Reply to
Jamie M

Pi is less random looking when written in base-16

--
  \_(?)_
Reply to
Jasen Betts

pi = 4 atn(1)

see also "Taylor series"

--
  \_(?)_
Reply to
Jasen Betts

You are aware that atn() is a trig function derived from the unit circle, right? So you are saying the same thing Tom is about it being related to physical space.

--

Rick
Reply to
rickman

I scripted the algorithm and added more constants to check, it is running right now but here is the output so far.

I didn't do any analysis of the data yet, really it is good to get more "sequenceRowStart" rows first to get good averages, there are only

3 or 4 samples per variable per digits compressed so far, there will be 20 samples per variable per digits compressed once the script is done, but if there are any patterns they should start to be visible.

The sequences I am checking are:

e pi pseudorandom euler lemniscate catalan golden ratio sqrt2

formatting link

cheers, Jamie

Reply to
Jamie M

Not true! There are many series and closed formulae for pi listed on the Mathematica website.

formatting link

My personal favourite is taking a circle as the limit of an inscribed polygon with 2^n sides as n -> infinity.

No. Tom is wrong there are well known simple power series equal to pi. The simplest is

atan(x) = x - x/3 + x/5 - x/7 + ...

atan(x) = sum n=0 to infinity { (-1)^n*x^(2n+1)/(2n+1) }

This is about as simple a closed form as you can get. (and was taught in senior high school in my day)

formatting link

Convergence is terrible if you use the obvious x=1 but improves considerably when you use Shanks approach for 1/5 and 1/239.

Shanks first used this formula to compute the first 100k digits.

pi = 4* { 4*atan(1/5) - atan(1/239) }

formatting link

No proof exists either way as to the normality or otherwise of pi. I have a hunch that the BBP formulae hint that it might not be normal at least in its base 16 representation.

--
Regards, 
Martin Brown
Reply to
Martin Brown

There are all sorts of ways to define pi, and the atan function. Pi is an irrational number, without a finite closed arithmetical representation - but so is the square root of 2 and the golden ration phi. You don't get real patterns in these either (though you will see patterns in short sequences of the digits).

Mathematically, a circle is defined as a set of points at equal distance from a single fixed point. It is not "physical", though it happens to correspond nicely to an everyday physical image.

The definition of arctan is probably best given in terms of logarithms rather than circles:

so pi = 2i(ln(1 - i) - ln(1 + i))

Reply to
David Brown

The graph you showed is nothing like a sine wave, other than it goes up and down a bit by coincidence. You might just as well compare it to a camel's back for all the relevance it has.

Reply to
David Brown

Ok, thanks for the correction.

Reply to
Tom Del Rosso

can de defined without circles.

formatting link

And anyway, circles aren't a physical phenomenon, they're a mathematical ideal.

--
  \_(?)_
Reply to
Jasen Betts

and if you format it correctly is even less random ;)

Bye Jack

--
Yoda of Borg am I! Assimilated shall you be! Futile resistance is, hmm?
Reply to
Jack

Even less so when written in base-Pi. ;-)

Reply to
krw

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.