📜 ⬆️ ⬇️

Calendar of the ancient Maya - how to calculate the date?

Hello, reader!

If you remember, then very recently the calendar of the ancient Maya was on everyone's lips. Few people paid attention to the topic of the burning question of the end of the chronology of the once great civilization. Now I propose to delve into the mathematical essence of the question - how to calculate the date of the Mayan calendar.

In my narrative, I will show how to get the Mayan calendar date from the date of the usual Gregorian calendar, giving examples of Python algorithms.

To begin with, briefly repeat the theory of the calendar itself.
')
The Mayan calendar consists of three main parts. This is a long account, tzolkin and haab.

The fourth non-mandatory part of the calendar is the transfer of the lords of the night. There are only nine of them and they follow each other. Something like a nine-day week. The names of the lords are not preserved, so it is customary to designate them simply: G1, G2, G3, G4, G5, G6, G7, G8, G9.

What else should you know? It is not known for certain from which day of the Gregorian calendar a countdown should be kept. On this occasion, there are many authoritative opinions, but two versions are now popular - the so-called correlations 584283 and 584285. The first is called the GMT correlation, the second is the Thompson-Lounsbury correlation or astronomical correlation. I will note that December 21, 2012 is the end of the year in terms of the GMT ‑ correlation, but recently the opinion that the second correlation is more true is increasingly supported. According to it, “the end of all things” comes two days later - December 23, 2012. Cheers, comrades! Of course, this is much easier for us.

So ... All calendar values ​​can be calculated by knowing the number of days since the beginning of the Mayan era. We will conditionally call them "Mayan days", by analogy with the Julian days.

Mayan days for the dates of our era are calculated as the remainder of dividing the expression (D + 1721425 - C) by 1872000, where D is the number of days from the beginning of our era to a given date, C is the correlation value, 1872000 is the number of days in the Mayan era. Thus, in Python, the formula is:
M = (D + 1721425 – C) % 1872000 

it is quite easy to get the D value in Python, just import the datetime module and then if the current date is current_date = datetime.date.today (), then D = current_date.toordinal (). Or simply - D = datetime.date.today (). Toordinal ()

Now, knowing the meaning of the Mayan days, we can calculate everything else. Let's start with a long account.

Long counting is counting kins (1 kin = 1 day), 20 kins make 1 vinal, 18 vinals make 1 tun or 20 Ă— 18 = 360 kins, 20 tunes - 1 katun or 20 Ă— 18 Ă— 20 = 7200 kins, 20 katuns - 1 baktun or 20 Ă— 18 Ă— 20 Ă— 20 = 144,000 kins. The era consists of 13 baktuns, therefore the era lasts 20 Ă— 18 Ă— 20 Ă— 20 Ă— 13 = 1872000 kins. For example, the last date of the Mayan era in a long run will be 12.19.19.17.19.
So, to get the current value of baktun, katun, tuna, vinal and kin, we need to divide Mayan days first by 144000 (we get baktun), then we divide the remainder from division by 7200 (we get katun), then we divide the next balance by 360 (we get ), then the next remainder is again divided by 18 (vinal), and the last remainder will be given to us by kin.

In Python, everything is much simpler than in words:
 d =  result = [] for i in (144000, 7200, 360, 20, 1): t, d = divmod(d, i) result.append(t) 

where M is the previously calculated Mayan days.

As a result, we obtain a list containing all the values ​​of the long bill we need.

One more note. Since it is impossible to find a living representative of the ancient Maya people, who would still use the calendar of their ancestors, it remains a mystery, as the baktun expressed during the change of eras. If the era begins with a zero baktun, then it is quite obvious that the beginning of a new era will be the number 0.0.0.0.0. But supposedly, the Mayans avoided a completely zero date, therefore they allegedly expressed the beginning of a new era as 13.0.0.0.0. Further, it is not clear how the next day looks like a new era - 13.0.0.0.1 or 0.0.0.0.1. Different representation on the calculation of the date is absolutely not affected, so let's go further.

Let's take the tzolkin. Tzolkin consists of two parts - the number of the day on the 13-day cycle and the name of the day on the 20-day cycle. Let's call them T2 and T1 (in places I change them purely from the convenience, do not pay attention).

Consequently,
 T1 = (M + 19) % 20 T2 = (M + 3) % 13 + 1 

where 3 and 19 are constants, meaning that the beginning of the tzolkin cycles did not coincide with the beginning of the Mayan era.
Therefore, let the tuple of the names of the days of the Tzolkin be
 t1 = ("Imix'", "Ik'", "Ak'b'al", "K'an", "Chikchan", "Kimi", "Manik'", "Lamat", "Muluk", "Ok", "Chuwen", "Eb'", "B'en", "Ix", "Men", "K'ib'", "Kab'an", "Etz'nab'", "Kawak", "Ajaw") 

then the name of the day
 T1s = t1[T1] 


Now came the turn and haaba.
With him, too, everything is quite simple. Let the day of the month of the haab be H2, and the month itself H1 (changing places for ease of calculation).
From here
 H1, H2 = divmod((M + 348) % 365, 20) 

where the constant 348, as in the case of the Tsolkin, means that the beginning of the haab did not coincide with the beginning of the era.
And, according to the familiar scheme, let us have a tuple of the names of the months of haab
 h1 = ("Pop", "Wo", "Sip", "Sotz'", "Tzek", "Xul", "Yaxk'", "Mol", "Ch'en", "Yax", "Sac", "Keh", "Mak", "K'ank'in", "Muwan", "Pax", "K'ayab'", "Kumk'u", "Wayeb'") 

that month name
 H1s = h1[H1] 


To complete the picture, it remains to calculate the lord of the night. Easy peasy:
 G = (M + 8) % 9 + 1 


Actually, all this is done by my program, the source code of which is available at https://bitbucket.org/mystic-mirage/mayanc (you can pick up git at git@bitbucket.org: mystic-mirage / mayanc.git )

Here are the command line options that the program accepts:
-d <date of the Gregorian calendar>, by default - the current date;
-g <input date format>, default is '% Y-% m-% d' - the parameter accepts all qualifiers available in the Python strptime () function, but only the year, month and day are important;
-f <date output format>, default is '% C,% Z% H',
possible specifiers:
% b - baktun,
% k - katun,
% t - tun,
% w - blamed
% i - kin
% z1 - the numeric value of the name of the day of the Tzolkin (20-day cycle),
% z2 - tzolkin's day number (13-day cycle),
% z3 is the name of the day of the tzolkin (20-day cycle),
% h1 - the numeric value of the month haab,
% h2 is the day of the month of haab,
% h3 is the month of haab
% l is the lord of the night number
% L is the lord of the night
% C is a long count (equivalent to% b.% K.% T.% W.% I),
% Z - Tzolkin (equivalent to% z2% z3),
% H - haab (equivalent to% h2% h3);
-c <correlation> - indicates the applied correlation, can take any value, as well as constants can be specified: gmt and tl, by default - gmt, i.e. 584283;
-s <script> - variant interpretation of baktun during the era change, default 1,
possible values:
1 - 13.0.0.0.0, but 0.0.0.0.1,
2 - 13.0.0.0.0 and 13.0.0.0.1,
3 - 0.0.0.0.0 and 0.0.0.0.1;
--gmt is equivalent to -c gmt;
--tl - equivalent to -c tl;
--baktun is equivalent to -f '% b';
--katun is equivalent to -f '% k';
- tun is equivalent to -f '% t';
--winal is equivalent to -f '% w';
--kin is equivalent to -f '% i';
--tzol1 is equivalent to -f '% t1';
--tzol2 is equivalent to -f '% t2';
--tzol3 is equivalent to -f '% t3';
- haab1 is equivalent to -f '% h1';
- haab2 - equivalent to -f '% h2';
- haab3 is equivalent to -f '% h3';
- lord1 is equivalent to -f '% l';
- lord2 is equivalent to -f '% L';
--long is equivalent to -f '% C' or -f '% b.% k.% t.% w.% i';
--tzol is equivalent to -f '% Z' or -f '% z2% z3';
- haab is equivalent to -f '% H' or -f '% h2% h3';
--bc - indicates that the original Gregorian date is in the time period BC, i.e., the combination of parameters -d 3114-08-11 --bc indicates that the original date is August 11, 3114 BC;
--no-l10n - do not use localized names.

Note. Adding the --bc key made the code very complicated, in particular, it was necessary to rewrite the date recognition a little according to the specified format (due to the fact that 1 year BC turned out to be a leap day) and to supplement the calculation of Mayan days. But now the input parameter can be any date in the range from January 1, 9999 BC. er - until December 31, 9999 AD er

The program can be used not only from the command line, but also as a module for import:
 from mayanc import * 


The following functions are available:

todaydatetuple () - returns a tuple containing the current date according to the Gregorian chronology (year, month, day), used for other functions and to the simple user for the most part is useless;
getmayandays (g_tuple = todaydatetuple (), cor = 584283, bc = False) —adopts a date tuple (year, month, day), correlation value, era flag (n. O. - False, BC. —True) and returns Mayan days;
getlongcount (m_days, scenario = 1) - takes the Mayan days and the type of scenario, and returns a tuple with long count values ​​(baktun, katun, tun, vinal, kin);
gettzolkin (m_days) - takes Mayan days and returns a tuple consisting of values ​​of 20-day and 13-day cycles of the Tzolkin;
gethaab (m_days) - takes Mayan days and returns a tuple with the month and haab day values;
getlord (m_days) - takes Mayan days and returns the serial number of the lord of the night.

There are also such tuples:
tzolkinlist - contains the names of the days of the 20-day Tzolkin cycle;
haablist - contains the names of the months of the haab;
lordlist - contains the names of the masters of the night, but since they are not known, the tuple contains the symbols (G1 — G9);

There are also such constants:
gmt = 584283
tl = 584285

default_cor = gmt
default_fmt = '% C,% Z% H', which is essentially equivalent to such a set of specifiers - '% b.% k.% t.% w.% i,% z2% z3% h2% h3'
default_sce = 1

The script can be integrated with conky. Actually for this he was written.

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


All Articles