Talk:Zeller's congruence

An old comment, which should go
''Heading added for structural reasons. 82.163.24.100 (talk) 23:31, 19 January 2009 (UTC)''

The algorithm is ambiguous. It should be expanded out to actually discuss what it does, especially since it isn't actually using the formula. The German ( http://de.wikipedia.org/wiki/Zellers_Kongruenz) page gives a much better explanation (from what little german I can understand).

Accuracy
The algorithm as given does not seem to be accurate: in particular, how does it handle the transition from February to March?


 * The if m < 3 branch handles the transition from February to March, essentially using the trick of considering years to start on March 1. The algorithm seems correct (for the Gregorian calendar) and unambiguous to me. Note both the algorithm and the formulas are using the notation &lfloor;x&rfloor; for the floor function of x. Ray Spalding 03:34, 19 October 2005 (UTC)
 * That is correct, but I should explain this in the article as well. --R.Koot 08:41, 19 October 2005 (UTC)
 * The example code given does not appear to match the mathematical formula given. Why not?
 * It is based on a fucntion in a C run-time library and it contains some optimizations. There is only one variable for the year and century, and floor((m+1)26/10) is precalculated, and the rather untransparent 'year start at march' trick. --R.Koot 19:42, 8 November 2005 (UTC)

Formula OK
It's important to use the correct values for month, year, century For example: Year means the 2 digit year between 00 and 99. Century means the 2 digit century. The months are numbered from 3 for March to 12 for December. 13 for Jan and 14 for Feb of the prior year (which impacts the century)

For example 29 Feb 2000 has Zeller values of: Month = 14, Year = 99, Century = 19 then: DOW = (Day of Month) + 26*(Zeller_Month=1)/10 + Z_year + Z_Year/4 + Z_Cent/4 +5* Z_Cent DOW =      28       +   26 * (14 + 1)/10     +    99  + 99/4     +   19/4    + 19 DOW =   28MOD7      +        39MOD7          +    1   +  24MOD7  +   4MOD7   + 19MOD7 DOW =      0        +          4             +    1   +    3     +     4     + 4 DOW = 16MOD7 = 2 Monday (Saturday = 0) Have Fun,

Brooke Clarke  brooke@pacific.net updated 1 June 2007 —Preceding unsigned comment added by BrookeClarke (talk • contribs)

Simplifications Error?
In the simplified version it mentions to adjust year by 1 and month by 3 for January and February. However, implementing this gives incorrect results. I think it should be year -1 and month + 12 (to get months 13 and 14) same as with the normal algorithm. — Preceding unsigned comment added by 2601:2C1:280:2E5A:1552:40CA:BAE0:F65B (talk) 14:16, 25 March 2022 (UTC)


 * You are correct, and it looks like somebody fixed that. MiguelMunoz (talk) 22:39, 18 September 2023 (UTC)

Julian Algorithm
The algorithm also does not include a Julian calendar variant. While optimization of the month term is desirable in an implementation, it would probably be better to expand this out in an article on Zeller's Congruence. The optimization could also be shown, but it should be labeled as such. I'd also like to see some logic included to select which calendar is used based on the date. Farinata 16:16, 21 June 2006 (UTC)


 * An article on Zeller's Congruence should present primarily what Zeller wrote, and show separately any optimisations based on Zeller.


 * Selection logic is at best difficult, as the change date varied with location and dates on either Calendar may be wanted for when the other was, or neither were, in use. Negative years should be considered, if only to establish any limits to implementations.


 * 82.163.24.100 23:40, 9 March 2007 (UTC)

Various Comment
Various Comment

Formula

For the avoidance of error, the formulae should be given primarily with respectively +5J & +6J. Zeller included those, albeit secondarily, in the 1882 paper.

A note might be added on the conversion between Zeller's day-of-week numbering and that in ISO 8601 - one just exchanges 0 & 7.

Algorithm

That is NOT Zeller's algorithm. In the 1882 1883 1885 & 1886 papers, Zeller had no lists of numbers or names. The algorithms in Formula are easily enough coded.

Since thare are computer languages which look like each other but differ in detail, any computer code presented should have the language in which it was written & tested, including the version, stated.

References

All four of Zeller's relevant papers should be listed.

Overall

Zeller's papers were as much on Date-of-Easter as Day-of-Week. That derserves a mention in both the "Congruence" and the "Zeller" pages (and in the "Easter" pages proper).

The "Zeller" page has an external link, mislabelled "Comprehensive". The Zeller Society has (or had) a much more comprehensive document.

The Slovenian page "Algoritem za dan v tednu" has a formula not taken directly from Zeller.

Comment about this Wiki page applies also, I think, to "Congruencia de Zeller" - which seems to lack a sidebar link to this English page.

82.163.24.100 16:39, 3 February 2007 (UTC)

Difference between two calendars:

The article claimed the Julian calendar was "offset from the Gregorian calendar by a fixed number of days," which isn't quite correct. It's offset by a fixed number of days each century, but that "fixed" number usually changes when the century changes. I modified the article to clarify this. --MiguelMunoz (talk) 20:56, 2 March 2008 (UTC)


 * Firstly, it's not clear when the century changes - is it at the beginning or at the end of a year divisible by 100? Secondly, the change of difference does not occur at the beginning or the end of a year, but during the interval in which the calendars disagree as to whether it is February or March (that will need re-phrasing after a couple more millennia or so).


 * A Century starts with a year '01; but a Decade is usually years '0 to '9. The term Centade seems useful for the years '00 to '99, but needs to be defined in each document.  Google finds no conflicting usage.


 * 82.163.24.100 (talk) 10:26, 23 June 2008 (UTC)

Avoiding negative numbers
The article makes this ambiguous claim: Both of these differences can be accounted for by replacing the term $$\left\lfloor\frac{J}{4}\right\rfloor - 2J$$ with the term $$5 - J$$, or $$5 + 6J$$ to avoid negative numbers. Huh? I'm not sure when I'm supposed to replace what, and neither of these looks right. To avoid negative numbers, the -J may be replaced with +6J and the -2J may be replaced with +5J. The J/4 term doesn't need to be touched. Also, this point doesn't belong in an explanation of the difference between the two formulas. I also don't know what is meant by "both these differences..." --MiguelMunoz (talk) 06:23, 19 February 2008 (UTC)

Old Discussion
Some of the old comment in this page is no longer needed. Perhaps the "Chief Maintainer" could remove that which is not worth keeping? 82.163.24.100 (talk) 10:26, 23 June 2008 (UTC)

for "Implementation in Software?"
Gregorian, after adjusting m and y


 * $$h = \left(q - 1 + \left\lfloor\frac{(m+1)26}{10}\right\rfloor + y + \left\lfloor\frac{y}{4}\right\rfloor - \left\lfloor\frac{y}{100}\right\rfloor + \left\lfloor\frac{y}{400}\right\rfloor\right) \mod 7,$$

The -1 can be taken into the m term, but that makes the important m expression look less Zellerish.

If that checks out and makes sense, pray put it (and a Julian version?) into the Article. Since the Article may be used to generate working code, it seems desirable that it should indicate the best Zeller-derived code.

82.163.24.100 (talk) 12:35, 24 June 2008 (UTC)

Regarding the adjustment of m and y, it should be noted that these values can be given by the following formulas :


 * $$m = \left(\left(month + 9\right) \mod 12\right) + 3,$$


 * $$y = year - \left\lfloor\frac{m}{13}\right\rfloor $$

72.219.202.186 (talk) 00:29, 20 May 2014 (UTC)

Examples
Joe Kress: Why did you remove the examples? The transition from February to March is a major point of confusion, and I put in two good examples to clarify the point. If you have a problem with them, let's discuss it here. --MiguelMunoz (talk) 17:19, 20 February 2008 (UTC)


 * I have no idea what happened, but I had no intention of removing the examples. I am readding them with some wikification. — Joe Kress (talk) 23:27, 20 February 2008 (UTC)
 * Okay. That's cool. Thanks for putting them back. --75.5.4.210 (talk) 07:42, 21 February 2008 (UTC)

Revised Julian calendar
Is there a variant of Zeller's congruence available for the Revised Julian calendar, and if so how can we source it for putting it in? It would be straightforward to work it out, but that would be original research and banned - even though the actual result would be no different from one found elsewhere. PMLawrence (talk) 12:56, 14 January 2010 (UTC)


 * Zeller did not and could not have developed such an algorithm because he developed his algorithms before the Revised Julian calendar was invented, so it cannot be a Zeller's congruence. If one was later developed, it would have to include Zeller in its name to be included here. — Joe Kress (talk) 20:50, 14 January 2010 (UTC)


 * On the first point, that's why I used the expression "variant of Zeller's congruence". On the second, there is no need for it to be called that, so long as the connection and relevance were pointed out. But none of this addresses where and how we could get it without tripping over the formal original research barrier. PMLawrence (talk) 02:40, 15 January 2010 (UTC)

External links modified
Hello fellow Wikipedians,

I have just added archive links to 4 one external links on Zeller's congruence. Please take a moment to review my edit. You may add after the link to keep me from modifying it, if I keep adding bad data, but formatting bugs should be reported instead. Alternatively, you can add to keep me off the page altogether, but should be used as a last resort. I made the following changes:
 * Attempted to fix sourcing for http://www.merlyn.demon.co.uk/zel-82px.htm
 * Attempted to fix sourcing for http://www.merlyn.demon.co.uk/zel-83px.htm
 * Attempted to fix sourcing for http://www.merlyn.demon.co.uk/zel-85px.htm
 * Attempted to fix sourcing for http://www.merlyn.demon.co.uk/zel-86px.htm

When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at ).

Cheers.—cyberbot II  Talk to my owner :Online 04:23, 31 March 2016 (UTC)

Cariño's Algorithm
A beautiful formula devised by a Filipino Mathematician (Dave Ryan Cariño) is an algorithm using direct substitution without any condition that is applicable from year 1582 onwards.

Let: M as Month of the year (1 = January, 2 = February, ………, 12 = December) D as day of the month (1 to 31) Y as year (1582....∞) D.D as day of the date (0 to 6, 0=Saturday, 6=Friday)

J = (12Y+M-3)/1200

D.D = { 3M + 4 + D - ⌊3M/7⌋ - 2⌊(M+7)/10⌋ + ⌊(50Y+M-3)/40⌋ - ⌊J⌋ + ⌊J/4⌋ } mod 7

Example 1: October 15, 1582, first day of Gregorian calendar. M = 10, D = 15, Y = 1582 J = [(12(1582)+10-3)]/1200 = 18991/1200   = 15.825833 D.D = { 3(10) + 4 + 15 - ⌊3(10)/7⌋ - 2⌊(10+7)/10⌋ + ⌊[50(1582)+10-3]/40⌋ - ⌊15.825833⌋ + ⌊15.825833/4⌋ } mod 7 = { 30 + 4 + 15 - ⌊4.2857⌋ - 2⌊1.7⌋ + ⌊1977.675⌋ - ⌊15.825833⌋ + ⌊3.956⌋ } mod 7 = { 30 + 4 + 15 - 4 - 2 + 1977 - 15 + 3 } mod 7 = { 2008 } mod 7 = 6 ;Friday So, October 15, 1582 is Friday

For Julian Calendar: D.D = { 3M + 2 + D - ⌊3M/7⌋ - 2⌊(M+7)/10⌋ + ⌊(50Y+M-3)/40⌋ } mod 7 — Preceding unsigned comment added by Vincent22914 (talk • contribs) 11:51, 17 January 2018 (UTC)

Problems in "Other Variations"
The "Other Variations" section give four alternatives, but two of them seem to be missing something. The source for the variation by Michal Keith involves changes to the day, and doesn't always work in my tests. The same goes for the JR Stockton variation. When I compare each of these with the standard (13m+1)/5, I get these values for each month: (I adjusted Stockton and Tøndering for "Sunday is Zero.) For Michael Keith, a difference of 1 corresponds to a value of 2 for Sunday. Only Claus Tøndering's variation works. It looks there are missing details on the other two variations. (I also added some text to clarify that Tøndering's variation also used 0 for Sunday.)

Michael Keith: month 3: delta = 1 month 4: delta = 1 month 5: delta = 1 month 6: delta = 1 month 7: delta = 1 month 8: delta = 1 month 9: delta = 1 month 10: delta = 1 month 11: delta = 1 month 12: delta = 1 month 13: delta = 1 month 14: delta = 0

JR Stockton: month 3: delta = 2 month 4: delta = 2 month 5: delta = 2 month 6: delta = 2 month 7: delta = 3 month 8: delta = 2 month 9: delta = 2 month 10: delta = 2 month 11: delta = 2 month 12: delta = 3 month 13: delta = 2 month 14: delta = 2

Claus Tøndering: month 3: delta = 0 month 4: delta = 0 month 5: delta = 0 month 6: delta = 0 month 7: delta = 0 month 8: delta = 0 month 9: delta = 0 month 10: delta = 0 month 11: delta = 0 month 12: delta = 0 month 13: delta = 0 month 14: delta = 0 MiguelMunoz (talk) 22:53, 18 September 2023 (UTC)