Difference between revisions of "Archive:Xhovian calendar"

From CWS Planet
Jump to navigation Jump to search
Line 865: Line 865:


==Xhovian calendrical calculations==
==Xhovian calendrical calculations==
The calendrical arithmetic discussed here is adapted from Gregorian and Julian calendar arithmetic published by [[wikipedia:Nachum Dershowitz|Dershowitz]] and [[wikipedia:Edward Reingold|Reingold]].<ref>{{cite book |first1= Nachum |last1= Dershowitz |first2= Edward M. |last2=Reingold |url= http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/ |title= Calendrical Calculations |edition= 3rd |at= p. 47, footnote 3 |publisher= Cambridge University Press |year= 2008}}</ref> Their book, which will be referred to hereinafter as "CC3", should be consulted for methods to handle [[Anno Domini|BC]] dates and the traditional omission of a [[wikipedia:0 (year)|year zero]], both of which will be ignored here. They define the [[wikipedia:Modular arithmetic|MOD]] operator as x MOD y = x − y × [[wikipedia:Floor and ceiling functions|floor]](x / y), because that expression is valid for negative and floating point operands, returning the [[wikipedia:remainder|remainder]] from dividing x by y while discarding the [[wikipedia:quotient|quotient]].<ref>{{cite book |first1= Nachum |last1= Dershowitz |first2= Edward M. |last2=Reingold |url= http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/ |title= Calendrical Calculations |edition= 3rd |at= p. 18, equation 1.15 |publisher= Cambridge University Press |year= 2008}}</ref> Expressions like floor(x / y) return the quotient from dividing x by y while discarding the remainder.
The calendrical arithmetic discussed here is adapted from Gregorian and Julian calendar arithmetic published by [[wikipedia:Nachum Dershowitz|Dershowitz]] and [[wikipedia:Edward Reingold|Reingold]].<ref>{{cite book |first1= Nachum |last1= Dershowitz |first2= Edward M. |last2=Reingold |url= http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/ |title= Calendrical Calculations |edition= 3rd |at= p. 47, footnote 3 |publisher= Cambridge University Press |year= 2008}}</ref> They define the [[wikipedia:Modular arithmetic|MOD]] operator as x MOD y = x − y × [[wikipedia:Floor and ceiling functions|floor]](x / y), because that expression is valid for negative and floating point operands, returning the [[wikipedia:remainder|remainder]] from dividing x by y while discarding the [[wikipedia:quotient|quotient]].<ref>{{cite book |first1= Nachum |last1= Dershowitz |first2= Edward M. |last2=Reingold |url= http://emr.cs.iit.edu/home/reingold/calendar-book/third-edition/ |title= Calendrical Calculations |edition= 3rd |at= p. 18, equation 1.15 |publisher= Cambridge University Press |year= 2008}}</ref> Expressions like floor(x / y) return the quotient from dividing x by y while discarding the remainder.


===Leap rule===
===Leap rule===
Line 876: Line 876:
:END IF
:END IF
END IF
END IF
===Fixed days===
Calendrical calculations are made consistent and straightforward for arithmetic operations if dates are first converted to an ordinal number of days relative to an agreed-upon epoch, in this case the Xhovian epoch, which was the same as the Gregorian epoch. To find the difference between any two Xhovian dates, convert both to ordinal day counts and simply subtract. To find a past or future date, convert a given date to an ordinal day count, subtract or add the desired number of days, then convert the result to a Xhovian date.
The arithmetic given here will not "crash" if an invalid date is given. To verify that a given date is a valid Xhovian date, convert it to an ordinal day count and then back to a Xhovian date — if the final date differs from the given date then the given date is invalid. This method should also be used to validate any implementation of calendrical arithmetic, by iteratively checking thousands of random and sequential dates for such errors.
To convert a Xhovian date to any other calendar, first convert it to an ordinal day count, and then all that is needed is a function to convert the ordinal days count to that calendar.
To convert a date from any other calendar to a Xhovian date, first convert that calendar date to an ordinal day count, then convert ordinal days to the Revised Julian date.
The following constant defined midnight at the start of Xhovian date Monday, {{nowrap|1 January 1 AD}} as the beginning of the first ordinal day. This moment was [[wikipedia:Julian Day|Julian day]] number 1721425.5.
:''RJepoch'' = 1
CC3 outlines functions for Gregorian and Julian calendar conversions,<ref>For example, see "alt-fixed-from-gregorian" in {{cite book |first1= Nachum |last1= Dershowitz |first2= Edward M. |last2=Reingold |chapterurl= http://emr.cs.iit.edu/home/reingold/calendar-book/second-edition/errata.pdf |chapter= Errata |title= Calendrical Calculations: The Millennium Edition |edition= 2nd |at= erratum 106, equation 2.25 |publisher= Cambridge University Press}}</ref> as well as many other calendars, always calculating in terms of the ordinal day number, which they call the "fixed date" or ''[[Rata Die|rata die]]'' (RD), assigning the number 1 to the Gregorian calendar epoch. The arithmetic herein, by using the same ordinal day numbering epoch, is fully compatible with all CC3 functions for calendrical calculations and date inter-conversions.
One can assign a different integer to the Xhovian epoch, for the purpose of numbering ordinal days relative to some other epoch, but if done so one must take the epoch difference into account when using any CC3 calendar functions and when converting an ordinal day number to a weekday number.
Optionally the ordinal day number can include a fractional component to represent the time as the elapsed fraction of a day. The ordinal day number of the [[wikipedia:Epoch (astronomy)#Julian years and J2000|J2000]] moment ({{nowrap|1 January 2000}} noon) was 730120.5.
===Xhovian to fixed days===
Convert a ''year'', ''month'', and ''day'' to the corresponding fixed day number:
:''PriorYear'' = ''year'' − 1
:''FixedDays'' = ''RJepoch'' + 365 × ''PriorYear'' + floor(''PriorYear'' / 4) + floor((367 × ''month'' − 362) / 12) + ''day'' − 1
If ''month'' is after February then subtract 1 day for a leap year or subtract 2 days for a common year:
:IF ''month'' > 2 THEN
::IF ''isLeapYear''(''year'') THEN
:::''FixedDays'' = ''FixedDays'' − 1
::ELSE
:::''FixedDays'' = ''FixedDays'' − 2
::END IF
:END IF
Finally subtract a day for each prior century year (most of which are non-leap) and then add back in the number of prior century leap years:
:''PriorCenturies'' = floor(''PriorYear'' / 100)
:''FixedDays'' = ''FixedDays'' − ''PriorCenturies'' + floor((2 × ''PriorCenturies'' + 6) / 9)
===Fixed days to Xhovian===
Convert an ordinal day number to the corresponding Xhovian ''year'', ''month'', and ''day'', starting by removing any fractional time-of-day portion:
:''Days'' = floor(''FixedDays'') − ''RJepoch'' + 1
:''PriorCenturies'' = floor(''Days'' / 36524)
:''RemainingDays'' = ''Days'' − 36524 × ''PriorCenturies'' - floor((2 × ''PriorCenturies'' + 6) / 9)
:''PriorSubcycles'' = floor(''RemainingDays'' / 1461)
:''RemainingDays'' = ''RemainingDays'' MOD 1461
:''PriorSubcycleYears'' = floor(''RemainingDays'' / 365)
:''year'' = 100 × ''PriorCenturies'' + 4 × ''PriorSubcycles'' + ''PriorSubcycleYears''
:''RemainingDays'' = ''RemainingDays'' MOD 365
:IF ''RemainingDays'' = 0 THEN
::This is either the 365th day of a common year, or the 365th or 366th day of a leap year. Either way, we have to decrement the year because we went one year too far:
::''year'' = ''year'' − 1
::IF ''isLeapYear''(''year'') AND ''PriorSubcycles''=0 THEN ''RemainingDays''=366 ELSE ''RemainingDays''=365
:END IF
:''PriorDays'' = ''RemainingDays'' − 1
:IF ''isLeapYear''(''year'') THEN ''correction'' = 1 ELSE ''correction'' = 0
:IF ''PriorDays'' < (31+28+''correction'') THEN ''correction'' = 0 ELSE ''correction'' = 2 − ''correction''
:''Month'' = floor((12 × (''PriorDays'' + ''correction'') + 373) / 367)
Finally, calculate the day number within the month by subtracting the Fixed days count for the start of the month from the originally given Fixed days count, and then add one day:
:''Day'' = ''FixedDays'' - ''XhovianToFixed''(''year'', ''month'', 1) + 1
===Fixed days to weekday number===
Convert the ordinal number of days since the Xhovian epoch to a weekday number (Sunday=1 through Saturday = 7):
:''WeekdayNumber'' = (floor(''FixedDays'') − ''RJepoch'' + 1) MOD 7 + 1

Revision as of 09:18, 1 September 2017

The Xhovian Calendar is the most widely used civil calendar of South Baredina. The reformed version used today was devised in 1480 by the Haldian mathematician and astronomer Ajkkën Veuttinec.

It is a solar calendar beginning on the Gregorian date of the 21st of June, in accordance with the occurrence of the summer solstice. An additional day is inserted between the Gregorian dates of the 20th and 21st of June every leap year, which in terms of the Xhovian calendar is defined as being every year divisible four, excluding any year that is also divisible by 100 and yields a remainder of 200 or 600 when divided by 900.

The Xhovian calendar does not split the year up into months, and so the date is typically written in the formats of DDD/YY, DDD/YYYY, or more rarely, YYYY/DDD.

Arithmetic

The following are Gregorian minus Xhovian date differences, calculated for the beginning of March in each century year, which is where differences arise or disappear, until 10000 AD. These are exact arithmetic calculations, not depending on any astronomy. A negative difference means that the proleptic Xhovian calendar was behind the proleptic Gregorian calendar. The Xhovian calendar is the same as the Gregorian calendar from 1 March 1600 to 28 February 2800. A positive difference means that the Xhovian calendar will be ahead of the Gregorian calendar, which will first occur on 1 March 2800:

Gregorian minus Xhovian date differences
Century
Difference
100
0
200
−1
300
−1
400
0
500
0
600
−1
700
−1
800
0
900
0
1000
0
Century
Difference
1100
−1
1200
0
1300
0
1400
0
1500
−1
1600
0
1700
0
1800
0
1900
0
2000
0
Century
Difference
2100
0
2200
0
2300
0
2400
0
2500
0
2600
0
2700
0
2800
+1
2900
0
3000
0
Century
Difference
3100
0
3200
+1
3300
0
3400
0
3500
0
3600
+1
3700
+1
3800
0
3900
0
4000
+1
Century
Difference
4100
+1
4200
0
4300
0
4400
+1
4500
+1
4600
+1
4700
0
4800
+1
4900
+1
5000
+1
Century
Difference
5100
0
5200
+1
5300
+1
5400
+1
5500
+1
5600
+1
5700
+1
5800
+1
5900
+1
6000
+1
Century
Difference
6100
+1
6200
+1
6300
+1
6400
+2
6500
+1
6600
+1
6700
+1
6800
+2
6900
+1
7000
+1
Century
Difference
7100
+1
7200
+2
7300
+2
7400
+1
7500
+1
7600
+2
7700
+2
7800
+1
7900
+1
8000
+2
Century
Difference
8100
+2
8200
+2
8300
+1
8400
+2
8500
+2
8600
+2
8700
+1
8800
+2
8900
+2
9000
+2
Century
Difference
9100
+2
9200
+2
9300
+2
9400
+2
9500
+2
9600
+2
9700
+2
9800
+2
9900
+2
10000
+3

The Xhovian leap rule omits seven of nine century leap years, leaving 225−7 = 218 leap days per 900-year cycle. Thus the calendar mean year is 365+218900 days, but this is actually a double-cycle that reduces to 365+109450 = ~365.242 days, or exactly 365 days 5 hours 48 minutes 48 seconds, which is exactly 24 seconds shorter than the Gregorian mean year of 365.2425 days, so in the long term on average the Xhovian calendar pulls ahead of the Gregorian calendar by one day in 3600 years.

The number of days per Xhovian calendar cycle = 900 × 365 + 218 = 328,718 days. Taking mod 7 leaves a remainder of 5, so unlike the Gregorian calendar, the Xhovian calendar cycle does not contain a whole number of weeks. Therefore, a full repetition of the Xhovian leap cycle with respect to the seven-day weekly cycle is seven times the cycle length = 7 × 900 = 6300 years.

Conversion

The following is a table listing the conversion of all dates of the year from the Gregorian to the Xhovian calendar, excluding during leap years.
It is read from left to right in pairs in columns, so for example, the Gregorian date January 1st is the Xhovian date '196th'.

January Xhovian February Xhovian March Xhovian April Xhovian May Xhovian June Xhovian July Xhovian August Xhovian September Xhovian October Xhovian November Xhovian December Xhovian
1 196 1 227 1 255 1 286 1 316 1 347 1 12 1 43 1 74 1 104 1 135 1 165
2 197 2 228 2 256 2 287 2 317 2 348 2 13 2 44 2 75 2 105 2 136 2 166
3 198 3 229 3 257 3 288 3 318 3 349 3 14 3 45 3 76 3 106 3 137 3 167
4 199 4 230 4 258 4 289 4 319 4 350 4 15 4 46 4 77 4 107 4 138 4 168
5 200 5 231 5 259 5 290 5 320 5 351 5 16 5 47 5 78 5 108 5 139 5 169
6 201 6 232 6 260 6 291 6 321 6 352 6 17 6 48 6 79 6 109 6 140 6 170
7 202 7 233 7 261 7 292 7 322 7 353 7 18 7 49 7 80 7 110 7 141 7 171
8 203 8 234 8 262 8 293 8 323 8 354 8 19 8 50 8 81 8 111 8 142 8 172
9 204 9 235 9 263 9 294 9 324 9 355 9 20 9 51 9 82 9 112 9 143 9 173
10 205 10 236 10 264 10 295 10 325 10 356 10 21 10 52 10 83 10 113 10 144 10 174
11 206 11 237 11 265 11 296 11 326 11 357 11 22 11 53 11 84 11 114 11 145 11 175
12 207 12 238 12 266 12 297 12 327 12 358 12 23 12 54 12 85 12 115 12 146 12 176
13 208 13 239 13 267 13 298 13 328 13 359 13 24 13 55 13 86 13 116 13 147 13 177
14 209 14 240 14 268 14 299 14 329 14 360 14 25 14 56 14 87 14 117 14 148 14 178
15 210 15 241 15 269 15 300 15 330 15 361 15 26 15 57 15 88 15 118 15 149 15 179
16 211 16 242 16 270 16 301 16 331 16 362 16 27 16 58 16 89 16 119 16 150 16 180
17 212 17 243 17 271 17 302 17 332 17 363 17 28 17 59 17 90 17 120 17 151 17 181
18 213 18 244 18 272 18 303 18 333 18 364 18 29 18 60 18 91 18 121 18 152 18 182
19 214 19 245 19 273 19 304 19 334 19 365 19 30 19 61 19 92 19 122 19 153 19 183
20 215 20 246 20 274 20 305 20 335 20 1 20 31 20 62 20 93 20 123 20 154 20 184
21 216 21 247 21 275 21 306 21 336 21 2 21 32 21 63 21 94 21 124 21 155 21 185
22 217 22 248 22 276 22 307 22 337 22 3 22 33 22 64 22 95 22 125 22 156 22 186
23 218 23 249 23 277 23 308 23 338 23 4 23 34 23 65 23 96 23 126 23 157 23 187
24 219 24 250 24 278 24 309 24 339 24 5 24 35 24 66 24 97 24 127 24 158 24 188
25 220 25 251 25 279 25 310 25 340 25 6 25 36 25 67 25 98 25 128 25 159 25 189
26 221 26 252 26 280 26 311 26 341 26 7 26 37 26 68 26 99 26 129 26 160 26 190
27 222 27 253 27 281 27 312 27 342 27 8 27 38 27 69 27 100 27 130 27 161 27 191
28 223 28 254 28 281 28 313 28 343 28 9 28 39 28 70 28 101 28 131 28 162 28 192
29 224 --- --- 29 283 29 314 29 344 29 10 29 40 29 71 29 102 29 132 29 163 29 193
30 225 --- --- 30 284 30 315 30 345 30 11 30 41 30 72 30 103 30 133 30 164 30 194
31 226 --- --- 31 285 --- --- 31 346 --- --- 31 42 31 73 --- --- 31 134 --- --- 31 195

Xhovian calendrical calculations

The calendrical arithmetic discussed here is adapted from Gregorian and Julian calendar arithmetic published by Dershowitz and Reingold.[1] They define the MOD operator as x MOD y = x − y × floor(x / y), because that expression is valid for negative and floating point operands, returning the remainder from dividing x by y while discarding the quotient.[2] Expressions like floor(x / y) return the quotient from dividing x by y while discarding the remainder.

Leap rule

isLeapYear = (year MOD 4 = 0)

IF isLeapYear THEN

IF year MOD 100 = 0 THEN
Century = (year / 100) MOD 9
isLeapYear = (Century=2) OR (Century=6)
END IF

END IF

  1. Dershowitz, Nachum; Reingold, Edward M. (2008). Calendrical Calculations (3rd ed.). Cambridge University Press. p. 47, footnote 3.
  2. Dershowitz, Nachum; Reingold, Edward M. (2008). Calendrical Calculations (3rd ed.). Cambridge University Press. p. 18, equation 1.15.