Benford's law: Difference between revisions

Content added Content deleted
Line 1,506: Line 1,506:


{{FormulaeEntry|page=https://formulae.org/?script=examples/Benford%27s_law}}
{{FormulaeEntry|page=https://formulae.org/?script=examples/Benford%27s_law}}

'''Solution:'''

The following function calculates the distribution of the first digit of a list of integer, positive numbers:

[[File:Fōrmulæ - Benford's law 01.png]]

'''Example:'''

[[File:Fōrmulæ - Benford's law 02.png]]

[[File:Fōrmulæ - Benford's law 03.png]]

'''Benford distribution.''' Benford distribution is, by definition (using a precision of 10 digits):

[[File:Fōrmulæ - Benford's law 04.png]]

[[File:Fōrmulæ - Benford's law 05.png]]

'''Comparison chart.''' The following function creates a chart, in order to compare the distribution of the first digis in a givel list or numbers, and the Benfol distribution:

[[File:Fōrmulæ - Benford's law 06.png]]

'''Testing.''' Testing with the previous list of numbers:

[[File:Fōrmulæ - Benford's law 07.png]]

[[File:Fōrmulæ - Benford's law 08.png]]

'''Case 1.''' Use the first 1,000 numbers from the Fibonacci sequence as your data set

[[File:Fōrmulæ - Benford's law 09.png]]

[[File:Fōrmulæ - Benford's law 10.png]]

'''Case 2.''' The sequence of the fisrt 1,000 natural numbers does not follow the Benfold distribution:

[[File:Fōrmulæ - Benford's law 11.png]]

[[File:Fōrmulæ - Benford's law 12.png]]

'''Case 3.''' The following example is for the list of the fist 1,000 factorial numbers.

[[File:Fōrmulæ - Benford's law 13.png]]

[[File:Fōrmulæ - Benford's law 14.png]]


=={{header|Go}}==
=={{header|Go}}==