📜 ⬆️ ⬇️

Simulation of the world and dynamic systems

The article describes a statistical pattern, the explanation of which will lead to interesting problems, both applied and purely theoretical.


(The first digits of the areas of countries recorded in decimal)


Let us begin by considering one seemingly meaningless statistical indicator. We write down the population of all countries of the world in decimal notation and see how often each digit from 1 to 9 is the first digit of one of these numbers.
')
This result will be obtained (the population size was taken from Wikipedia ):
one23fourfive67eight9
0.2650.1760.1340.0930.0890.0810.0440.0690.049

Already visible strange monotony. For clarity, we will construct a graph:



It turned out an amazing result. The decimal number system is only a tool, it is not some kind of selected or fundamental, so the calculated distribution should be meaningless and have no visible patterns, but we see obvious monotony.

So far it is quite possible to consider it as an accident, having no fundamental reasons. Some 9 numbers suddenly turned out to be somehow ordered (and even then not quite, the frequency of seven is less than the frequencies of eight and nine) is not enough.

Then let's do the same procedure with a different geographical indicator - the area of ​​the world.
one23fourfive67eight9
0.2980.1830.1090.1150.0680.0750.0630.0410.048

Also build a graph



Monotony is still not perfect, but clearly visible.

Is this really some kind of general pattern? Let's look at the square of the US states



Well, such indecent monotony is no longer observed. This suggests the origin of the pattern. The areas and populations of the countries of the world actively changed over the course of history, while the areas of the states were once artificially determined and did not undergo a natural change. monotony, most likely this is due to the fact that these values ​​are significantly correlated with the population and area). Finally, we turn to the explanation.

Mathematical explanation


Consider a similar indicator - the frequency of the first digits in the decimal notation for a geometric progression - 1,2,4, ..., 2 n . Taking n = 1000, we get:
one23fourfive67eight9
0.3010.1770.1240.0970.0800.0670.0570.0520.044

A similar pattern is visible - monotony and the unit occurs several times more often than nines. This fact has a rigorous mathematical proof. For this article it is not very important, although it is interesting in itself.

Evidence

Proof of the theorem
So, in the limit we get the following result:
one23fourfive67eight9
lg 2lg 3/2lg 4/3lg 5/4lg 6/5lg 7/6lg 8/7lg 9/8lg 10/9
0.3010.1760.1250.0970.0790.0670.0580.0510.046

By itself, it is surprising that these frequencies do not depend on the choice of the denominator of the progression.

The idea of ​​the following argument, as far as I know, belongs to the great mathematician VI Arnold.

This means that we have established that the first digits of numbers from a geometric progression obey a similar distribution. How can this link be explained now? Arnold suggested that the matter here is the ergodicity of this system (a visual note about this concept), that is, the spatial average value (here it is just the statistics we calculated) is equal to the temporal average value at one point in space (that is, similar statistics taken for the population values ​​of one country in a long period of time). The space here is understood as phase space - a set of countries. In this case, it can be interpreted as follows: all countries of the world at the moment can be viewed as stages of development of the same country throughout history, this correspondence is very inaccurate, the set of populations of countries of the world at the moment does not coincide with the set of populations of one country for some time however, the average values ​​that we study are the same.

Thus, the task has been reduced to the study of the dynamics of the population of one country. It can already be approximated by a geometric progression. Locally, of course, this approximation is very inaccurate, but the first digit of the number is a parameter that is not sensitive to small changes in the number, so that if the population dynamics is exponential for a long time, the frequency distribution of the first digits will be similar to the theoretical one.

Here are graphs illustrating this phenomenon.

Well, the observed effect for the population was explained. How to be with squares?

Squares


They cannot be called exponential in any approximation. Here you can offer a mathematical model: the world begins with a certain number of countries of equal area. In each unit of time, one of two events occurs equally likely: a randomly selected country is divided into two equal areas or two randomly selected countries of the same area are combined into one. This model allows for rigorous mathematical research, but it is already very far from the topic of the article, so I will not give it. However, such a model leads to a similar frequency distribution.

However, it does not look very much like reality. Yes, in the world, countries sometimes unite, sometimes they divide in half, but the ratios of areas are far from fixed and, as a rule, only countries with a common border unite. Taking into account all these factors, the model can be improved, but for mathematics it will become overwhelming (this is my personal opinion, perhaps, someone managed to get decent results in this direction).

This is where computer modeling comes to the rescue. I chose this model: the world is a rectangle, the countries are rectangles whose sides are parallel to the sides of the world. For a unit of time, with probability p, two countries that have a common side merge into one, with probability (1-p) one country is divided into two sections in a straight line.

To implement, I chose the first thing that came to hand, so sorry if my choice seems strange. This is Python 2.7 using the pygame module.
Code (was written solely on the result, so it is very uncombed)
import pygame import random import time cell_size = 10 WIN_WIDTH = 850 WIN_HEIGHT = 850 BACKGROUND_COLOR = "#D3D3D3" DISPLAY = (WIN_WIDTH, WIN_HEIGHT) p = 0.3 class Country(object): def __init__(self, x, y, dx, dy): self.x = x self.y = y self.dx = dx self.dy = dy self.color = (random.choice(range(256)), random.choice(range(256)), random.choice(range(256))) def get_neighbs(self, countries): self.neighbors = [] for i in range(len(countries)): c = countries[i] if cx == self.x and c.dx == self.dx and (cy + c.dy == self.y or cy == self.y + self.dy): self.neighbors.append(i) if cy == self.y and c.dy == self.dy and (cx + c.dx == self.x or cx == self.x + self.dx): self.neighbors.append(i) def __repr__(self): return str((self.x, self.y, self.dx, self.dy, self.neighbors)) __str__ = __repr__ def draw(self, screen): self.image = pygame.Rect(self.x, self.y, self.dx, self.dy) pygame.draw.rect(screen, self.color, self.image) def area(self): return self.dx * self.dy def world_init(): countries = [Country(50, 50, 250, 250), Country(300, 50, 250, 250), Country(550, 50, 250, 250), Country(50, 300, 250, 250), Country(300, 300, 250, 250), Country(550, 300, 250, 250), Country(50, 550, 250, 250), Country(300, 550, 250, 250), Country(550, 550, 250, 250)] for c in countries: c.get_neighbs(countries) return countries def merge(countries, i, j): """i < j""" if countries[i].x < countries[j].x: new_country = Country(countries[i].x, countries[i].y, countries[i].dx + countries[j].dx, countries[i].dy) if countries[i].y < countries[j].y: new_country = Country(countries[i].x, countries[i].y, countries[i].dx, countries[i].dy + countries[j].dy) if countries[i].x > countries[j].x: new_country = Country(countries[j].x, countries[j].y, countries[j].dx + countries[i].dx, countries[j].dy) if countries[i].y > countries[j].y: new_country = Country(countries[j].x, countries[j].y, countries[j].dx, countries[j].dy + countries[i].dy) del countries[i] del countries[j - 1] countries.append(new_country) for c in countries: c.get_neighbs(countries) def divide(countries, i, midx=0, midy=0): print countries[i].area() if midy == 0: new1 = Country(countries[i].x, countries[i].y, midx, countries[i].dy) new2 = Country(countries[i].x + midx, countries[i].y, countries[i].dx - midx, countries[i].dy) del countries[i] countries.append(new1) countries.append(new2) for c in countries: c.get_neighbs(countries) if midx == 0: new1 = Country(countries[i].x, countries[i].y, countries[i].dx, midy) new2 = Country(countries[i].x, countries[i].y + midy, countries[i].dx, countries[i].dy - midy) del countries[i] countries.append(new1) countries.append(new2) for c in countries: c.get_neighbs(countries) def world_draw(countries, screen): for c in countries: c.draw(screen) def random_action(countries): rand = (random.uniform(0, 1) < p) if rand: i = random.choice(range(len(countries))) if countries[i].neighbors: j = random.choice(countries[i].neighbors) merge(countries, i, j) else: i = random.choice(range(len(countries))) xaxis = random.choice([True, False]) if xaxis: try: mid = random.choice(range(cell_size, countries[i].dx, cell_size)) except IndexError: return 0 divide(countries, i, midx=mid) else: try: mid = random.choice(range(cell_size, countries[i].dy, cell_size)) except IndexError: return 0 divide(countries, i, midy=mid) def get_stat(countries): digits = [int(str(c.area())[0]) for c in countries] result = {0:0.0, 1:0.0, 2:0.0, 3:0.0, 4:0.0, 5:0.0, 6:0.0, 7:0.0, 8:0.0, 9:0.0} for d in digits: result[d] += 1 for d in range(1, 10): result[d] = round(result[d] / len(digits), 3) return result def main(): pygame.init() screen = pygame.display.set_mode(DISPLAY) pygame.display.set_caption("World History") bg = pygame.Surface((WIN_WIDTH, WIN_HEIGHT)) bg.fill(pygame.Color(BACKGROUND_COLOR)) countries = world_init() waiting = True while waiting: events = pygame.event.get() for event in events: if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: waiting = False for i in range(1000): for e in pygame.event.get(): if e.type == pygame.QUIT: raise SystemExit, "QUIT" world_draw(countries, screen) pygame.display.update() random_action(countries) time.sleep(0.07) print get_stat(countries) main() 

Here is the video of the program (1000 iterations here):


At 1000 iterations, the statistics still do not completely coincide with the theoretical, and at 10,000 it is already close:
one23fourfive67eight9
0.4350.2260.1060.0850.0450.0380.0200.0290.015

These data were obtained at p = 0.3. Experimenting with different values ​​of p and the initial configuration of the world, we will obtain similar results everywhere with a sufficiently large number of iterations, so apparently the condition under consideration is common to all models of this type.

So, this seemingly meaningless, experimental fact led us to such deep sections of mathematics as number theory and the theory of dynamical systems.

PS I took the ideas of the mathematical part of this article from a popular scientific article by V.I. Arnold, which I once read, but unfortunately now I could not find it.

Source: https://habr.com/ru/post/228369/


All Articles