-
Notifications
You must be signed in to change notification settings - Fork 43
/
guliuli.html
executable file
·1 lines (1 loc) · 73.8 KB
/
guliuli.html
1
<!DOCTYPE html><html lang="en-US"><meta name="keywords" content="Chinese calendar, guliuli, ancient six calendars, sifen system, quarter-remainder system, no Zhongqi rule, runyu, Zhou calendar, Lu calendar, Huangdi calendar, Yin calendar, Xia calendar, Zhuanxu calendar"><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><head><title>Computation of the Ancient Six Calendars</title><link rel="stylesheet" href="calendar_min.css"><style>body{counter-reset:sec-counter}sect{counter-reset:subsec-counter}sect::before{counter-increment:sec-counter 1;content:counter(sec-counter) ". "}subsect::before{counter-increment:subsec-counter 1;content:counter(subsec-counter,lower-roman) ". "}</style><script src="header_min.js"></script><base href="https://ytliu0.github.io/ChineseCalendar/"><script async src="https://www.googletagmanager.com/gtag/js?id=G-SN0QJRDXXT"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-SN0QJRDXXT")</script></head><body onload='header(0,"","guliuli")'><div id="wrapper0"><div id="menu"></div><div id="language"></div><h1>Computation of the Ancient Six Calendars</h1><p>First draft: March, 2019</p><br><p>The information described here is based on Section 3.6 of the book <i>Ancient Chinese Calendars and Almanacs</i><sup><a href="guliuli.html#ZCBH08">ZCBH08</a></sup> by Zhāng Péiyú (張培瑜), Chén Měidōng (陳美東), Bó Shùrén (薄樹人), and Hú Tiězhū (胡鐵珠). According to the preface, the chapters in the book were written separately by the four authors. Chapter 3 was written by Zhāng Péiyú, a researcher in the Purple Mountain Observatory in Nanjing, China. I do not use the exact same method to calculate the ancient six calendars described in the book, but use a method that is more convenient for implementation on a computer. The results agree with the calendar data in Zhāng Péiyú's two books <i>Tables of Chinese Calendars in the Pre-Qin Period</i><sup><a href="guliuli.html#Zhang87">Zhang87</a></sup> and <i>3500 Years of Calendars and Astronomical Phenomena</i><sup><a href="guliuli.html#Zhang97">Zhang97</a></sup>.</p><br><div style="border:1px solid #000;padding:10px"><p><b>Contents</b></p><ol><li><a href="guliuli.html#sifenSystem">The <i>Sìfēn</i> System</a></li><li><a href="guliuli.html#epochs">Epochs</a></li><li><a href="guliuli.html#computation">Computation of Lunar Conjunctions and Solar Terms</a></li><li><a href="guliuli.html#firstMonth">Order of Months</a></li><li><a href="guliuli.html#intercalation">Intercalation Rules</a><ol type="i"><li><a href="guliuli.html#runyu"><i>Rùnyú</i> Rule (閏餘法)</a></li><li><a href="guliuli.html#winterSolRule">Solstice Rule (固定冬至法)</a></li><li><a href="guliuli.html#noZhongqi">No Zhōngqì Rule (無中氣法)</a></li></ol></li><li><a href="guliuli.html#examples">Examples of Computing the Ancient Six Calendars</a></li><li><a href="guliuli.html#decimals">Using Decimals to Compute the Ancient Six Calendars</a></li></ol> <a href="guliuli.html#references">Footnotes and Reference</a></div><br><sect id="sifenSystem">The <i>Sìfēn</i> System</sect><p>In the Warring States period (480 BCE – 221 BCE), China was divided into many states. Each state used its own calendar. It was believed that there were six versions of calendars used by the states at that time. They are collectively called <i>gǔliùlì</i> (古六曆) or ancient six calendars. These six calendars were Zhou, Lu, Huangdi, Yin, Xia and Zhuanxu. They were all based on the <i>sìfēn</i> system. In Chinese, the term <i>sìfēn</i> (四分) means "division by four" or "quarter." It comes from the fact that the <i>sìfēn</i> system uses 365.25 days as the solar cycle (tropical year), i.e. 365 and a quarter days. The <i>sìfēn</i> system adopts a lunar cycle (synodic month) that is 19/235 of its solar cycle. That is,<br>lunar cycle = (365 + 1/4) days × 19/235 = (29 + 499/940) days. As a result, 235 lunar cycles are exactly equal to 19 solar cycles. Since 235=19×12+7, if there are 12 lunar months in each year, there will be 7 extra months in 19 years. So 7 intercalary or leap months are added to the calendar every 19 years to keep the calendar year in sync with the solar cycle. This is the basis of the <i>sìfēn</i> system. The 19-year cycle was called the <i>zhāng</i> cycle (章週) in China. It was known as the Metonic cycle (named after the Greek astronomer Meton of Athens) in the West. Hereafter, the terms lunar cycle and solar cycle will be referred to as the values adopted by the <i>sìfēn</i> system.</p><p>The ancient six calendars were all based on the <i>sìfēn</i> system. They differ by their choices of <i>liyuan</i> (曆元) or <i>epochs</i>. Here the term epoch is used to refer to an instant in time chosen as a reference point from which time is measured. It was usually chosen so that a particular solar term (usually the winter solstice) was assumed to occur at the same time as the lunar conjunction (and usually at midnight).<sup><a href="guliuli.html#fn1">fn1</a></sup></p><p>Take the Zhou calendar as an example. Its epoch is chosen when the winter solstice and conjunction was assumed to occur at midnight on a particular day with the sexagenary cycle of jiǎ zǐ. Before the 7th century CE, calculation of the conjunction time was based on the <i>píngshuò</i> (平朔) method and calculation of time of the solar terms was based on the <i>pínqì</i> (平氣) method. These methods assume that the motions of the Sun and Moon in the sky are uniform (mean motions). By definition, the conjunction and winter solstice both occurred at midnight at the epoch of the Zhou calendar. Since one solar cycle = (12 + 7/19) lunar cycles, the winter solstice in the following year would be 7/19 lunar cycles after the conjunction. Thus the winter solstice and conjunction were no longer at the same time. The number 7/19 is called <i>rùnyú</i> (閏餘) or intercalation remainder.</p><p>In general, <i>rùnyú</i> is defined as the <a href="https://in-the-sky.org/article.php?term=age_of_moon" target="_blank">age of the Moon</a> at a particular solar term (usually the winter solstice), which is the time of the solar term measured from its previous lunar conjunction time. It can be expressed in days or as a fraction of the lunar cycle. For simplicity, I use "lunation fraction" to refer to the age of the Moon expressed as a fraction of a lunar cycle. Thus <i>rùnyú</i> began with 0 at the epoch, and became 7/19 one year later. It is easy to show that the lunation fraction of any solar term increases by 7/19 every year. When it reaches or exceeds 1, it will need to be subtracted by 1. Using this rule, we can easily figure out the first 19 <i>rùnyú</i>s in the Zhou calendar starting from the epoch: 0, 7/19, 14/19, 2/19, 9/19, 16/19, 4/19, 11/19, 18/19, 6/19, 13/19, 1/19, 8/19, 15/19, 3/19, 10/19, 17/19, 5/19, and 12/19. In the 20th year the <i>rùnyú</i> returns to 0 and the cycle repeats. Thus <i>rùnyú</i> has a cycle of 19 years, the <i>zhāng</i> cycle.</p><p>Since 365.25×19=6939.75, after one <i>zhāng</i> cycle even though the winter solstice and conjunction occur at the same time again, the time is not at midnight but at 18 o'clock. It takes four <i>zhāng</i> cycles for the winter solstice and conjunction to both occur at midpoint again. Four <i>zhāng</i> cycles is called a <i>bù</i> (蔀) cycle, which is 76 years. One <i>bù</i> cycle has 365.25×76 days = 27759 days, which is not a multiple of 60 days. Even though the winter solstice and conjunction both occur at midnight again after one <i>bù</i> cycle, the sexagenary day is not jiǎ zǐ as at the epoch. It takes 20 <i>bù</i> cycles for the sexagenary cycle to return to the same as at the epoch. Twenty <i>bù</i> cycles is called a <i>jì</i> (紀) cycle, which is 1520 years. 1520 is not a multiple of 60, so even though the winter solstice and conjunction both occur at midnight on a jiǎ zǐ day, the sexagenary cycle of the year is not the same as that at the epoch. It takes 3 <i>jì</i> cycles for the sexagenary year to return to the same sexagenary year as the epoch. Three <i>jì</i> cycles is called a <i>yuán</i> (元) cycle, which has 4560 years. The following summarizes the cycles in the <i>sìfēn</i> system.</p><p>Lunar cycle: 1 lunar month = (29 + 499/940) days<br>Solar cycle: 1 solar year = (365 + 1/4) days = (12 + 7/19) lunar months<br><i>Zhāng</i> cycle: 19 (solar) years = 235 (lunar) months = 6939.75 days<br><i>Bù</i> cycle: 4 <i>zhāng</i> cycles = 76 years = 940 months = 27759 days<br><i>Jì</i> cycle: 20 <i>bù</i> cycles = 1520 years = 18800 months = 555180 days<br><i>Yuán</i> cycle: 3 <i>jì</i> cycles = 4560 years = 56400 months = 1665540 days</p><br><sect id="epochs">Epochs</sect><p>The ancient six calendars were developed and used in the Warring States period, but none of them was preserved. We can now only learn about them in books such as <i>Hànshū</i> (漢書 or <i>Book of Han</i>) published in the first century CE, and <i>Xù Hànshū</i> (續漢書 or <i>Sequel of the Book of Han</i>) published in the third century CE. The two books do not provide concrete information about the epochs used by the six calendars. The earliest available information on the epochs is found in the book <i>Kāiyuán Zhánjīng</i> (開元占經 or <i>Divination Classic Complied in the Kāiyuán Era</i>) published in the 8th century. The epochs are listed as the number of years between 714 CE and <i>shàngyuán</i>s (上元), which I will refer to as <i>superior epochs</i> hereafter. A superior epoch was considered to be an ideal epoch at which the Sun and Moon had the same longitude and the five planets were in the same direction in the sky. "Same direction" was a vague description, which was made precise by Chinese astronomers in the Qing dynasty (1644–1911) to mean the angular separations among the five planets were less than 45°. The following table lists the superior epochs of the six calendars. <i>Shàngyuán jīnián</i> (上元積年) refers to the number of years between 714 CE and the superior epoch.</p><table id="tabShangyuan"><caption><b>Table 1: Superior epochs of the six calendars</b></caption><tr><th>Calendar</th><th><i>Shàngyuán Jīnián</i></th><th>Superior epoch in proleptic Julian Calendar</th><th>Relationship between solar term and conjunction at the epoch</th></tr><tr><td>Huangdi</td><td>2760863</td><td>-2760149</td><td rowspan="3">Winter solstice and conjunction occurred at midnight on a jiǎ zǐ day</td></tr><tr><td>Yin</td><td>2761080</td><td>-2760336</td></tr><tr><td>Zhou</td><td>2761137</td><td>-2760423</td></tr><tr><td>Xia</td><td>2760589</td><td>-2759875</td><td>Xia calendar has two versions. Version 1 specifies winter solstice and conjunction occurring at midnight on a jiǎ zǐ day. Version 2 specifies Z1 and conjunction occurring at midnight on a jiǎ zǐ day.</td></tr><tr><td>Zhuanxu</td><td>2761019</td><td>-2760305</td><td>J1 and conjunction occurred at midnight on a jǐ sì day.</td></tr><tr><td>Lu</td><td>2761514<sup>*</sup></td><td>-2760800</td><td>Winter solstice occurred at midnight on a jiǎ zǐ day with a <i>rùnyú</i> of 1/19</td></tr></table><p><sup>*</sup> Many scholars pointed out that the number listed in <i>Kāiyuán Zhánjīng</i> is wrong. The number listed here is based on the calculation by Zhāng Péiyú.</p><br><p>In the table, solar terms other than winter solstice are indicated by the labels used on our <a href="solarTerms.html">solar terms page</a>. J1 (立春 or Beginning of Spring) is the third solar terms following the winter solstice; Z1 (雨水 or Rain Water) is the fourth solar terms following the winter solstice. As indicated in the table, the Xia calendar has two versions. Version 1 specifies the winter solstice and conjunction occurring at midnight on a jiǎ zǐ day. Version 2 specifies the solar term Z1 and conjunction occurring at midnight on a jiǎ zǐ day. Hereafter, I will call the first version as the "solstice version" and the second version as the "Z1 version."</p><p>The case of the Lu calendar needs further explanation. First, many scholars pointed out that the number for the superior epoch in <i>Kāiyuán Zhánjīng</i> was wrong. The values listed in the table are based on the calculation by Zhāng Péiyú. Second, the <i>Book of Han</i> states that the Lu calendar was "askew" in the sense that the <i>rùnyú</i> was 1/19 in the beginning year of its bù cycle. That is to say that at the Lu epoch listed in the table above, the winter solstice occurred at midnight on a jiǎ zǐ day, but the conjunction occurred 1/19 lunar cycles (=1.554 days) earlier. Strictly speaking, the Lu epoch does not qualify as a superior epoch because of the misalignment of the Sun and Moon. The superior epochs of all the other calendars specify a particular solar term and conjunction occurring at the same time, which means that the <i>rùnyú</i> is 0 at the epoch.</p><p>The concept of superior epoch was introduced by Liú Xīn (劉歆) in the first century BCE. The computation of superior epoch is a tedious exercise in modular arithmetic. Since the simultaneous alignment of the Sun, Moon and five planets is very rare, the superior epoch was in the remote past very far away from the time the astronomical system was developed. Here I use the term astronomical system instead of calendar for the Chinese term lì (曆) because lì was actually a system of mathematical astronomy developed to calculate the motions of the Sun, Moon and planets. Calendar calculation was just one function of lì. As the measurement accuracy improved over time, it was apparent that the periods of the Sun, Moon and planets were not commensurate with each other. They had to be approximated by more and more complicated fractions and the superior epoch moved further and further into the remote past. For example, the Chúnyòu astronomical system (淳祐曆) developed in 1250 placed the superior epoch in the year 120,266,428 BCE! The large number made the astronomical calculations inconvenient. A more serious problem was that as the astronomical system became more and more complciated (e.g. by including more constants for describing the non-uniform motion of the Sun and Moon), the calculation of superior epoch became too tedious that the algorithm had to be simplified. Astronomical constants were first determined by observations, but were modified in order to match the superior epoch determined by the simplified algorithm. The superior epoch system was abadoned in 1280s and astronomical constants were determined entirely from observations. Further information on the superior epoch and its calculation can be found <a href="Shangyuan.html">here</a>.</p><p>The superior epochs listed in <i>Kāiyuán Zhánjīng</i> are most likely calculated by people in the later Han dynasty (25 – 220 CE), not the epochs used in the Warring States period. It is more convenient to use epochs closer to the Warring States period than the ones listed in <i>Kāiyuán Zhánjīng</i>. From the previous Section, we know that after a <i>jì</i> cycle (1520 years), the times of conjunction, solar terms and the sexagenary day return to the same values. We can therefore add integer multiples of 1520 years to the epochs in <i>Kāiyuán Zhánjīng</i> to find other more convenient epochs. Take the Zhou calendar as an example. its superior epoch is in the year <span class="nowrap">-2760423</span>. Adding 1520×1816=2760320 to the number yields <span class="nowrap">-103</span>, or 104 BCE. That is to say that we can take the midnight on a jiǎ zǐ day in 104 BCE. as an epoch for the Zhou calendar. At this epoch, the winter solstice and conjunction were assumed to occur at midnight on a jiǎ zǐ day. Note that the Chinese calendar is a luni-solar calendar. The months are arranged according to the Moon's phases, and the years are arranged according to the Sun's position. The winter solstice is often considered as the beginning of a "solar year," or <i>suì</i> (歲). Thus, the winter solstice of 104 BCE actually refers to the winter solstice that is closest to Jan. 1, 104 BCE, which fell in late December in 105 BCE. The Zhou calendar's epoch in "104 BCE" can be easily determined by finding the jiǎ zǐ day in late December in 105 BCE, which turns out to be on 25 December, 105 BCE.</p><p>We don't need to use a jiǎ zǐ day as an epoch. Adding an integer multiples of the <i>bù</i> cycles will yield an epoch at which a solar term and conjunction having the same relationship as at the superior epoch. Take the Zhou calendar as an example, subtracting 76×3 years from -103 yields -331. That is to say that the winter solstice and conjunction also occurred at midnight in 332 BCE (actually late December in 333 BCE). Now 76×3 years = 228 years = 83277 days. Straightforward calculation shows that 83277 days before December 25, 105 BCE was December 25, 333 BCE. The sexagenary day can be calculated, using modular arithmetic, to be dīng mǎo. A <i>bù</i> cycle can be named after the sexagenary name of its first day in the cycle. Thus, 104 BCE was the first year in the <i>bù</i> cycle of jiǎ zǐ of the Zhou calendar. The year 332 BCE was the first year in the <i>bù</i> cycle of dīng mǎo, 331 BCE was the second year in the <i>bù</i> cycle of dīng mǎo and so on.</p><br><sect id="computation">Computation of Lunar Conjunctions and Solar Terms</sect><p>The epochs of the ancient six calendars are different, which means that the six calendars have six different origins from which time is measured. This is inconvenient for developing a general procedure to compute the calendars. Here I introduce a method to simplify the calculation.</p><p>This method uses Julian days to represent times. The Julian day is defined as the number of days counted from January 1, 4713 BCE at noon. Using Julian days is a way to ignore the epochs of the six calendars and unify the time origin to be at noon on January 1, 4713 BCE. Take the Zhou calendar as an example, I find from the previous section that the midnight of December 25, 105 BCE was an epoch at which conjunction and winter solstice were assumed to occur. The Julian day was 1683430.5. Using the <i>píngshuò</i> and <i>pínqì</i> rules, the Julian days of the conjunctions and winter solstices in the Zhou calendar can be written as<br>JD(M<sub>i</sub>) = 1683430.5 + i·P<sub>L</sub><br>JD(W(y)) = 1683430.5 +(y+103)·P<sub>s</sub><br>Here P<sub>L</sub>=(29+499/940) is the lunar cycle, P<sub>s</sub>=365.25 is the solar cycle, M<sub>i</sub> is the ith conjunctions after the conjunction at midnight of December 25, 105 BCE W(y) is the winter solstice closest to Jan. 1 in year y, which fell in late December in year y-1. In general, the Julian days of the conjunctions and winter solstices in all six calendars can be written in the form<br>JD(M<sub>i</sub>) = JD(M<sub>0</sub>) + i·P<sub>L</sub> (1)<br>JD(W(y)) = JD(W(y<sub>0</sub>)) + (y-y<sub>0</sub>)·P<sub>s</sub> (2)<br>Here i refers to the lunation number from the conjunction M<sub>0</sub> at the epoch. The values of JD(M<sub>0</sub>), JD(W(y<sub>0</sub>)) and y<sub>0</sub> are constants for each of the six calendars and are given in Table 2 below. It is convenient to combine JD(W(y<sub>0</sub>)) and y<sub>0</sub> into a new variable JD<sub>w</sub>:<br>JD<sub>W</sub>=JD(W(y<sub>0</sub>)) - y<sub>0</sub>·P<sub>s</sub> (3)<br>The Julian days of the winter solstices are simplified to<br>JD(W(y)) = JD<sub>W</sub> + y·P<sub>s</sub> (4)<br>The values of JD<sub>W</sub> are listed in the last column of Table 2.</p><table id="parameters"><caption style="text-align:left"><b>Table 2: Parameters of the ancient six calendars for computing conjunctions and winter solstices</b></caption><tr><th>Calendar</th><th>JD(M<sub>0</sub>)</th><th>JD(W(y<sub>0</sub>))</th><th>y<sub>0</sub></th><th>JD<sub>W</sub></th></tr><tr><td>Huangdi</td><td>1783510.5</td><td>1783510.5</td><td>171</td><td>1721052.5 + 1/4</td></tr><tr><td>Yin</td><td>1704250.5</td><td>1704250.5</td><td>-46</td><td>1721051.5 + 1/2</td></tr><tr><td>Zhou</td><td>1683430.5</td><td>1683430.5</td><td>-103</td><td>1721050.5 + 3/4</td></tr><tr><td>Xia (solstice version)</td><td>1883590.5</td><td>1883590.5</td><td>445</td><td>1721053.5 + 3/4</td></tr><tr><td>Xia (Z1 version)</td><td>1883650.5</td><td>1883589.5 + 1/8</td><td>445</td><td>1721052.5 + 7/8</td></tr><tr><td>Zhuanxu</td><td>1726575.5</td><td>1726529.5 + 11/32</td><td>15</td><td>1721050.5 + 19/32</td></tr><tr><td>Lu</td><td>1545728.5 + 419/940</td><td>1545730.5</td><td>-480</td><td>1721050.5</td></tr></table><br><p>The parameter y<sub>0</sub> for each calendar is determined by adding an appropriate integer multiples of 1520 years to the superior epoch to bring the year closer to the Warring States period. Since the approximate dates of the solar terms are known (winter solstice: late December, J1: early February, Z1: late February), it is easy to find the dates of the specified sexagenary days in the (proleptic) Julian calendar, which are then used to compute JD(W(y<sub>0</sub>)) and JD(M<sub>0</sub>).</p><p>Huangdi calendar, Yin calendar, Zhou calendar, and the solstice version of the Xia calendar assume conjunction and winter solstice occurring at the same time at the epochs, so JD(W(y<sub>0</sub>)) = JD(M<sub>0</sub>) for these calendars. The Z1 version of the Xia calendar assumes Z1 and conjunction occurring at the same time. Z1 is the fourth solar term after the winter solstice. It follows from the <i>pínqì</i> rule that the winter solstice is (4/24)P<sub>s</sub>=60.875 days before Z1. Hence, JD(W(y<sub>0</sub>)) = JD(M<sub>0</sub>) - 60.875 for the Z1 version of the Xia calendar. Zhuanxu calendar assumes that J1 and conjunction occurring at the same time. J1 is the third solar term after the winter solstice. Hence the winter solstice is (3/24)P<sub>s</sub>=(45 + 21/32) days before J1. Thus, JD(W(y<sub>0</sub>)) = JD(M<sub>0</sub>) - (45 + 21/32) for the Zhuanxu calendar. For the Lu calendar, the conjunction occurred (1/19)P<sub>L</sub> before the winter solstice at the epoch. As a result, JD(M<sub>0</sub>) = JD(W(y<sub>0</sub>)) - (1/19)×(29 + 499/940).</p><p>Although we don't know if all of the 24 solar terms were invented in the Warring States period, we can still calculate them using the <i>pínqì</i> rule:<br>JD<sub>q</sub>(j,y) = JD(W(y)) + (j/24)·P<sub>s</sub> (5)<br>Here j is the solar-term number counting from the winter solstice, with j=0 for the winter solstice (Z11), j=1 for J12, j=2 for Z12, j=3 for J1, ..., j=23 for J11 (see our <a href="solarTerms.html">solar terms page</a> for the order of the 24 solar terms). With the exception of the winter solstice being in late December in year y-1, all other 23 solar terms computed using equation (5) are in year y.</p><p>The advantage of using Julian days is that there are standard algorithms for converting Julian days to dates in the Julian/Gregorian calendar. Our <a href="sexagenary.html">sexagenary cycle page</a> also lists formulae for converting Julian days to sexagenary days.</p><p>Equations (1), (4) and (5) also give us a new perspective on the structure of the ancient six calendars. The six calendars use <i>píngshuò</i> and <i>pínqì</i> rules to compute conjunctions and solar terms, which is why the Julian days of lunar conjunctions are expressed as a constant plus integer multiples of P<sub>L</sub> and the Julian days of solar terms are expressed as a constant plus integer multiples of P<sub>s</sub>/24. All six calendars are based on the <i>sìfēn</i> system and so they all use the same values of P<sub>s</sub> and P<sub>L</sub>. The six calendars differ from their choices of the two parameters JD(M<sub>0</sub>) and JD<sub>w</sub>. Of course, this is equivalent to saying that the six calendars adopt different epochs and different relationships between a solar term and conjunction at the epochs.</p><p>The solar cycle 365.25 of the <i>sìfēn</i> system is exactly the same as the one adopted by the Julian calendar. The solar cycle is 0.0078 days longer than the true tropical year, resulting in a drift of one day every 128 years. The lunar cycle (29 + 499/940) days of the <i>sìfēn</i> system is longer than the synodic month by 0.000268 days, resulting in a drift of one day in 3730 lunar cycles (about 300 years). The different values of the two parameters used by the six calendars not only may arise from the differences in measurements, but also may arise from the fact that these calendars were developed in different times. The figure below shows the time difference between the calendrical and astronomical conjunctions as a function of years for the six calendars. The oscillations are caused by the fact that calendrical conjunctions are calculated by the <i>píngshuò</i> method, which only takes into account the mean motions of the Moon and Sun. As expected, we see that the calendrical conjunctions of all six calendars drift at a steady rate. The mean time difference at a particular time can be calculated by taking an average over several oscillations around that time, or more conveniently by fitting the data using a linear regression since we know the increase is linear in time. The regression lines are shown in red in the figure below. The figure shows that the calendrical conjunctions mostly occurred earlier than the astronomical conjunctions for the Zhou, Huangdi, and the solstice version of the Xia calendars, although the time differences gradually decreased near the end of the Warring States period (222 BCE). The calendrical conjunctions matched most closely to the astronomical conjunctions around 460 BCE for the Z1 version of the Xia calendar, around 450 BCE for the Lu calendar, around 435 BCE for the Yin calendar, and around 335 BCE for the Zhuanxu calendar.</p><figure><img src="guliuliConjTimeDiff1.jpg" alt="Difference between calendrical conjunction and actual conjunctiion times for the Zhou, Huangdi, Yin and Lu calendars"><br><img src="guliuliConjTimeDiff2.jpg" alt="Difference between calendrical conjunction and actual conjunctiion times for the Zhuanxu and Xia calendars"><figcaption>Figure: Time difference between calendrical and astronomical conjunctions. JD is the Julian day of the astronomical conjunction. The value of y can be regarded as the time of the conjunction expressed in Julian years. The vertical axis is the time difference between the two conjunctions<sup><a href="guliuli.html#fn2">fn2</a></sup> (negative if the calendrical conjunction occurs before the astronomical conjunction). The horizontal blue lines mark the lines of no time difference between the two conjunctions. The red lines are obtained by fitting the data using linear regressions, representing the average time differences between the two conjunctions. The vertical dash lines indicate the years when the red lines cross the horizontal blue lines, which are at -434 for the Yin calendar, -449 for the Lu calendar, -336 for the Zhuanxu calendar, and -460 for the Z1 version of the Xia calendar.</figcaption></figure><br><sect id="firstMonth">Order of Months</sect><p>The Zhou, Lu and Huangdi calendars designate the zǐ month (present-day month 11), i.e. the month that the winter solstice is in, as the beginning of a year. The Yin calendar designates the chǒu month (present-day month 12) as the beginning of a year<sup><a href="guliuli.html#fn3">fn3</a></sup>. Both versions of the Xia calendar adopt the yín month (present-day month 1) as the beginning of a year. Months in these calendars are labelled by numerical numbers from 1 to 12 starting from the first month. The naming of leap months will be discussed later. Zhuanxu calendar is special. The first month is the hài month (present-day month 10) but it is labelled as month 10, the same as the numbering in the Xia calendar. The month orders (excluding leap months) in Zhuanxu calendar are months 10, 11, 12, 1, 2, ..., 9.</p><br><sect id="intercalation">Intercalation Rules</sect><p>Scholars have not come to a consensus on how and where an intercalary (leap) month was placed in the ancient six calendars. Some people think that a leap month was always placed at the end of a year and was simply labelled as a leap month. Others disagree and think a leap month could occur in the middle of a year. A leap month in the middle of a year is indicated by the same number as the previous month, but a "leap" is added before the number. The case for the Zhuanxu calendar is less controversial. It is generally believed that a leap month in the Zhuanxu calendar was placed at the end of a year and was called post month 9 (後九月), but its intercalation rule remains unclear.</p><p>Three rules have been proposed as possible intercalation rules. Here I call these three rules the <i>rùnyú rule</i> (閏餘法), <i>solstice rule</i> (固定冬至法) and <i>no zhōngqì rule</i> (無中氣法). The no zhōngqì rule assigns a month that does not contain a major solar term (see below) as a leap month. The solstice rule places a leap month at the end of a year. The <i>rùnyú</i> rule does not specify explicitly where a leap month should be placed. It can be placed at the end of a year or in the middle of a year using a simple rule. The six calendars computed on our <a href="index.html">calendar page</a> and <a href="table.html">conversion table page</a> follow the same approach as in Zhāng Péiyú's two books <i>Tables of Chinese Calendars in the Pre-Qin Period</i><sup><a href="guliuli.html#Zhang87">Zhang87</a></sup> and <i>3500 Years of Calendars and Astronomical Phenomena</i><sup><a href="guliuli.html#Zhang97">Zhang97</a></sup>, which use the solstice rule and place a leap month at the end of a year but also indicate the months without a major solar term for reference.</p><br><subsect id="runyu"><i>Rùnyú</i> Rule (閏 餘 法)</subsect><p>Let's start with the case for the Zhou calendar and Huangdi calendar. Both of them specify the zǐ month as the beginning of a year.</p><p>Recall that a solar cycle = (12 + 7/19) lunar cycles. As mentioned above, <i>rùnyú</i> increases by 7/19 (modulo 1) every year. Both the Zhou calendar and Huangdi calendar assume the winter solstice and conjunction occurring at the same time in the beginning of their <i>bù</i> cycles, which means the winter solstice is on the New Year day and the <i>rùnyú</i> is 0. The winter solstice in the second year is 12 and 7/19 months later and the <i>rùnyú</i> is 7/19. If there is no leap month, it will occur on the 12th day of the first month. In the third year, the <i>rùnyú</i> becomes 14/19. If there is no leap month, the winter solstice will be on the 23rd day of the first month. Since 14/19 + 7/19 exceeds one, the winter solstice in the fourth year is 13 and 2/19 months away from the New Year day of the third year. If there is still no leap month, the winter solstice will occur in the second month. This means that the second month is a zǐ month, which is not acceptable. Therefore, there must be a leap month in the third year in order to make the first month in the fourth year to be a zǐ month. The <i>rùnyú</i> in the fourth month is 2/19. It is easy to see that whenever the <i>rùnyú</i> in a given year reaches 12/19 or larger, an addition of 7/19 will exceed one and there needs to be a leap month in order to keep the first month of the following year to be a zǐ month. Here is the <i>rùnyú</i> rule: <b>a leap month occurs in the year in which the lunation fraction of the winter solstice is equal to or greater than 12/19</b>. We have listed the <i>rùnyú</i>s in the Zhou calendar in the first 19 years of the <i>bù</i> cycle in <a href="guliuli.html#sifenSystem">Section 1</a>. The <i>rùnyú</i>s of the Huangdi calendar are exactly the same. From the list we see that a leap month occurs in the 3rd, 6th, 9th, 11th, 14th, 17th and 19th years. In the 20th year, the <i>rùnyú</i> returns to 0. Hence the cycle of leap months is 19 years, which is the <i>zhāng</i> cycle. The leap years have the 3-3-3-2-3-3-2 pattern, meaning that a leap month occurs in the 3rd year, (3+3)th year, (3+3+3)th year, (3+3+3+2)th year and so on.</p><p>The Lu calendar also designates the zǐ month as the beginning of a year, but the <i>rùnyú</i> is 1/19 in the first year of its <i>bù</i> cycle. From the <i>rùnyú</i>s listed in <a href="guliuli.html#sifenSystem">Section 1</a>, we see that this is equivalent to setting the beginning year of the <i>bù</i> cycle in the 11th year of the <i>zhāng</i> cycle of the Zhou and Huangdi calendar. So the leap months occur in the 3rd, 6th, 8th, 11th, 14th, 17th and 19th years when counting from the <i>bù</i> cycle of the Lu calendar.</p><p>The other three calendars do not designate the zǐ month as the beginning of their years, but the <i>rùnyú</i> rule can be modified as: <b>a leap month is added to the <i>suì</i> in which the lunation fraction of the winter solstice is equal to or greater than 12/19</b>. Here <i>suì</i> (歲) refers to the period starting on the first day of the zǐ month and ending on the day before the first day of the following zǐ month. <i>Suì</i> and calendar year are the same for the Zhou, Huangdi and Lu calendar. This rule will make the winter solstice always occurring in the 12th month for the Yin calendar, and in the 11th month for the solstice version of the Xia calendar. However, we can only say that the rule will make the winter solstice often occurring in the 11th month for the Z1 version of the Xia calendar and Zhuanxu calendar.</p><p>For both the Yin and solstice version of the Xia calendar, the lunation fraction of the winter solstice is 0 in the first <i>suì</i> of the <i>bù</i> cycle. As a result, the <i>suì</i>s containing a leap month are exactly the same as the Zhou and Huangdi calendar. For the Z1 version of the Xia calendar, the lunation fraction of Z1 is 0 in the first <i>suì</i> of its <i>bù</i> cycle. Winter solstice is (1/6) solar cycles before Z1. Since P<sub>s</sub>/6 = (2 + 7/114) P<sub>L</sub>, it is easy to deduce that the lunation fraction of the winter solstice is 107/114 in the first <i>suì</i> of the <i>bù</i> cycle. The lunation fractions in the next 18 <i>suì</i>s can be calculated by adding 7/19 (modulo 1) in each <i>suì</i>. The result is (omitting the denominator 114) 35, 77, 5, 47, 89, 17, 59, 101, 29, 71, 113, 41, 83, 11, 53, 95, 23, and 65. The leap months occur in the 1st, 3rd, 6th, 9th, 12th, 14th and 17th <i>suì</i>s. For the Zhuanxu calendar, the lunation fraction of J1 is 0 in the first <i>suì</i> of its <i>bù</i> cycle. The winter solstice is (1/8)P<sub>s</sub>=(1 + 83/152)P<sub>L</sub> before J1. Hence the lunation fraction of the winter solstice is 69/152 in the first <i>suì</i> of the <i>bù</i> cycle. The lunation fractions in the next 18 <i>suì</i>s are (omitting the denominator 152) 125, 29, 85, 141, 45, 101, 5, 61, 117, 21, 77, 133, 37, 93, 149, 53, 109 and 13. The leap months occur in the 2nd, 5th, 7th, 10th, 13th, 16th and 18th <i>suì</i>s.</p><p>The <i>rùnyú</i> rule discussed so far does not specify where a leap month should be placed. It can be placed at the end of a calendar year. However, there is an extension of the <i>rùnyú</i> rule that allows a leap month to be placed in a specific month in the middle of a year. Recall that a leap month occurs in the <i>suì</i> in which the lunation fraction of the winter solstice is equal to or greater than 12/19. Let K be the lunation fraction of the winter solstice, which is ≥ 12/19 when there is a leap month. The lunation fraction of the winter solstice in the following <i>suì</i> increases by 7/19 (mod 1). Dividing the number 7/19 by 12 gives 7/228. Suppose we keep adding 7/228 to K for each of the 12 months after the zǐ month, there must be a month in which the accumulated number will reach or exceed 1. This month is designated as the leap month.</p><p>The <i>suì</i>s containing the leap months in the Lu calendar, Z1 version of the Xia calendar and Zhuanxu calendar are different from the other calendars, but they can be made the same by choosing another <i>suì</i> in their <i>bù</i> cycles as the first <i>suì</i> in a <i>zhāng</i> cycle. The leap month distribution in all six calendars follows the 3-3-3-2-3-3-2 pattern. The lunation fractions of the winter solstice have a cycle of 19 years and so do the leap months. It is of course a result of the fact that 19 solar cycles are exactly equal to 235 lunar cycles in the <i>sìfēn</i> system. Since 235=19×12+7, 7 leap months have to be inserted in 19 years. One of the simplest arrangements is to distribute them evenly in these 235 months. One way to do this is to assign the leap months to occur in the (235j/7)th months (j=1, 2, 3, 4, 5, 6, 7) in a <i>zhāng</i> cycle. Taking the nearest integers will result in the leap months occurring in the 34th, 67th, 101st, 134th, 168th, 201st and 235th months. They occur in the 3rd, 6th, 9th, 11th, 14th, 17th and 19th <i>suì</i>s in the <i>zhāng</i> cycle. Here we see the 3-3-3-2-3-3-2 pattern. The Zhou, Yin, Huangdi and solstice version of the Xia calendar all have the lunation fractions of the winter solstice being 0 in the first year of their <i>zhāng</i> cycles. Using the extended <i>rùnyú</i> rule for placing a leap month in the middle of a year, we find the leap months occurring in the 34th, 68th, 101st, 135th, 168th, 202nd and 235th months. These are almost the same as the rounded numbers of (235j/7). The discrepancies are caused by the extended <i>rùnyú</i> rule requiring the accumulated lunation fraction to reach or exceed 1. We get perfect agreement by rounding up the numbers (235j/7). The leap months occur in different months for the Lu calendar, Z1 version of the Xia calendar and Zhuanxu calendar. This is simply caused by their using different months as the first month in their <i>zhāng</i> cycles.</p><br><subsect id="winterSolRule">Solstice Rule (固 定 冬 至 法)</subsect><p>The solstice rule requires that a particular month must contain the winter solstice. The Zhou, Lu and Huangdi calendars designate the zǐ month as the first month of a year. For this reason, the first month must contain the winter solstice. Yin calendar designates the chǒu month as the first month. Chǒu month is one month before the zǐ month, so the solstice rule requires that month 12 must contain the winter solstice in the Yin calendar. The two versions of the Xia calendar assign the yín month as the first month. Yin month is two months after the zǐ month, so the solstice rule requires that month 11 must contain the winter solstice in the two versions of the Xia calendar. Finally, Zhuanxu calendar uses the hài month as the first month but labels it as month 10. The solstice rule requires that month 11 must contain the winter solstice in the Zhuanxu calendar.</p><p>As mentioned in the previous subsection, a <i>suì</i> refers to the period starting on the first day of the zǐ month and ending on the day before the first day of the following zǐ month. A <i>suì</i> can contain 12 or 13 months. I call the <i>suì</i> containing 12 months as a "normal <i>suì</i>," and the <i>suì</i> containing 13 months as a "leap <i>suì</i>." Since the solstice rule assigns the zǐ month, the month that contains the winter solstice, to a particular month, there cannot be any leap month in a normal <i>suì</i> and one leap month in a leap <i>suì</i>. The implicitly rule is that all 12 normal months must appear exactly once in any given <i>suì</i>. A leap month is placed in the end of a calendar year.</p><p>In many cases the solstice rule and the <i>rùnyú</i> rule agree on which <i>suì</i> a leap month should occur. This is not difficult to understand. Suppose the lunation fraction of the winter solstice is K in a given <i>suì</i>. The conjunction associated with the zǐ month is K lunar cycles before the winter solstice. Since one solar cycle = (12 + 7/19) lunar cycles, the winter solstice in the following <i>suì</i> is (12 + 7/19) lunar cycles after the current winter solstice, which is (12 + K + 7/19) lunar cycles from the conjunction associated with the zǐ month of the current <i>suì</i>. If K<12/19, the second zǐ month is usually 12 months after the first zǐ month and we have a normal <i>suì</i>. If K≥12/19, the second zǐ months is usually 13 months after the first zǐ months and we have a leap <i>suì</i>. Hence, there is usually a leap month if K≥12/19. This is almost the same as the <i>rùnyú</i> rule. It's the "usually" assertion that makes the two rules slightly different. Let's take the Zhuanxu calendar as an example to demonstrate why the two rules can give different results in some cases.</p><p>From the <i>rùnyú</i>s listed in the previous subsection, we see that the <i>rùnyú</i> in the 15th <i>suì</i> in the <i>bù</i> cycle of the Zhuanxu calendar is 93/152 < 12/19. The <i>rùnyú</i> in the 16th <i>suì</i> is 149/152 > 12/19. According to the <i>rùnyú</i> rule, there is no leap month in the 15th <i>suì</i> but a leap month in the 16th <i>suì</i>. It follows that in the 16th <i>suì</i> the winter solstice is 149/152 lunar cycles from month 11. This means that the conjunction associated with month 12 occurs 3/152 lunar cycles after the winter solstice. Now 3/152 lunar cycles is 13 hours 59 minutes and 18 seconds. If the winter solstice in the 16th <i>suì</i> occurs earlier than 10:00:42, the conjunction associated with month 12 will occur on the same day as the winter solstice. Calculation shows that the winter solstice in the 16th <i>suì</i> occurs at 2:15 and conjunction occurs at 16:13:18 on the same day. That is to say that the winter solstice in the 16th <i>suì</i> falls on the first day of month 12 according to the <i>rùnyú</i> rule, which violates the solstice rule. In China midnight is always considered as the beginning of a day. Even though the winter solstice occurs earlier than the conjunction, they are still regarded as falling on the same day. The solstice rule requires that month 11 must contain the winter solstice. Hence the conjunction that occurs about 14 hours later than the winter solstice is associated with month 11. It then follows that the 15th <i>suì</i> is a leap <i>suì</i> and must have a leap month. The 16th <i>suì</i> does not have a leap month. This shows that the solstice rule sometimes gives a different result from the <i>rùnyú</i> rule.</p><p>From the above example, we see that the two rules can give different results when the lunation fraction of the winter solstice is very close to 1 so that it might fall on the same day as the next conjunction. For the Zhou, Lu, Huangdi and solstice version of the Xia calendars, the lunation fractions of the winter solstice are integer multiples of 1/19. This means that the time difference between the winter solstice and the conjunction after it is greater than 1.55 days. It is therefore impossible to have the winter solstice and the next conjunction occurring on the same day. The <i>rùnyú</i> rule and solstice rule give exactly the same result for these calendars.</p><br><subsect id="noZhongqi">No Zhōngqì Rule (無 中 氣 法)</subsect><p>The no zhōngqì rule also assigns the winter solstice to a designated month in the same way as the solstice rule. Thus a leap month is inserted in a leap <i>suì</i>. The only difference is where a leap month should be placed in a leap <i>suì</i>. The no zhōngqì rule specifies that a leap month is placed in the month that does not contain a major solar term.</p><p>As mentioned in the <a href="solarTerms.html">solar terms page</a>, major solar terms refer to the 12 solar terms Z1, Z2, ..., Z12. Under the <i>pínqì</i> rule, the time difference between any two successive major solar terms is <span class="nowrap">P<sub>s</sub>/12</span> = <span class="nowrap">(30+7/16)</span> days, which is longer than 30 days. This means that a month can only contain at most one major solar term. There are always 12 major solar terms in a <i>suì</i>. It follows that each of the 12 months in a normal <i>suì</i> contains a major solar term. In a leap <i>suì</i>, there are 13 months and so exactly one month must not contain a major solar term. The no zhōngqì rule assigns that month without a major solar term in a leap <i>suì</i> as the leap month. Since the zǐ month is assigned to a particular month and a leap month does not contain any major solar term, every major solar term is fixed to be in a particular calendar month. Take the Xia calendar as an example. Month 11 is assigned to be the month containing the winter solstice (Z11). It follows that month 12 must contain Z12, month 1 must contain Z1 and so on. There is therefore a one-to-one relationship between the 12 normal calendar months and the 12 major solar terms. In other words, <b>the solstice rule requires the winter solstice to be in a designated month, and the no zhōngqì rule requires the 12 major solar terms to be in 12 designated months.</b></p><p>In many cases the no zhōngqì rule agrees with the extended <i>rùnyú</i> rule on which months the leap months should be in. This is also not different to understand. Suppose the lunation fraction of a winter solstice in a leap <i>suì</i> is K (usually ≥12/19), which means the conjunction associated with the zǐ month is K lunar cycles before the winter solstice. The major solar term Z12 is <span class="nowrap">P<sub>s</sub>/12</span> = <span class="nowrap">(1 + 7/228)P<sub>L</sub></span> after the winter solstice, which is (1 + K + <span class="nowrap">7/228</span>) after the zǐ month conjunction and (K + <span class="nowrap">7/228</span>) lunar cycles after the conjunction associated with the second month in the <i>suì</i>. Similarly, the major solar term Z1 is (K + <span class="nowrap">7/228</span> + <span class="nowrap">7/228</span>) lunar cycles after the conjunction associated with the third month in the <i>suì</i>. Note that these numbers are the same as the accumulated values of lunation fraction in the extended <i>rùnyú</i> rule. Suppose the number is equal to or greater than 1, say with solar term Z8. This means that Z8 is equal to or more than one lunar cycle away from the month following the Z7 month (Z7 month means the month containing Z7). In other words, the month following the Z7 month does not contain a major solar term and so is a leap month. This is also the leap month assigned by the extended <i>rùnyú</i> rule. The two rules disagree when the number is very close to 1 so that a major solar term might end up falling on the same day as the lunar conjunction after it, which results in a leap month occurring one month earlier than the extended <i>rùnyú</i> rule.</p><p>In the <i>sìfēn</i> system, 19 solar cycles = 235 lunar cycles. There are 19×12=228 major solar terms in 19 years. Since 235=228+7, there are usually 7 months in a <i>zhāng</i> cycle that do not contain a major solar term. Therefore, the no zhōngqì rule usually have 7 leap months in a <i>zhāng</i> cycle. I say "usually" because 19 solar cycles have 6939.75 days, which is not an integer number of days. Hence it's possible to have a winter solstice occuring later than the conjunction but falling on the same day, which could mess up the counting. A <i>bù</i> cycle has integer number of days, so it's guaranteed that there are exactly 28 leap months in 76 years.</p><p>There is no historical record to suggest whether or not the no zhōngqì rule was implemented before 104 BCE. However, the no zhōngqì rule was the intercalation rule in the Chinese calendar for more than 2000 years since 104 BCE. In 1645, it was decided that the 24 solar terms were to be computed using the <i>dínqì</i> method, which takes into account the non-uniform motion of the Sun. The no zhōngqì rule needs to be modified in order to account for the fact that a month without a major solar term might appear in a normal <i>suì</i> and more than one month can have no major solar term in a leap <i>suì</i>. These were impossible when the solar terms were defined using the <i>pínqì</i> rule. The current intercalation rule is that there is no leap month in a normal <i>suì</i> no matter whether or not there is a month without a major solar term. In a leap <i>suì</i>, the leap month is placed in the first month after the winter solstice that does not contain a major solar term. If the solar terms are computed using the <i>pínqì</i> rule, there cannot be a month without a major solar term in a normal <i>suì</i>, and exactly one month without a major solar term in a leap <i>suì</i>. The current rule reduces to the no zhōngqì rule in this case. So the current rule can be regarded as a generalization of the no zhōngqì rule.</p><br><sect id="examples">Examples of Computing the Ancient Six Calendars</sect><p>In this section I use two examples to demonstrate the computation of the ancient six calendars using the solstice rule and no zhōngqì rule. For convenience, I use N<sub>y</sub> to denote the calendar year whose New Year day was closest to Jan. 1 in year y in the proleptic Julian calendar, and S<sub>y</sub> to denote the <i>suì</i> whose first day was closest to Jan. 1 in year y. Since the New Year days of the six calendars are in general different, N<sub>y</sub> refers to different time periods for the six calendars. For example, <span class="nowrap">N<sub>-325</sub></span> began on Dec. 19, <span class="nowrap">-326</span> and ended on Dec. 7, <span class="nowrap">-325</span> for the Zhou calendar; <span class="nowrap">N<sub>-325</sub></span> began on Dec. 20, <span class="nowrap">-326</span> and ended on Dec. 8, <span class="nowrap">-325</span> for the Lu calendar; <span class="nowrap">N<sub>-325</sub></span> began on Feb. 16, <span class="nowrap">-325</span> and ended on Mar. 5, <span class="nowrap">-324</span> for the Xia calendar. S<sub>y</sub> also refers to different time periods for the six calendars.</p><br><p><b>Example 1: Calculate all the months in N<sub>-386</sub> in the Zhou calendar.</b></p><p>According to equation (4) and Table 2, the Julian day of the winter solstice of the Zhou calendar closest to Jan. 1, <span class="nowrap">-386</span> was<br>JD(W(-386))=1721050.5 + 3/4 - 386×(365 + 1/4) = 1580064.5 + 1/4.<br>The Julian day at noon was 1580065. Using the standard algorithm for converting Julian days to calendar dates (e.g. <a href="https://en.wikipedia.org/wiki/Julian_day#Julian_or_Gregorian_calendar_from_Julian_day_number" target="_blank">algorithm by Richards</a>), the Julian day 1580065 corresponds to Dec. 25, <span class="nowrap">-387</span>. The winter solstice of the Zhou calendar occurred 1/4 days past midnight (i.e. 6 o'clock). According to the formulae for converting a Julian day to sexagenary cycle on our <a href="sexagenary.html">sexagenary cycle page</a>, the stem number of the sexagenary cycle on the date of winter solstice is [mod(X,Y) denotes the remainder of X divided by Y]<br>1 + mod(1580065-1, 10) = 5, and the stem name is wù. The branch number is<br>1 + mod(1580065+1, 12) = 3, and the branch name is yín. So the sexagenary cycle name is wù yín. For the Zhou calendar, the first month is the month containing the winter solstice. This means that the conjunction associated with the first month was the first conjunction on or before the date of the winter solstice. The conjunction times are given by equation (1) and Table 2. We want to find the largest integer i so that<br>1683430.5 + i·P<sub>L</sub> < 1580065.5 <span style="font-size:130%">⇒</span> i=floor(-103365/P<sub>L</sub>) = -3501.<br>Here floor(x) denotes the largest integer smaller than or equal to x. Note that 1580065.5 is the Julian day at midnight of the day after the winter solstice. This is to allow the conjunction to occur later than the winter solstice, but no later than the midnight of the next day<sup><a href="guliuli.html#fn4">fn4</a></sup>. Note also that if -103365/P<sub>L</sub> is an integer, the result should be subtracted by 1 because we don't want the conjunction to occur at the midnight of the date after the winter solstice. This nuisance can be removed by a numerical trick that will be introduced in the next Section. Having solved for i, we can now compute the conjunction time associated with the New Year day of <span class="nowrap">-386</span>:<br>JD<sub>1</sub>=1683430.5-3501×(29+499/940)=1580042.5 + 461/940. The New Year day in the proleptic Julian calendar, calculated using the same method as above, was Dec. 3, <span class="nowrap">-387</span> and the sexagenary cycle was bǐng chén. The lunar conjunction occurred at 461/940 days past midnight, which was 11:46:13 using the current 24-hour time system. In ancient time, Chinese astronomers did not use decimals for almanac calculations. The fractional part of a day was expressed as a fraction, which was called <i>xiǎoyú</i> (小餘) or fractional day. So <span class="nowrap">461/940</span> is the <i>xiǎoyú</i> of the New Year day conjunction. Since the <i>xiǎoyú</i> of a conjunction was always an integer multiples of 1/940, the denominator 940 was often omitted when mentioning the <i>xiǎoyú</i>.</p><p>To determine if there was a leap month in <span class="nowrap">N<sub>-386</sub></span> under the solstice rule or no zhōngqì rule, we need to calculate the number of months between month 1 of <span class="nowrap">N<sub>-386</sub></span> and month 1 of <span class="nowrap">N<sub>-385</sub></span>. Note that <span class="nowrap">S<sub>-386</sub></span> and <span class="nowrap">N<sub>-386</sub></span> are the same for the Zhou calendar. The Julian day of the winter solstice in <span class="nowrap">N<sub>-385</sub></span> was<br>JD(W(-385)) = JD(W(-386)) + 365 + 1/4 = 1580430.<br>The winter solstice was at noon. The Julian day of the next midnight was 1580430.5. If there was no leap month in <span class="nowrap">N<sub>-386</sub></span>, the New Year day conjunction of <span class="nowrap">N<sub>-385</sub></span> would occur 12P<sub>L</sub> after the New Year day conjunction of <span class="nowrap">N<sub>-386</sub></span>. If there was a leap month, it would be 13 <span class="nowrap">P<sub>L</sub></span> after the New Year day conjunction of <span class="nowrap">N<sub>-386</sub></span>. The Julian day 13P<sub>L</sub> after JD<sub>1</sub> was<br>JD<sub>1</sub> + 13P<sub>L</sub> = 1580426.5 + 368/940 < 1580430.5.<br>This means that the month associated with the conjunction at JD<sub>1</sub> + 13P<sub>L</sub> contained the winter solstice and was the first month in <span class="nowrap">N<sub>-385</sub></span>. We conclude that there was a leap month in <span class="nowrap">N<sub>-386</sub></span>. The solstice rule would place the leap month after month 12. The no zhōngqì rule would place it in the month without a major solar term, which can be determined by computing the major solar terms and lunar conjunctions in <span class="nowrap">N<sub>-386</sub></span>. The Julian days of the major solar terms after the winter solstice can be computed by equation (5) or by simply adding integer multiples of <span class="nowrap">P<sub>s</sub>/12</span> to JD(W(-386)). Similarly, the Julian days of the conjunction times after JD<sub>1</sub> can be computed by adding integer multiples of <span class="nowrap">P<sub>L</sub></span> to JD<sub>1</sub>. The results are given in the following table.</p><table><tr><th>JD(conj)-1580000.5</th><th>JD(maj.sol.term)-1580000.5</th></tr><tr><td>42 (month 1)</td><td></td></tr><tr><td></td><td>64 (Z11, winter solstice)</td></tr><tr><td>72</td><td></td></tr><tr><td></td><td>94 (Z12)</td></tr><tr><td>101</td><td></td></tr><tr><td></td><td>125 (Z1)</td></tr><tr><td>131</td><td></td></tr><tr><td></td><td>155 (Z2)</td></tr><tr><td>160</td><td></td></tr><tr><td></td><td>186 (Z3)</td></tr><tr><td>190</td><td></td></tr><tr><td></td><td>216 (Z4)</td></tr><tr><td>219</td><td></td></tr><tr><td></td><td>246 (Z5)</td></tr><tr><td>249</td><td></td></tr><tr><td></td><td>277 (Z6)</td></tr><tr><td>278</td><td></td></tr><tr><td></td><td>307 (Z7)</td></tr><tr><td>308</td><td></td></tr><tr><td>337</td><td></td></tr><tr><td></td><td>338 (Z8)</td></tr><tr><td>367</td><td></td></tr><tr><td></td><td>368 (Z9)</td></tr><tr><td>396</td><td></td></tr><tr><td></td><td>399 (Z10)</td></tr><tr><td>426 (month 1)</td><td></td></tr><tr><td></td><td>429 (Z11, winter solstice)</td></tr></table><br><p>Here JD(conj) is the Julian day at midnight on the day of a conjunction, JD(maj.sol.term) is the Julian day at midnight on the day of a major solar term. Subtracting them by 1580000.5 is to make the numbers smaller. From the table, the month associated with JD(conj)-1580000.5 = 308 did not contain a major solar term. It was the 9th month after month 1 and may be labelled as leap month 9. The following table lists the conjunction dates associated with the months in <span class="nowrap">N<sub>-386</sub></span> in the Zhou calendar. The two intercalation rules have exactly the same conjunction dates, but the month labels are different.</p><table><caption style="text-align:left"><b>Months of N<sub>-386</sub> in the Zhou calendar</b>: Month (sol.) refers to the month number according to the solstice rule, and Month (n.z.) refers to the month number according to the no zhōngqì rule. The denominators of the <i>xiǎoyú</i>s of conjunctions are all 940 and are omitted.</caption><tr><th>Month (sol.)</th><th>Month (n.z.)</th><th>No. of Days</th><th>Conj. Date</th><th><i>Xiǎoyú</i></th></tr><tr><td>1</td><td>1</td><td>30</td><td>Dec. 3, -387 (Bǐng Chén)</td><td>461</td></tr><tr><td>2</td><td>2</td><td>29</td><td>Jan. 2, -386 (Bǐng Xū)</td><td>20</td></tr><tr><td>3</td><td>3</td><td>30</td><td>Jan. 31 (Yǐ Mǎo)</td><td>519</td></tr><tr><td>4</td><td>4</td><td>29</td><td>Mar. 2 (Yǐ Yǒu)</td><td>78</td></tr><tr><td>5</td><td>5</td><td>30</td><td>Mar. 31 (Jiǎ Yín)</td><td>577</td></tr><tr><td>6</td><td>6</td><td>29</td><td>Apr. 30 (Jiǎ Shēn)</td><td>136</td></tr><tr><td>7</td><td>7</td><td>30</td><td>May 29 (Guǐ Chǒu)</td><td>635</td></tr><tr><td>8</td><td>8</td><td>29</td><td>June 28 (Guǐ Wèi)</td><td>194</td></tr><tr><td>9</td><td>9</td><td>30</td><td>July 27 (Rén Zǐ)</td><td>693</td></tr><tr><td>10</td><td>leap 9</td><td>29</td><td>Aug. 26 (Rén Wǔ)</td><td>252</td></tr><tr><td>11</td><td>10</td><td>30</td><td>Sep. 24 (Xīn Hài)</td><td>751</td></tr><tr><td>12</td><td>11</td><td>29</td><td>Oct. 24 (Xīn Sì)</td><td>310</td></tr><tr><td>leap</td><td>12</td><td>30</td><td>Nov. 22 (Gēng Xū)</td><td>809</td></tr></table><br><p>The number of days in a month is determined by the number of days between two successive conjunction dates. As mentioned above, the <i>xiǎoyú</i> of the conjunction is the conjunction time from midnight expressed as a fraction of a day. The denominator 940 is often omitted. Since the lunar cycle is (29 + 499/940) days. The <i>xiǎoyú</i> of a conjunction increases by 499 (mod 940) every month. If the <i>xiǎoyú</i> is smaller than 441, adding 499 to it will still be smaller than 940 and the number of days in the month is 29. If the <i>xiǎoyú</i> is equal to or greater than 441, adding 499 to it will make the conjunction time at or past midnight, and the conjunction will be on the next day. There will be 30 days in the month in this case. Perhaps it is easier to understand this using the 24-hour time system we are currently using. The lunar cycle is 29 days 12 hours 44 minutes and 26 seconds. The time of conjunction from midnight increases by 12 hours 44 minutes and 26 seconds (modulo 24 hours) every month. If the conjunction time is earlier than 11:15:34, adding 12 hours 44 minutes and 26 seconds will still be less than 24 hours and there will be 29 days in the month. If the conjunction time is later than 11:15:34, adding 12 hours 44 minutes and 26 seconds will make the conjunction past midnight and be on the next day. There will be 30 days in the month in this case.</p><br><p><b>Example 2: Calculate all the months in N<sub>-386</sub> in the solstice version of the Xia calendar.</b></p><p>Using equation (4) and Table 2, we find the Julian day of the winter solstice in the <i>suì</i> <span class="nowrap">S<sub>-386</sub></span> was<br>JD(W(-386))=1721053.5 + 3/4 - 386×(365 + 1/4) = 1580067.5 + 1/4,<br>which was on Dec. 28, <span class="nowrap">-387</span> and the sexagenary day was xīn sì. Both the solstice rule and no zhōngqì rule designate month 11 to be the month containing the winter solstice. The conjunction times are given by equation (1) and Table 2. We want to find the largest integer i so that<br>1883590.5 + i·P<sub>L</sub> < 1580068.5 <span style="font-size:130%">⇒</span> i=floor(-303522/P<sub>L</sub>) = -10279.<br>Having find i, we can now calculate the Julian day of the conjunction associated with month 11:<br>JD<sub>1</sub> = 1883590.5 - 10279P<sub>L</sub> = 1580042.5 + 359/940.<br>The <i>xiǎoyú</i> was 359 (omitting the denominator 940). Julian day 1580042.5 corresponds to Dec. 3, <span class="nowrap">-387</span> and the sexagenary day was bǐng chén. To determine if there was a leap month in <span class="nowrap">S<sub>-386</sub></span>, we can compare floor(JD(W(-385))+1.5) and floor(JD<sub>1</sub>+13P<sub>L</sub>+0.5) and see which of them is larger. Adding 0.5 to the Julian day is to measure time from midnight instead of noon.<br>floor(JD(W(-385))+1.5) = floor(1580067.75+365.25+1.5)=1580434,<br>floor(JD<sub>1</sub>+13P<sub>L</sub>+0.5)=floor(1580042.5 + 359/940 + 13×(29 + 499/940) + 0.5) = 1580427 < 1580434,<br>which means that there was a leap month in <span class="nowrap">S<sub>-386</sub></span>. The solstice rule would place the leap month after month 12 and so month 1 was the third month after month 11. Since this New Year day was closest to Jan. 1, <span class="nowrap">-386</span>, it was the New Year day of <span class="nowrap">N<sub>-386</sub></span> by definition. Thus the leap month was in <span class="nowrap">N<sub>-387</sub></span> and there was no leap month in <span class="nowrap">N<sub>-386</sub></span>. The no zhōngqì rule would give a different result. To see that, we have to find out the month without a major solar term in <span class="nowrap">S<sub>-386</sub></span>. Using the same method as in the previous example, I find that the month without a major solar term was the fifth month after month 11, making it in <span class="nowrap">N<sub>-386</sub></span>. The first month was then the second month after month 11 and the leap month was the month after month 3. The following table summarizes the result.</p><table><caption style="text-align:left"><b>Months in N<sub>-386</sub> in the solstice version of the Xia calendar</b>: Month (sol.) refers to the month number according to the solstice rule, and Month (n.z.) refers to the month number according to the no zhōngqì rule. The denominators of the <i>xiǎoyú</i>s of conjunctions are all 940 and are omitted.</caption><tr><th>Month (sol.)</th><th>Month (n.z.)</th><th>No. of Days</th><th>Conj. Date</th><th><i>xiǎoyú</i></th></tr><tr><td>leap<sup>*</sup></td><td>1</td><td>29</td><td>Jan. 31, -386 (Yǐ Mǎo)</td><td>417</td></tr><tr><td>1</td><td>2</td><td>30</td><td>Mar. 1 (Jiǎ Shēn)</td><td>916</td></tr><tr><td>2</td><td>3</td><td>30</td><td>Mar. 31 (Jiǎ Yín)</td><td>475</td></tr><tr><td>3</td><td>leap 3</td><td>29</td><td>Apr. 30 (Jiǎ Shēn)</td><td>34</td></tr><tr><td>4</td><td>4</td><td>30</td><td>May 29 (Guǐ Chǒu)</td><td>533</td></tr><tr><td>5</td><td>5</td><td>29</td><td>June 28 (Guǐ Wèi)</td><td>92</td></tr><tr><td>6</td><td>6</td><td>30</td><td>July 27 (Rén Zǐ)</td><td>591</td></tr><tr><td>7</td><td>7</td><td>29</td><td>Aug. 26 (Rén Wǔ)</td><td>150</td></tr><tr><td>8</td><td>8</td><td>30</td><td>Sep. 24 (Xīn Hài)</td><td>649</td></tr><tr><td>9</td><td>9</td><td>29</td><td>Oct. 24 (Xīn Sì)</td><td>208</td></tr><tr><td>10</td><td>10</td><td>30</td><td>Nov. 22 (Gēng Xū)</td><td>707</td></tr><tr><td>11</td><td>11</td><td>29</td><td>Dec. 22 (Gēng Chén)</td><td>266</td></tr><tr><td>12</td><td>12</td><td>30</td><td>Jan. 20, -385 (Jǐ Yǒu)</td><td>765</td></tr></table><p><sup>*</sup> This was a leap month in N<sub>-387</sub>.</p><br><sect id="decimals">Using Decimals to Compute the Ancient Six Calendars</sect><p>In the previous section, I use fractions to do calendar calculation. The main reason is to introduce the concept of <i>xiǎoyú</i>, a term often appears in books and literature. Modern calculations are usually done on a computer. Although fractions are better in terms of computational efficiency, it is more complicated to write a program to handle fractions. That's why all calendar calculations on this website are done by using floating point numbers. The solar cycle is represented by the number 365.25 and the lunar cycle by 29.53085106382979. However, there is one thing we should be careful. When the <i>xiǎoyú</i> of a conjunction is exactly 0, the conjunction occurs exactly at midnight. The decimal part of the Julian day is exactly 0.5, but floating point roundoff error may give 0.49999999999 instead, resulting in an off-by-one-day error. This can be prevented by adding 0.0001 to the Julian days in Table 2. The <i>xiǎoyú</i>s of conjunctions in the ancient six calendars are always integer multiples of <span class="nowrap">1/940</span> ranging from 0 to <span class="nowrap">939/940</span>. After adding 0.0001, all of the <i>xiǎoyú</i>s are shifted by <span class="nowrap">0.094/940</span>. It is now impossible for the <i>xiǎoyú</i> to be exactly 0 and the floating point roundoff error will never produce a one-day error. Since the conjunctions can no longer occur at midnight, the nuisance mentioned in Example 1 in the previous Section is gone.</p><p>Now that the computation is done using decimals, it is no longer necessary to calculate the <i>xiǎoyú</i>. We can still calculate it if we want to:<br><i>xiǎoyú</i> = JD + 0.5 - floor(JD + 0.5) - 0.0001.<br>The last term is to remove the 0.0001 added to JD. The <i>xiǎoyú</i> in the above equation is given in decimals. If we know it is an integer multiples of <span class="nowrap">1/940</span>, we can easily calculate the numerator:<br><i>xiǎoyú</i> × 940 = floor(940 ( JD + 0.5 - floor(JD + 0.5) )<br>Since 0.0001 is added to the JD, 940 ( JD + 0.5 - floor(JD + 0.5) is some integer plus 0.094. The floor() function simply removes the decimals.</p><p>The lunation fraction of a solar term is also easy to calculate. Suppose JD is the Julian day of a solar term. Then<br>L = (JD - JD(M<sub>0</sub>))/29.53085106382979<br>lunation fraction = L - floor(L)<br>The appropriate value of JD(M<sub>0</sub>) can be found in Table 2 for each of the ancient six calendars. Here L is the time difference between the solar term and the conjunction M<sub>0</sub> at the calendar epoch in units of lunar cycles, i.e. the number of lunations from <span class="nowrap">M<sub>0</sub></span> to the solar term. By definition, the lunation fraction of a solar term is the time from its previous conjunction in units of lunar cycles, which is simply the fractional part of L. If L is negative, the lunation fraction will be 1 - decimal part. Since floor(L) returns the largest integer smaller than or equal to L, the above formula is also valid for negative value of L.</p><br><hr><h2 id="references">Footnotes and References</h2><ul style="list-style-type:none"><li id="fn1"><p>[<span class="ref">fn1</span>] It seems strange that one would assume a solar term and lunar conjunction occurring at the same time because we now know that the orbital periods of the Earth and Moon are not commensurate with each other. Their motions are not dynamically locked like some other objects in the solar system. The ratio 235:19 used by the <i>sìfēn</i> system is only an approximation. It is therefore almost impossible for a solar term and conjunction occurring at the same time, let alone both occurring at midnight. Of course, the ancient people didn't know that. Besides, the concept of winter solstice and conjunction was not rigorously defined. Winter solstice simply referred to the day when the shadow cast by the Sun at solar noon was the longest. Even if the concept were defined rigorously, the instruments at that time would probably only allow them to measure the time to an accuracy of about a day, with the exception that the conjunction time could be measured more accurately during a solar eclipse. Of course, we can interpret the time coincidence statement merely means that the time difference between a particular solar term and conjunction is less than about a day. That the times were assumed to be the same was just for convenience of calculations. A more likely explanation is that the calendar makers were greatly influenced by the "mandate of heaven" political doctrine of the time.</p></li><li id="fn2"><p>[<span class="ref">fn2</span>] Astronomical conjunctions are calculated by the modern method. That is the method described in <a href="docs/sunMoon.pdf">this pdf document</a>, but precession has to be calculated using the Vondrák et. al. precession model described in Section 7.2 of the document. The computed TDB times are then converted to UT1 using the method described in Section 8 of the document. Julian days <span class="nowrap">JD(M<sub>i</sub>)</span> of the calendrical conjunctions are calculated using equation (1) above. The resulting times are regarded as the local times and have to be converted to UT1 for comparison with the astronomical conjunction times. The Zhou calendar was used by the Zhou dynasty whose capital was at the present-day Luoyang. The longitude of Luoyang is λ=112.45°E and its local time is (112.45/360) days ahead of UT1, so (112.45/360) days have to be subtracted from <span class="nowrap">JD(M<sub>i</sub>)</span> to convert from local time Julian day to UT1 Julian day. Three other relevant longitudes are λ=116.98°E (present-day Qufu) for the Lu calendar, λ=108.9°E (present-day Xi'an) for the Zhuanxu calendar, λ=114°E (present-day Kaifeng) for the Xia calendar. I don't know which states used the Huangdi and Yin calendars, and I use λ=114°E to represent the approximate longitudes of places that might have used these calendars. The differences between the local times of the states in the Warring States period were less than one hour and so the results will not change much if a different longitude is used.</p></li><li id="fn3"><p>[<span class="ref">fn3</span>] In the three books <i>Tables of Chinese Calendars in the Pre-Qin Period</i>, <i>3500 Years of Calendars and Astronomical Phenomena</i>, and <i>Ancient Chinese Calendars and Almanacs</i>, Zhāng Péiyú wrote that the Yin calendar designates the zǐ month as the beginning of a year, which is at odds with the commonly accepted notion. He did not explain or justify his statement.</p></li><li id="fn4"><p>[<span class="ref">fn4</span>] For the <i>rùnyú</i> rule, we would want to use the Julian day of the winter solstice 1580064.5 + 1/4 = 1580064.75 and require<br>1683430.5 + i·P<sub>L</sub> ≤ 1580064.75.<br>Note the ≤ instead of < to take into account the possibility of the winter solstice and conjunction occurring at the exact same time.</p></li><li id="Zhang87"><p>[<span class="ref">Zhang87</span>] Zhāng, Péiyú (張培瑜), <i>Zhōng Guó Xiān Qín Shǐ Lìbiǎo</i> (《中国先秦史历表》 or <i>Tables of Chinese Calendars in the Pre-Qin period</i>), Shandong Qilu Press, June 1987.</p></li><li id="Zhang97"><p>[<span class="ref">Zhang97</span>] Zhāng, Péiyú (張培瑜), <i>Sānqiān Wǔbǎiniǎn Lìrì Tiānxiàng</i> (《三千五百年历日天象》 or <i>3500 Years of Calendars and Astronomical Phenomena</i>), Elephant Press, July 1997.</p></li><li id="ZCBH08"><p>[<span class="ref">ZCBH08</span>] Zhāng, Péiyú (張培瑜), Chén, Měidōng (陳美東), Bó, Shùrén (薄樹人), and Hú, Tiězhū (胡鐵珠), <i>Zhōng Guó Gǔdài Lìfǎ</i> (《中国古代历法》 or <i>Ancient Chinese Calendars and Almanacs</i>), China Science Press (Beijing), March 2008.</p></li></ul></div><br><br></body></html>