Use Vim to compute the date of Easter

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Use Vim to compute the date of Easter

Tony Mechelynck
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.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXuSGy%2BtbhuvM3C5XszYLTXv1q%3DeZ%3DB60-Vp4pGK3nDNxQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Use Vim to compute the date of Easter

Chris Willis


-----Original Message-----
From: Tony Mechelynck
Sent: Saturday, May 02, 2020 6:29 PM
To: vim_use
Subject: Use Vim to compute the date of Easter

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.

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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/AA8341F35AA1408EB163AE2C54C81480%40ChrisPCW7.
Reply | Threaded
Open this post in threaded view
|

Re: Use Vim to compute the date of Easter

Tony Mechelynck
On Sat, May 2, 2020 at 8:05 PM 'Chris Willis' via vim_use
<[hidden email]> 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.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXuQmPMCQ36wyQLgrL0JVjYMfL23%3D%2BSAawW_sQa69Se1Kg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Use Vim to compute the date of Easter

Tony Mechelynck
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.

On Sun, May 3, 2020 at 8:36 AM Tony Mechelynck
<[hidden email]> wrote:

>
> On Sat, May 2, 2020 at 8:05 PM 'Chris Willis' via vim_use
> <[hidden email]> 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.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXs6njDvpAJX8uFynXA%3DACTqkQ1Fbo5ubVOQieWuhe3Pmg%40mail.gmail.com.
BPJ
Reply | Threaded
Open this post in threaded view
|

Re: Use Vim to compute the date of Easter

BPJ
In reply to this post by Tony Mechelynck
Den sön 3 maj 2020 08:37Tony Mechelynck <[hidden email]> 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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhCyhzRY4LZPeK4wR%3DoumkWoAJJS62oqDDQQee-7RDfPcQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Use Vim to compute the date of Easter

arocker
In reply to this post by Tony Mechelynck

>>
>> 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. :-)*

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ece65d57512deb789254829b43d55d49.squirrel%40mail.vybenetworks.com.
Reply | Threaded
Open this post in threaded view
|

Re: Use Vim to compute the date of Easter

Tony Mechelynck
In reply to this post by BPJ
On Sun, May 3, 2020 at 1:35 PM BPJ <[hidden email]> wrote:

>
> Den sön 3 maj 2020 08:37Tony Mechelynck <[hidden email]> 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!

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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsSbCJhnecNFRHnQpz2PQzZyNGkHkr2D_ZQu0w-jJ7uAA%40mail.gmail.com.