Use Vim to compute the date of Easter

34 views
Skip to first unread message

Tony Mechelynck

unread,
May 2, 2020, 1:29:36 PM5/2/20
to vim_use
Ever wondered when Easter would happen? Now Vim (version 7 or later)
can tell you. I know it's the wrong season, but I found an algorithm
on Wikipedia (from an anonymous author, dated 1876, and itself
elaborating on an algorithm by Gauss) and decided it would be easy to
program that in Vim script.

So I wrote a little autoload script, tried it, and when it gave
obviously wrong answers I finally found out (not easily) that I had
forgotten a pair of parentheses. Now it does what I want:
easter#date(year), where year is a year number, returns a Dictionary
which is either empty (if the input was invalid; in that case it also
produces a nasty :msgerr to tell you what error was found) or else
contains the keys 'year', 'month' and 'day' with an integer value for
each of them: https://www.vim.org/scripts/script.php?script_id=5878

Known limitation: the input must be an integer (or a String or Float
which will be converted to an Integer) > 1582, and only _Gregorian_
Easter dates are produced. If you want to compute Julian (Orthodox)
Easter, or Pesach, or the Chinese New Year, or something else, go
ahead and write them: they are not the purpose of this script, which
"does one thing, does it predictably, and doesn't try to do a lot of
other things on the side".

Have fun!
Tony.

Chris Willis

unread,
May 2, 2020, 2:06:04 PM5/2/20
to vim_use
Hi Tony

I'm not sure where you're based. You realise, I expect, that England (and I
think the USA) didn't change to the Gregorian calendar until 1752. I'm not
sure whether all western Europe celebrated Easter on the same day despite
the different dates in the interim. It wd appear not.

regards - Chris

Tony Mechelynck

unread,
May 3, 2020, 2:36:40 AM5/3/20
to vim_use
On Sat, May 2, 2020 at 8:05 PM 'Chris Willis' via vim_use
<vim...@googlegroups.com> wrote:
> Known limitation: the input must be an integer (or a String or Float
> which will be converted to an Integer) > 1582, and only _Gregorian_
> Easter dates are produced. If you want to compute Julian (Orthodox)
> Easter, or Pesach, or the Chinese New Year, or something else, go
> ahead and write them: they are not the purpose of this script, which
> "does one thing, does it predictably, and doesn't try to do a lot of
> other things on the side".
>
> Have fun!
> Tony.
>
> Hi Tony
>
> I'm not sure where you're based. You realise, I expect, that England (and I
> think the USA) didn't change to the Gregorian calendar until 1752. I'm not
> sure whether all western Europe celebrated Easter on the same day despite
> the different dates in the interim. It wd appear not.
>
> regards - Chris

Well, no one celebrated Easter according to the Gregorian computus
before the Gregorian calendar reform (October 1582); someone (Spain,
Portugal, the Papal states, much of Italy, France (as it existed at
the time), the united Kingdom of Poland and Grand-Duchy of Lithuania,
…) did as soon as 1583; so it doesn't make sense to use that formula
before 1583 but from that date it does. Catholic, Protestant and
Anglican countries and churches adopted the Gregorian calendar at
various dates in October 1582 or later; nowadays they all use it. OTOH
Orthodox churches usually still use the Julian calendar even though
the civil administration in the same countries uses Gregorian, so
their Easter may or may not be on the same day, sometimes it's one
week apart, sometimes it's one lunar month apart, so don't use this
little program for that, or to know when Easter happened in England in
1600 (if you ask for 1600 you'll get an answer but it will be the date
for, among others, Spain and Portugal).

If you (or anyone) want to know when your country adopted the
Gregorian calendar, see
https://en.wikipedia.org/wiki/Gregorian_calendar#Adoption_of_the_Gregorian_Calendar
— Austria is not mentioned but from the note at "Yugoslavia" you can
deduce that Austria-Hungary switched over in 1583, shortly before the
"Kingdom of Bohemia" (which approximately corresponds to present-day
Czech Republic). Present-day Netherlands are "Protestant Low
Countries" of course, except that IIRC North Brabant and Limburg were
Catholic and under Spanish rule (for Dutch Flanders I'm not sure); and
beware that Strasbourg changed at a different date from the rest of
Alsace and that neither was part of "France" in 1582. For Lorraine see
the note in the rightmost column of the table at
https://en.wikipedia.org/wiki/Gregorian_calendar#Beginning_of_the_year

P.S. I live in Brussels, Belgium, which was then part of "Catholic Low
Countries" and under Spanish rule.

P.P.S. Gauss invented as a child the formula on which this method is a
minor improvement because he wanted to know his birthday: his mother
only remembered that is was "on a Wednesday, one week before Ascension
day". Germany had made the changeover more than 70 years before he was
born, so he used Gregorian computus.


Best regards,
Tony.

Tony Mechelynck

unread,
May 3, 2020, 2:53:53 AM5/3/20
to vim_use
P.P.P.S. For a more precise list of dates of changes back and forth,
see https://en.wikipedia.org/wiki/List_of_adoption_dates_of_the_Gregorian_calendar_per_country

Best regards,
Tony.

BPJ

unread,
May 3, 2020, 7:35:59 AM5/3/20
to vim_use
Den sön 3 maj 2020 08:37Tony Mechelynck <antoine.m...@gmail.com> skrev:

P.P.S. Gauss invented as a child the formula on which this method is a
minor improvement because he wanted to know his birthday: his mother
only remembered that is was "on a Wednesday, one week before Ascension
day". Germany had made the changeover more than 70 years before he was
born, so he used Gregorian computus.

"As a child" is I guess anything from a ten to a twenty year window, depending on how old Gauss was when he learned to read/write/compute and when he was considered an adult. It would be nice to know just how old he was so we could all gasp!

FWIW my granddaughter, who is incredibly smart but probably (I hope for her sake) not a genius at the level of Gauss learned to read at 4 y.o. so it wouldn't surprise me if Gauss was very young when he computed that algorithm. By comparison Mozart is said to have written down lengthy pieces of music after only one hearing at six or seven. I guess if you are a genius in some field you will be born with the talent no matter which field. I was a quadrilingual at that age, not because I was a genius (I most certainly am not!) but because by sheer luck I had been immersed into that many languages already. Kids can do some remarkable things!


--
Better --help|less than helpless

aro...@vex.net

unread,
May 3, 2020, 9:08:30 AM5/3/20
to vim...@googlegroups.com

>>
>> I'm not sure where you're based. You realise, I expect, that England
(and >> I think the USA) didn't change to the Gregorian calendar until
1752.

I'm not sure that anyone in North America in 1752 cared much about dates
more precise than a season, (see "The Soul of A New Machine"), but "cal 9
1752" illustrates the change. (I wonder how rents, salaries, and other
periodic payments were pro-rated?)

Imagine trying to run an airline (or even a railroad) with the sort of
temporal confusion explained in the rest of the message. :-)*

Tony Mechelynck

unread,
May 4, 2020, 1:37:52 PM5/4/20
to BPJ, vim_use
I found the story in the Freench Wikipedia article about Gauss, which
says "Le petit Gauss…" ("The little Gauss") but doesn't give an age.
AFAICT, neither the English nor the Greman Wikipedia mention the story
in Gauss's biography. In the French and English articles about the
computation of the date of Easter it is said he _published_ a first
version of the method in 1800 and a corrected version in 1816 so maybe
he wasn't that much of a child anymore by then (he was born in 1777).

Best rega
Reply all
Reply to author
Forward
0 new messages