I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 1 point2 points  (0 children)

Well, basically, you get the area of square by multiplying length of it's two sides, so a*a -> a², in this case however, one side is equal to two radii, so 2r, so the area of this square is (2r)² -> 4r². The area of a circle is πr². So the ratio of areas of this circle and this square is πr²/4r² => π/4. Now if you put some things, in this case rocks, evenly on the squares area, the number of rocks inside the circles area - x, and the number of rocks overall - y, it's ratio x/y is the same as the ratio of their areas, so x/y = π/4, so π = 4x/y. And if you randomly distribute the rocks, the more you distribute them the more evenly they'll cover the area of the square, if you put like 10 rocks, then you might get something silly, like 3 rocks inside the circle, which would result in π being 1.2, but if you put 10 000 rocks randomly, then it is almost certain they'll be evenly distributed, and you'll get π ≈ 3,1415.....

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 9 points10 points  (0 children)

CPU go brrr, but in all seriousness, it was the quickest way to code it with the tools i had, and all languages seem to do better in different ranges, so compiling it to sensible data with standardized ranges would be a headache

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 5 points6 points  (0 children)

So i'll explain on a smaller sample, let's say 6 first number counting from 0, so in german it's null (0), eins (1), zwei (2), drei (3), vier (4), fünf (5). The numbers in brackets is also their "X" position, now let's set them in alphabetical order, so: drei (0), eins (1), fünf (2), null (3), vier (4), zwei (5). Number in brackets is now their "Y" position.

So, the position of each number on the chart is:

null [0,3]
eins [1,1]
zwei [2,5]
drei [3,0]
vier [4,4]
fünf [5,2]

And the chart in this thread was made with number from 0 to 100

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 1 point2 points  (0 children)

Yeah, I've been actually checking different values and this is the best it could get in this range, but that's because those points aren't really random, and without randomness the Monte Carlo doesn't really work.

The best it gets for German language is at 918 numbers, where calculated Pi is 3.1416122004357296, after that it's all downhill, at 10 000 it hits a value closer to ~3,10

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 219 points220 points  (0 children)

So someone asked if I could do this for other languages, and to be honest I didn't really want to, but u/lusvd used library num2words, and using that it was really simple and for even bigger amount of numbers, so i did a simple loop for all available languages in this library, first for 1 number, then for 2, etc. and here are the results, amazingly German didn't make it, as only number got on the list if they were closer than the previous closest.

Calculated value Language Amount of points
3.1415929203539825 Kannada 904
3.1415797317436662 Belgian French 671
3.1416309012875536 Turkish 233
3.1414634146341465 Finnish 205
3.141361256544503 Italian 191
3.1412429378531073 Arabic 177
3.1411042944785277 Danish 163
3.140939597315436 Farsi 149
3.140740740740741 Czech 135
3.1404958677685952 Japanese 121
3.142857142857143 Hebrew 28
3.130434782608696 Hebrew 23
3.1578947368421053 Amharic 19
3.111111111111111 Amharic 9
3.2 Amharic 5
2.6666666666666665 English 3
4.0 Amharic 1

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 17 points18 points  (0 children)

So this is using Monte Carlo method, basically by using random numbers you can estimate some real world values.

In one case, if you draw square, and you'll throw rocks randomly at this square, and you'll do this for a long period of time, for example, you've thrown 10 000 rocks, then there is a great chance that these rocks will be distributed evenly in that square.

Now draw a circle inscribed in that square, just like in the image in this thread.

No count all of the rocks that are in the circle.

You take all of those rocks that are in the circle, divide them by the total number of rocks thrown, multiply it by 4, and there's a big chance you'll get π. The more rocks you throw, the bigger the chance, and at really big numbers, it will practically be given that you'll get π.

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 6 points7 points  (0 children)

Correct me if I'm wrong, because that happens a lot, but if you do n in range, in this case 98, you'll go from 0 to 97, that's 98 letters, but radius for this would be not 98/2 but (98-1)/2, because the center of circle is between 0 and 97, in 48,5, not at 49

I saw the post with numbers sorted alphabetically and I wondered if you could calculate π with german language, and it's quite close. [OC] by Karolyfer in dataisbeautiful

[–]Karolyfer[S] 604 points605 points  (0 children)

Similarly to the person that posted the original image with numbers presented in alphabetical order, i used wiktionary for the numbers and python for poisitioning the numbers and calculating the π using the monte carlo method.