Jewish calendar computational formula wanted

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

Jewish calendar computational formula wanted

Moongazer
Hello calendar friends,

I am making an online molad calculator and in the process I was confronted by a computational question about the Jewish calendar that I have never encountered before.

The question is this:

If all the months of the calendar are numbered sequentially in an ever increasing count, commencing with 1 for month 1 of year 1, then, given any such month number, m, is there a formula that will obtain from m the year number in which m occurs and the ordinal month number of m within that year?

There is a formula for the reverse calculation, i.e. to obtain (n), the total number of months up to the beginning of year Y, n = 235Y-234.

The above is just an algebraic reduction of the sum of a + b, where:

a = 12(Y-1) and b = (7(Y-1)+1)\19

(where \ denotes an integer division, retaining only the integer portion of the quotient.)

(a) is, quite obviously, the number of common years up to year Y.

(b) less obviously, gives the total number of intercalated months during the same period.

(b) is based on the fact that (7Y+1)\19 gives the number of leap years up to and including Y. I have no mathematical proof of this (I'd be interested to see it if there is one), but there is a simple empirical proof for it: It can be easily shown to work for all 19 years of a Metonic cycle of the Jewish-calendar, and if it works for all the years of a cycle, it can be applied to any year number, because every Metonic cycle of the Jewish calendar begins with a year of the form 19n+1 (n>=0).

That formula is very useful for calculating a molad time. I needed the reverse formula only recently for my molad calculator. Initially it alowed the user to jump to another month, n months from the present one, where n is user-selectable. The molad could be calculated from just the month number, but to display a year and month name for it would be harder. I no longer need a formula for that,  because the available intervals are now limited to 1 month or 1 or more years, which means the program can keep track of the year.

I may write something in a separate post about the online molad calculator I am writing. It is of a unique design, whose purpose is mainly educational rather than utilitarian.

Reply | Threaded
Open this post in threaded view
|

Re: Jewish calendar computational formula wanted

Moongazer
Correction to wording of previous post, this subject:

(a) is, quite obviously, the number of common years up to year Y.

should have been:

(a) is, quite obviously, the number of months in all the common years up to year Y.
Reply | Threaded
Open this post in threaded view
|

Re: Jewish calendar computational formula wanted

Moongazer
In reply to this post by Moongazer
Sorry, I just realised the correction I sent earlier was itself inadequately worded:
Text in original post read:

(a) is, quite obviously, the number of common years up to year Y.

It should have said:

(a) is, quite obviously, the number of months in all the years up to year Y, excluding the intercalated ones.

BTW, I hope it was clear from my original post, this subject, that, even though I no longer need it for the molad calculator I am writing, I am still interested in obtaining the formula I asked for - if anyone knows of one that works. Of course, it can be done programmatically in a guessing loop, until the right answer is found, confirmed by the opposite formula I gave. But it would be nice to have a proper formula yielding the correct result if that is possible.

Reply | Threaded
Open this post in threaded view
|

Re: Jewish calendar computational formula wanted

Karl Palmen
In reply to this post by Moongazer
Dear Moongazer and Calendar People

http://hebrewcalendar.tripod.com/#07 gives a formula for the number of months N before Hebrew year Y as

the integer of ((235*Y - 234) / 19 )

Moongazer has missed out the 19 and the 'the integer of', but put them back in his definition of b, which is got by subtracting 12*(Y-1) from the above.

Moongazer wants the inverse of this, giving the year that month N occurs and its position in that year. Such a formula would be useful for determining which month has a given time of day for its molad.

In this paragraph, I'll refer to the time of day of the molad, just as the molad.
The molad increments 13753/25920 days each month (ignoring whole days).
and so -1/25920 days every 3383 months.
From this and the molad of month 1, one can get the month number N for a given molad in the first 25920-month cycle (hence modulo 25920). Then the inverse formula could be used to find the year and month number.

The 3383-month period is the 3-era cycle of 67+70+70 = 207 yerms in the Hebrew Yerm calendar whose months always begin on the day of the Molad or Irv's variation where the months begin on the day of the molad + 6hrs.

Karl

16(12(24

-----Original Message-----
From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Moongazer
Sent: 16 August 2017 08:47
To: [hidden email]
Subject: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Hello calendar friends,

I am making an online molad calculator and in the process I was confronted
by a computational question about the Jewish calendar that I have never
encountered before.

The question is this:

If all the months of the calendar are numbered sequentially in an ever
increasing count, commencing with 1 for month 1 of year 1, then, given any
such month number, m, is there a formula that will obtain from m the year
number in which m occurs and the ordinal month number of m within that year?

There is a formula for the reverse calculation, i.e. to obtain (n), the
total number of months up to the beginning of year Y, n = 235Y-234.

The above is just an algebraic reduction of the sum of a + b, where:

a = 12(Y-1) and b = (7(Y-1)+1)\19

(where \ denotes an integer division, retaining only the integer portion of
the quotient.)

(a) is, quite obviously, the number of common years up to year Y.

(b) less obviously, gives the total number of intercalated months during the
same period.

(b) is based on the fact that (7Y+1)\19 gives the number of leap years up to
and including Y. I have no mathematical proof of this (I'd be interested to
see it if there is one), but there is a simple empirical proof for it: It
can be easily shown to work for all 19 years of a Metonic cycle of the
Jewish-calendar, and if it works for all the years of a cycle, it can be
applied to any year number, because every Metonic cycle of the Jewish
calendar begins with a year of the form 19n+1 (n>=0).

That formula is very useful for calculating a molad time. I needed the
reverse formula only recently for my molad calculator. Initially it alowed
the user to jump to another month, n months from the present one, where n is
user-selectable. The molad could be calculated from just the month number,
but to display a year and month name for it would be harder. I no longer
need a formula for that,  because the available intervals are now limited to
1 month or 1 or more years, which means the program can keep track of the
year.

I may write something in a separate post about the online molad calculator I
am writing. It is of a unique design, whose purpose is mainly educational
rather than utilitarian.





--
View this message in context: http://secure-web.cisco.com/1E3O0-hhl_rjG3pyjGf9u4DgL8Cx31WzHJvZF68zmOphW0bvS9Cgt_SkoFORic0CNsqIo1NpbnKD_qenPdL5W0AwWWcxqmka31TBfiCQ3Jt7xNqm3LveQxmn2YxWz4xiWgYwuDWMnO_wZ2ZOZsJWrEyjsarI9oBvRNOl4c5BzMvf35qh0rio5MqhP7kC_dCkpifspKRVUpTXqkzv6C_q53N2BhzX3DDtzWjLXD5NN0eMQ-eAbdLdI7CIoBn0J9BUovKScuOb4dZMQklkw70YUwvOZYGDnBe1SJXjA31tR-X4oaLBdEiqnlQQkdqw7mKH34KcVtvWrnL8O_J4E2TS1cQhqzDTlqWbcFWowVtTI91viV9SCKna48-3V98M2rrB4ERDNJ23Pe9I_W5q_j3f5PQAO61w1W9vZ44kEd4rw7MBTDY3IRMQ50HldZ1GevZdgEsVmbIKxvKcGdXUM6rEZVWunaDrHSv4cnbiEUAeEgq4/http%3A%2F%2Fcalndr-l.10958.n7.nabble.com%2FJewish-calendar-computational-formula-wanted-tp17906.html
Sent from the Calndr-L mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Michael H Deckers
In reply to this post by Moongazer
   On 2017-08-16 07:47, Moongazer asked:


>  If all the months of the calendar are numbered sequentially in an ever
>  increasing count, commencing with 1 for month 1 of year 1, then, given any
>  such month number, m, is there a formula that will obtain from m the year
>  number in which m occurs and the ordinal month number of m within that year?


    I am not sure, but perhaps you need the following algebraic facts:
    For integral Y and M and arbitrary real number α, the relation

    [a]      ceil((Y·235 - α)/19) <=    M

    (where ceil(A) = the least integer >= A) is equivalent to the
    relation (ie, either relation holds only if the other holds):

    [b]            Y·235 - α      <= 19·M,

    which relation in turn is equivalent to

    [c]            Y              <= floor((19·M + α)/235 )

    (where floor(A) = the greatest integer <= A).
    Hence, for any integral M,

                   Y               = floor((19·M + α)/235 )

    is the greatest integer Y so that either one, and hence all of,
    [a], [b], and [c] hold; and with this choice of Y, one has

             ceil((Y·235 - α)/19)  = M - floor(((19·M + α) mod 235)/19)

    (where A mod B = A - B·floor(A/B) for B /= 0).

    Michael Deckers.



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Irv Bromberg
In reply to this post by Moongazer
From: East Carolina University Calendar discussion List [[hidden email]] on behalf of Moongazer [[hidden email]]
Sent: Wednesday, August 16, 2017 03:47

I am making an online molad calculator and in the process I was confronted
by a computational question about the Jewish calendar that I have never
encountered before.

If all the months of the calendar are numbered sequentially in an ever
increasing count, commencing with 1 for month 1 of year 1, then, given any
such month number, m, is there a formula that will obtain from m the year
number in which m occurs and the ordinal month number of m within that year?


See my explanation here:

http://individual.utoronto.ca/kalendis/hebrew/molad.htm#calc

-- Irv Bromberg, Toronto, Canada

http://www.sym454.org/hebrew/
Reply | Threaded
Open this post in threaded view
|

Tropico-Sidereal or Tithi calendar Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Brij Bhushan metric VIJ
Irv, Karl, Victor calendar folks, sirs:
>I was confronted by a computational >question about the Jewish calendar that I >have never encountered before.
Suspicious messages have generated a 'series of messages' aimed at evolving a parallel clock (in addition) to solar clock, aligned for 'Sidereal Day' clock timing and for perhaps establishing the duration of Tithi duration of 966/965, 968/967 or my
1+335/326819 day (phase for 19-year cycle) & 1+338/ 326919 day Tithi/phases for 448/896-year developed cycle (using the extra duration=0.49287326 day) once for 448-years; and twice at 299th Year & at 597th Year- aligning with the duration =29.53058886 days; of 'dark to dark moons or new to new moons' revising perhaps the improved Molad period.

image1.JPG (306K) Download Attachment
ATT00001.txt (880 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Karl Palmen
In reply to this post by Irv Bromberg

Dear Irv, Moongazer and Calendar People

 

I looked at the section Irv linked and it does not appear to contain such a formula. I did find a formula giving the month number counted from epoch given the year number and month of year, but not one that gives the year number and month of year given the month number counted from epoch.

 

I’ll check whether the book “Calendical Calculations” 2nd edition makes use of such a formula in calculating the Hebrew date of a given day.

https://web.archive.org/web/20160904180915/http://www.cs.tau.ac.il:80/~nachum/calendar-book/index.shtml

 

 

I stated that an interval of 3383 months reduces the time of day of the molad by 1 part. To find such an interval for the time of week of the molad, one needs to add four 25920-month cycles to make the total interval a whole number of weeks. This leads to 107063 months reducing the time of week of the molad by 1 part. This is more than half the 7*25920-month cycle of the time of week of the molad and we have a shorter interval in which the time of week of the molad goes up by 1. This is 7*25920 – 107063 = 74377 months.

 

Hence an interval of 74377 months increases the time of week of the molad by 1 part.

 

Karl

 

16(12(26

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Irv Bromberg
Sent: 17 August 2017 17:38
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

From: East Carolina University Calendar discussion List [[hidden email]] on behalf of Moongazer [[hidden email]]
Sent: Wednesday, August 16, 2017 03:47

I am making an online molad calculator and in the process I was confronted
by a computational question about the Jewish calendar that I have never
encountered before.

If all the months of the calendar are numbered sequentially in an ever
increasing count, commencing with 1 for month 1 of year 1, then, given any
such month number, m, is there a formula that will obtain from m the year
number in which m occurs and the ordinal month number of m within that year?



See my explanation here:

http://individual.utoronto.ca/kalendis/hebrew/molad.htm#calc

-- Irv Bromberg, Toronto, Canada

http://www.sym454.org/hebrew/

Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Amos Shapir-2
Hi Moongazer and calendar people,

Actually, the formula is quite simple, considering there are exactly 235 months in any 19-year period
("div" is the integer division operation, without remainder; "mod" is the remainder operation; they have the precedence of division operations, i.e. carried out before addition & subtraction):

First, compute the number of whole 19-year periods:
     y1 = m div 235 * 19

Then, add the year number inside the last period:
       m = m mod 235
       y2 = (m + 38) * 19 div 235 - 2
       y = y1 + y2

The month number within the year is given by
       m1 = (m + 38) - (y2+2) * 235 div 19

(The offsets of 38 & 2 are needed because the Jewish calendar's distribution of leap years in a 19-year cycle is not the same as it would be if both m  and y were counted from 0).

Note: If you obtain that month number by dividing a certain number of days from the epoch (first new moon) and dividing by the traditional lunar month length, you'd get the molad month; in this case, the formula approximates the year and month within it, but the actual calendar year & month may be different if the day falls near the start or end of a month.


On Fri, Aug 18, 2017 at 3:01 PM, Karl Palmen <[hidden email]> wrote:

Dear Irv, Moongazer and Calendar People

 

I looked at the section Irv linked and it does not appear to contain such a formula. I did find a formula giving the month number counted from epoch given the year number and month of year, but not one that gives the year number and month of year given the month number counted from epoch.

 

I’ll check whether the book “Calendical Calculations” 2nd edition makes use of such a formula in calculating the Hebrew date of a given day.

https://web.archive.org/web/20160904180915/http://www.cs.tau.ac.il:80/~nachum/calendar-book/index.shtml

 

 

I stated that an interval of 3383 months reduces the time of day of the molad by 1 part. To find such an interval for the time of week of the molad, one needs to add four 25920-month cycles to make the total interval a whole number of weeks. This leads to 107063 months reducing the time of week of the molad by 1 part. This is more than half the 7*25920-month cycle of the time of week of the molad and we have a shorter interval in which the time of week of the molad goes up by 1. This is 7*25920 – 107063 = 74377 months.

 

Hence an interval of 74377 months increases the time of week of the molad by 1 part.

 

Karl

 

16(12(26

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Irv Bromberg
Sent: 17 August 2017 17:38
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

From: East Carolina University Calendar discussion List [[hidden email]] on behalf of Moongazer [[hidden email]]
Sent: Wednesday, August 16, 2017 03:47

I am making an online molad calculator and in the process I was confronted
by a computational question about the Jewish calendar that I have never
encountered before.

If all the months of the calendar are numbered sequentially in an ever
increasing count, commencing with 1 for month 1 of year 1, then, given any
such month number, m, is there a formula that will obtain from m the year
number in which m occurs and the ordinal month number of m within that year?



See my explanation here:

http://individual.utoronto.ca/kalendis/hebrew/molad.htm#calc

-- Irv Bromberg, Toronto, Canada

http://www.sym454.org/hebrew/




--
Amos Shapir
 
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Karl Palmen

Dear Amos and Calendar People

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Amos Shapir
Sent: 19 August 2017 09:42
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

Hi Moongazer and calendar people,

Actually, the formula is quite simple, considering there are exactly 235 months in any 19-year period

("div" is the integer division operation, without remainder; "mod" is the remainder operation; they have the precedence of division operations, i.e. carried out before addition & subtraction):


First, compute the number of whole 19-year periods:

     y1 = m div 235 * 19

KARL REPLIES:

I make that p =  m div 235.

The value y1 seems to be 19*p, the number of years in whole 19-year periods. This is not clear and only apples if div take precedence over multiplication (as well as addition & subtraction).

 

Then, add the year number inside the last period:

       m = m mod 235

       y2 = (m + 38) * 19 div 235 - 2

       y = y1 + y2

 

KARL REPLIES:

So y2 is the year of the current or least 19-year period. If div takes precedence over multiplication, the result would always be -2. So I make the correct LH argument of div to be (n + 38)*19.

Also isn’t y = ((m + 38) * 19) div 235 – 2, where m has not had mod 235 applied. If such a formula works for the first 19-year cycle, it’ll work for all 19-year cycles, because y goes up by 19 whenever m goes up by 235.

 

The month number within the year is given by

       m1 = (m + 38) - (y2+2) * 235 div 19

 

(The offsets of 38 & 2 are needed because the Jewish calendar's distribution of leap years in a 19-year cycle is not the same as it would be if both m  and y were counted from 0).

Note: If you obtain that month number by dividing a certain number of days from the epoch (first new moon) and dividing by the traditional lunar month length, you'd get the molad month; in this case, the formula approximates the year and month within it, but the actual calendar year & month may be different if the day falls near the start or end of a month.

KARL REPLIES: I decide to do my own calculation.

For the first 19-year cycle the first month of each year is when, the following number of months has elapsed

12, 24,  37, 49, 61,  74, 86,  99, 111, 123,  136, 148, 160,  173, 185,  197,  210, 222,  235.

Now I look for a linear function with gradient 19/235, which for each of these numbers, rounds down to 1, 2, 3, … but for the numbers 1 less rounds down to 1 less. This would apply if the fractional part of this linear function is less than 19/235 for these numbers. I know that 99 and 197 are critical values. One of these will have an integer value in the linear function and the other a fractional part of 18/235. Also the number of months elapsed before a leap year must have, in the linear function, a fractional part less the 7/235  (so adding 12*19/235 does not change the integer part). 197 (rather than 99) is the number of months elapsed before a leap year (17) and so it has the integer value in the linear function. Therefore,  I work it out as follows

 

m   y(unrounded)

000 00 17/235 (offset)

012 01 10/235

024 02 03/235 (start of leap year)

037 03 15/235 (leap year elapsed)

049 04 08/235

061 05 01/235 (start of leap year)

074 06 13/235 (leap year elapsed)

086 07 06/235 (start of leap year)

099 08 18/235 (leap year elapsed)

111 09 11/235

123 10 04/235 (start of leap year)

136 11 16/235 (leap year elapsed)

148 12 09/235

160 13 02/235 (start of leap year)

173 14 14/235 (leap year elapsed)

185 15 07/235

197 16        (start of leap year)

210 17 12/235 (leap year elapsed)

222 18 05/235 (start of leap year)

235 19 17/235 (leap year elapsed)

And so on every 235 months or 19 years.

 

So I make it y = floor( m*19/235 + 17/235)  for elapsed years and so = floor( m*19/235 + 17/235)  + 1 for actual years.

In Amos’s notation this becomes y = (m*19 + 17) div 235 + 1.

This is equivalent to Amos’s formula:

y =((m + 38) * 19) div 235 – 2

y =(m*19 + 722) div 235 – 2

Then we can take 3*235 = 705 out of the LH argument of the div to get

y =(m*19 + 17) div 235 + 1

 

Then I realise m refers to elapsed months. For months counted from year 1 month 1, we must subtract 1 from m (to allow it to be 1 greater). Then we get

y =(m*19 - 2) div 235 + 1

 

Only one offset is needed and as so, the formula is equivalent to

y =(m*19 + 233) div 235

 

I’m still to check what formula “Calendrical Calculations” uses.

 

 

Karl

 

16(12(29

 

On Fri, Aug 18, 2017 at 3:01 PM, Karl Palmen <[hidden email]> wrote:

Dear Irv, Moongazer and Calendar People

 

I looked at the section Irv linked and it does not appear to contain such a formula. I did find a formula giving the month number counted from epoch given the year number and month of year, but not one that gives the year number and month of year given the month number counted from epoch.

 

I’ll check whether the book “Calendical Calculations” 2nd edition makes use of such a formula in calculating the Hebrew date of a given day.

https://web.archive.org/web/20160904180915/http://www.cs.tau.ac.il:80/~nachum/calendar-book/index.shtml

 

 

I stated that an interval of 3383 months reduces the time of day of the molad by 1 part. To find such an interval for the time of week of the molad, one needs to add four 25920-month cycles to make the total interval a whole number of weeks. This leads to 107063 months reducing the time of week of the molad by 1 part. This is more than half the 7*25920-month cycle of the time of week of the molad and we have a shorter interval in which the time of week of the molad goes up by 1. This is 7*25920 – 107063 = 74377 months.

 

Hence an interval of 74377 months increases the time of week of the molad by 1 part.

 

Karl

 

16(12(26

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Irv Bromberg
Sent: 17 August 2017 17:38
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

From: East Carolina University Calendar discussion List [[hidden email]] on behalf of Moongazer [[hidden email]]
Sent: Wednesday, August 16, 2017 03:47

I am making an online molad calculator and in the process I was confronted
by a computational question about the Jewish calendar that I have never
encountered before.

If all the months of the calendar are numbered sequentially in an ever
increasing count, commencing with 1 for month 1 of year 1, then, given any
such month number, m, is there a formula that will obtain from m the year
number in which m occurs and the ordinal month number of m within that year?



See my explanation here:

http://individual.utoronto.ca/kalendis/hebrew/molad.htm#calc

-- Irv Bromberg, Toronto, Canada

http://www.sym454.org/hebrew/




--

Amos Shapir

 

Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Amos Shapir-2
The idea is that div and mod have the same precedence as multiplication and division, and are carried out in order of appearance.

On Mon, Aug 21, 2017 at 6:13 PM, Karl Palmen <[hidden email]> wrote:

Dear Amos and Calendar People

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Amos Shapir
Sent: 19 August 2017 09:42
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

Hi Moongazer and calendar people,

Actually, the formula is quite simple, considering there are exactly 235 months in any 19-year period

("div" is the integer division operation, without remainder; "mod" is the remainder operation; they have the precedence of division operations, i.e. carried out before addition & subtraction):


First, compute the number of whole 19-year periods:

     y1 = m div 235 * 19

KARL REPLIES:

I make that p =  m div 235.

The value y1 seems to be 19*p, the number of years in whole 19-year periods. This is not clear and only apples if div take precedence over multiplication (as well as addition & subtraction).

 

Then, add the year number inside the last period:

       m = m mod 235

       y2 = (m + 38) * 19 div 235 - 2

       y = y1 + y2

 

KARL REPLIES:

So y2 is the year of the current or least 19-year period. If div takes precedence over multiplication, the result would always be -2. So I make the correct LH argument of div to be (n + 38)*19.

Also isn’t y = ((m + 38) * 19) div 235 – 2, where m has not had mod 235 applied. If such a formula works for the first 19-year cycle, it’ll work for all 19-year cycles, because y goes up by 19 whenever m goes up by 235.

 

The month number within the year is given by

       m1 = (m + 38) - (y2+2) * 235 div 19

 

(The offsets of 38 & 2 are needed because the Jewish calendar's distribution of leap years in a 19-year cycle is not the same as it would be if both m  and y were counted from 0).

Note: If you obtain that month number by dividing a certain number of days from the epoch (first new moon) and dividing by the traditional lunar month length, you'd get the molad month; in this case, the formula approximates the year and month within it, but the actual calendar year & month may be different if the day falls near the start or end of a month.

KARL REPLIES: I decide to do my own calculation.

For the first 19-year cycle the first month of each year is when, the following number of months has elapsed

12, 24,  37, 49, 61,  74, 86,  99, 111, 123,  136, 148, 160,  173, 185,  197,  210, 222,  235.

Now I look for a linear function with gradient 19/235, which for each of these numbers, rounds down to 1, 2, 3, … but for the numbers 1 less rounds down to 1 less. This would apply if the fractional part of this linear function is less than 19/235 for these numbers. I know that 99 and 197 are critical values. One of these will have an integer value in the linear function and the other a fractional part of 18/235. Also the number of months elapsed before a leap year must have, in the linear function, a fractional part less the 7/235  (so adding 12*19/235 does not change the integer part). 197 (rather than 99) is the number of months elapsed before a leap year (17) and so it has the integer value in the linear function. Therefore,  I work it out as follows

 

m   y(unrounded)

000 00 17/235 (offset)

012 01 10/235

024 02 03/235 (start of leap year)

037 03 15/235 (leap year elapsed)

049 04 08/235

061 05 01/235 (start of leap year)

074 06 13/235 (leap year elapsed)

086 07 06/235 (start of leap year)

099 08 18/235 (leap year elapsed)

111 09 11/235

123 10 04/235 (start of leap year)

136 11 16/235 (leap year elapsed)

148 12 09/235

160 13 02/235 (start of leap year)

173 14 14/235 (leap year elapsed)

185 15 07/235

197 16        (start of leap year)

210 17 12/235 (leap year elapsed)

222 18 05/235 (start of leap year)

235 19 17/235 (leap year elapsed)

And so on every 235 months or 19 years.

 

So I make it y = floor( m*19/235 + 17/235)  for elapsed years and so = floor( m*19/235 + 17/235)  + 1 for actual years.

In Amos’s notation this becomes y = (m*19 + 17) div 235 + 1.

This is equivalent to Amos’s formula:

y =((m + 38) * 19) div 235 – 2

y =(m*19 + 722) div 235 – 2

Then we can take 3*235 = 705 out of the LH argument of the div to get

y =(m*19 + 17) div 235 + 1

 

Then I realise m refers to elapsed months. For months counted from year 1 month 1, we must subtract 1 from m (to allow it to be 1 greater). Then we get

y =(m*19 - 2) div 235 + 1

 

Only one offset is needed and as so, the formula is equivalent to

y =(m*19 + 233) div 235

 

I’m still to check what formula “Calendrical Calculations” uses.

 

 

Karl

 

16(12(29

 



--
Amos Shapir
 

Virus-free. www.avg.com
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Karl Palmen

Dear Amos, Moongazer, Irv, and Calendar People

 

Thank you Amos for your reply and making the precedence issues clear. I prefer using () and spacing for precedence and never assume left to right precedence.

 

Also I hope Amos appreciates that only one offset is needed. This is obvious to me, because I see that the unrounded function is linear. In converting from year to month number since epoch, the x offset  is -234/19 and fore the reverse it happens to be +233/19.  I think he got both his offsets from the start of year 17 of the 19-year cycle.

 

I checked “Calendrical Calculations” and find it does not use a month counting from epoch number to year conversion function when converting day to Hebrew Date.

Instead it guesses the year of a day, based on the mean year, then later corrects that guess, if necessary.

 

This lead me think about when the mean year for year 1 begins. It does not coincide with the start of year 1, because that would produce a symmetrical leap year cycle

 

(2, 5, 7, 10, 13, 15, 18).

 

I reckon the mean year 1 begins 8/19 month earlier than year 1. For each 19-cycle the mean years begin thus:

 

01  8/19 month earlier

02  1/19 month earlier

03  6/19 month later

04  6/19 month earlier

05  1/19 month later

06  8/19 month later

07  4/19 month earlier

08  3/19 month later   (earliest for leap year)

09  9/19 month earlier (earliest possible)

10  2/19 month earlier

11  5/19 month later

12  7/12 month earlier

13  same time

14  7/19 month later

15  5/19 month earlier

16  2/19 month later (latest for non-leap year)

17  9/19 month later (latest possible)

18  3/19 month earlier

19  4/19 month later

 

I notice that if these mean years were scheduled 9/19 month earlier so that the start of year 17 coincides, then it never starts later and the amount it starts earlier is equal to the fractional part rounded of the elapsed years y shown in my previous note (the actual year number is y+1 rounded down). In particular, the mean year for year 1 starts 17/19 month = 17/235 year earlier.

 

Happy New Moon

 

16(13(01

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Amos Shapir
Sent: 21 August 2017 16:51
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

The idea is that div and mod have the same precedence as multiplication and division, and are carried out in order of appearance.

 

On Mon, Aug 21, 2017 at 6:13 PM, Karl Palmen <[hidden email]> wrote:

Dear Amos and Calendar People

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Amos Shapir
Sent: 19 August 2017 09:42
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

Hi Moongazer and calendar people,

Actually, the formula is quite simple, considering there are exactly 235 months in any 19-year period

("div" is the integer division operation, without remainder; "mod" is the remainder operation; they have the precedence of division operations, i.e. carried out before addition & subtraction):


First, compute the number of whole 19-year periods:

     y1 = m div 235 * 19

KARL REPLIES:

I make that p =  m div 235.

The value y1 seems to be 19*p, the number of years in whole 19-year periods. This is not clear and only apples if div take precedence over multiplication (as well as addition & subtraction).

 

Then, add the year number inside the last period:

       m = m mod 235

       y2 = (m + 38) * 19 div 235 - 2

       y = y1 + y2

 

KARL REPLIES:

So y2 is the year of the current or least 19-year period. If div takes precedence over multiplication, the result would always be -2. So I make the correct LH argument of div to be (n + 38)*19.

Also isn’t y = ((m + 38) * 19) div 235 – 2, where m has not had mod 235 applied. If such a formula works for the first 19-year cycle, it’ll work for all 19-year cycles, because y goes up by 19 whenever m goes up by 235.

 

The month number within the year is given by

       m1 = (m + 38) - (y2+2) * 235 div 19

 

(The offsets of 38 & 2 are needed because the Jewish calendar's distribution of leap years in a 19-year cycle is not the same as it would be if both m  and y were counted from 0).

Note: If you obtain that month number by dividing a certain number of days from the epoch (first new moon) and dividing by the traditional lunar month length, you'd get the molad month; in this case, the formula approximates the year and month within it, but the actual calendar year & month may be different if the day falls near the start or end of a month.

KARL REPLIES: I decide to do my own calculation.

For the first 19-year cycle the first month of each year is when, the following number of months has elapsed

12, 24,  37, 49, 61,  74, 86,  99, 111, 123,  136, 148, 160,  173, 185,  197,  210, 222,  235.

Now I look for a linear function with gradient 19/235, which for each of these numbers, rounds down to 1, 2, 3, … but for the numbers 1 less rounds down to 1 less. This would apply if the fractional part of this linear function is less than 19/235 for these numbers. I know that 99 and 197 are critical values. One of these will have an integer value in the linear function and the other a fractional part of 18/235. Also the number of months elapsed before a leap year must have, in the linear function, a fractional part less the 7/235  (so adding 12*19/235 does not change the integer part). 197 (rather than 99) is the number of months elapsed before a leap year (17) and so it has the integer value in the linear function. Therefore,  I work it out as follows

 

m   y(unrounded)

000 00 17/235 (offset)

012 01 10/235

024 02 03/235 (start of leap year)

037 03 15/235 (leap year elapsed)

049 04 08/235

061 05 01/235 (start of leap year)

074 06 13/235 (leap year elapsed)

086 07 06/235 (start of leap year)

099 08 18/235 (leap year elapsed)

111 09 11/235

123 10 04/235 (start of leap year)

136 11 16/235 (leap year elapsed)

148 12 09/235

160 13 02/235 (start of leap year)

173 14 14/235 (leap year elapsed)

185 15 07/235

197 16        (start of leap year)

210 17 12/235 (leap year elapsed)

222 18 05/235 (start of leap year)

235 19 17/235 (leap year elapsed)

And so on every 235 months or 19 years.

 

So I make it y = floor( m*19/235 + 17/235)  for elapsed years and so = floor( m*19/235 + 17/235)  + 1 for actual years.

In Amos’s notation this becomes y = (m*19 + 17) div 235 + 1.

This is equivalent to Amos’s formula:

y =((m + 38) * 19) div 235 – 2

y =(m*19 + 722) div 235 – 2

Then we can take 3*235 = 705 out of the LH argument of the div to get

y =(m*19 + 17) div 235 + 1

 

Then I realise m refers to elapsed months. For months counted from year 1 month 1, we must subtract 1 from m (to allow it to be 1 greater). Then we get

y =(m*19 - 2) div 235 + 1

 

Only one offset is needed and as so, the formula is equivalent to

y =(m*19 + 233) div 235

 

I’m still to check what formula “Calendrical Calculations” uses.

 

 

Karl

 

16(12(29

 




--

Amos Shapir

 

 

Virus-free. www.avg.com

 

Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Moongazer
In reply to this post by Moongazer
Hello Karl, Amos, Michael, Irv, Brij and Calendar people,
 
The following program has been running for about half an hour with no error reported so far. It has passed Jewish year 160,000.
 
The include file ( "Released-Code.txt" ) is available on my Jewish Calendar website, where it is the first item in the Downloads section.  Link:  tiny.cc/jewishcalendar
 
[CODE]
 
' File: TryShapirPalmen.exe
' Written in PowerBasic 6.3
 
#COMPILE EXE
#DIM ALL
 
#INCLUDE "Released-Code.txt"
FUNCTION PBMAIN () AS LONG
   CLS
   CALL Test
   PRINT "Press a key ..." : WAITKEY$
END FUNCTION
 
SUB Test
    LOCAL Y&, M&, CurrMonth&, YearClass&, MonthsInYear&, _
          StartYear&, EndYear&, DerivedY&, DerivedMonthInYear&
    StartYear& = 1
    EndYear&   = 689472
    CurrMonth& = 0  ' continuous count of months from calendar epoch

 
    FOR Y& = StartYear& TO EndYear&
        LOCATE 1,1 : PRINT Y&
        YearClass& = FnIsLeapH&(Y&) ' --- 0 or -1 for common/leap yr
        MonthsInYear& = 12 - YearClass&
        FOR M& = 1 TO MonthsInYear&
           INCR CurrMonth&
           LOCATE 1,12 : PRINT M&
           LOCATE 1,16 : PRINT CurrMonth&
           ' From CurrMonth&, compute the year it belongs to:
           DerivedY& = (CurrMonth&*19 + 233)\235
           ' CurrMonth&'s month-nr within the year =
           ' CurrMonth& - the nr of months up to DerivedY&
           DerivedMonthInYear& = CurrMonth& - ((235*DerivedY& - 234)\19)
           LOCATE 2,1  : PRINT DerivedY&,
           LOCATE 2,12 : PRINT DerivedMonthInYear&
           IF DerivedY& <> Y& OR DerivedMonthInYear& <> M& THEN
              LOCATE 3,1 : PRINT "Error"
              BEEP : WAITKEY$
              LOCATE 3,1 : PRINT STRING$(6,32)
           END IF
        NEXT M&
    NEXT Y&
END SUB
 
[/CODE]
 
My thanks, especially, to Amos and Karl whose combined work is reflected in the code line:
DerivedY& = (CurrMonth&*19 + 233)\235
\  is BASIC's arithmetic operator for an integer division
I will report again when the program ends.
 
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Moongazer
In reply to this post by Moongazer
Success! Final program output is copied below
 
 689472     13  8527680
 689472     13
Press a key ...
 
The three numbers in line 1 are the program's loop counters for year and month-in-year, and the continuously incrementing months-from-epoch count, commencing with 1 for month 1 (Tishrei) of year 1.
 
The values shown for those items are the Jewish year 689472, which is a leap year of 13 months, the month-in-year number of its last month, Elul, and the number of that month (8527680) in the months-from-epoch count.
 
The first number in line 2 is the year (Y) that month 8527680 belongs to, as derived by the formula arrived at by Amos and Karl, which performed flawlessly throughout the entire range of years that it was tested with.
 
(Note: After Jewish year 689472, the Jewish calendar repeats itself perfectly. Years 689473, 4, 5, etc. are identical in all their properties (other than year number) to years 1, 2, 3, etc.)
 
The second number in line 2 is that month's month-in-year number, calculated by subtracting from the  months-from-epoch value for that Elul the total number of months up to the beginning of the derived year number (Y), obtained by the formula (235Y - 234)\19, where \ is an integer division in which the fractional portion of the quotient is stripped away leaving only the integer portion.

I am satisfied that the formula works correctly and that, within the range of years it was tested with, all the values produced were within the value range of the long integer data type.
 
Cheers, and a happy and sweet new year for next new moon.
 
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Amos Shapir-2
Hi Moongazer and calendar people,

There's no point in calculating the Jewish calendar to such a long term.  The average Jewish year length ( = Jewish month * 235 / 19) is longer than the average tropical year, by about 1 day in 220 years (*); this difference means that the Jewish calendar will make a full circle through the seasons every about 78000 years.  Because the calendar is also connected to the seasons (e.g. Passover should always fall in the spring), it would have to be reformed before the accumulated difference approaches one month, i.e. in about 5000 years (it's currently 5-6 days off).

(*) That depends on which type of tropical year is used; the average also changes due to the slowing of the Earth's rotation (see Irv Bromberg's site for details).

Virus-free. www.avg.com

On Thu, Aug 24, 2017 at 8:41 AM, Moongazer <[hidden email]> wrote:
Success! Final program output is copied below
 
 689472     13  8527680
 689472     13
Press a key ...
 
The three numbers in line 1 are the program's loop counters for year and month-in-year, and the continuously incrementing months-from-epoch count, commencing with 1 for month 1 (Tishrei) of year 1.
 
The values shown for those items are the Jewish year 689472, which is a leap year of 13 months, the month-in-year number of its last month, Elul, and the number of that month (8527680) in the months-from-epoch count.
 
The first number in line 2 is the year (Y) that month 8527680 belongs to, as derived by the formula arrived at by Amos and Karl, which performed flawlessly throughout the entire range of years that it was tested with.
 
(Note: After Jewish year 689472, the Jewish calendar repeats itself perfectly. Years 689473, 4, 5, etc. are identical in all their properties (other than year number) to years 1, 2, 3, etc.)
 
The second number in line 2 is that month's month-in-year number, calculated by subtracting from the  months-from-epoch value for that Elul the total number of months up to the beginning of the derived year number (Y), obtained by the formula (235Y - 234)\19, where \ is an integer division in which the fractional portion of the quotient is stripped away leaving only the integer portion.

I am satisfied that the formula works correctly and that, within the range of years it was tested with, all the values produced were within the value range of the long integer data type.
 
Cheers, and a happy and sweet new year for next new moon.
 



--
Amos Shapir
 
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Moongazer
Hi Amos and calendar people,
 
Of course Amos, you are absolutely right about the current calendar's too long year-length and the long term consequences of it. But that is precisely why I extend the range of my calendar programs to the full length (689472 years) of its repetition cycle, to illustrate the eventual need for reform by allowing people to explore  those long term effects and actually see, visually, Passover cycling through the seasons, and the Tekufot Shmuel doing the same but even faster, and how, eventually, Birkat Hachama will jump from Jewish years of the form 28n+1 to 28n+2, and so on.
 
It may not be that obvious to the eye in the molad calculator I am currently working on, but it was glaringly obvious in my old 16-bit Luchot program (which may eventually be converted to a 32-bit Windows program). It shows two month-grids side-by-side for the civil and Jewish calendars. (The civil one can be switched between Julian and Gregorian, and the Jewish one between Israel and diaspora). In each configuration, there are several navigation intervals that the user can go forward or backward by, and by judicious selection of the calendar type, start date and interval, you can see all these changes happening before your eyes most dramatically.
 
Moongazer
 
Hi Moongazer and calendar people,
 
There's no point in calculating the Jewish calendar to such a long term.  The average Jewish year length ( = Jewish month * 235 / 19) is longer than the average tropical year, by about 1 day in 220 years (*); this difference means that the Jewish calendar will make a full circle through the seasons every about 78000 years.  Because the calendar is also connected to the seasons (e.g. Passover should always fall in the spring), it would have to be reformed before the accumulated difference approaches one month, i.e. in about 5000 years (it's currently 5-6 days off).
 
(*) That depends on which type of tropical year is used; the average also changes due to the slowing of the Earth's rotation (see Irv Bromberg's site for details).
 
Amos Shapir
 
Reply | Threaded
Open this post in threaded view
|

Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

Karl Palmen
In reply to this post by Amos Shapir-2

Dear Moongazer, Amos, Irv and Calendar People

 

In a reformed Hebrew Calendar (in which the 19-year cycle is occasionally corrected by skipping an Octaeteris of 8 years 3 leap, to form the 334-year cycle mentioned by Remy Landau, the 353-year cycle suggested by Irv or something else providing an accurate mean year), the 247-year repetition would still  often occur, because only one in 19 start years would be affected by each skipped Octaeteris spanned. However, any interval that forms an accurate lunisolar cycle of a whole number of weeks and is not too long, would form such an interval, especially if its mean month is close to that of the reformed Hebrew Calendar.

 

One possible example is 1431 years of 17699 months, which with the current molad interval would shift the molad 373 parts earlier in a week. For a more shorter molad interval, the 100 Saros 1803-year cycle of 22300 months could be a good repetition interval.

 

The Birkhat Hachama would sometimes need to be held after an interval of 12 or 40 years instead of 28. These intervals of 12 or 40 years correspond to the dropped leap years in the Gregorian calendar or any similar such as the Revised Julian Calendar.

 

Karl

 

16(13(04

 

 

From: East Carolina University Calendar discussion List [mailto:[hidden email]] On Behalf Of Amos Shapir
Sent: 24 August 2017 08:19
To: [hidden email]
Subject: Re: [SUSPICIOUS MESSAGE] Jewish calendar computational formula wanted

 

Hi Moongazer and calendar people,

There's no point in calculating the Jewish calendar to such a long term.  The average Jewish year length ( = Jewish month * 235 / 19) is longer than the average tropical year, by about 1 day in 220 years (*); this difference means that the Jewish calendar will make a full circle through the seasons every about 78000 years.  Because the calendar is also connected to the seasons (e.g. Passover should always fall in the spring), it would have to be reformed before the accumulated difference approaches one month, i.e. in about 5000 years (it's currently 5-6 days off).

(*) That depends on which type of tropical year is used; the average also changes due to the slowing of the Earth's rotation (see Irv Bromberg's site for details).

 

Virus-free. www.avg.com

 

On Thu, Aug 24, 2017 at 8:41 AM, Moongazer <[hidden email]> wrote:

Success! Final program output is copied below

 

 689472     13  8527680
 689472     13
Press a key ...

 

The three numbers in line 1 are the program's loop counters for year and month-in-year, and the continuously incrementing months-from-epoch count, commencing with 1 for month 1 (Tishrei) of year 1.

 

The values shown for those items are the Jewish year 689472, which is a leap year of 13 months, the month-in-year number of its last month, Elul, and the number of that month (8527680) in the months-from-epoch count.

 

The first number in line 2 is the year (Y) that month 8527680 belongs to, as derived by the formula arrived at by Amos and Karl, which performed flawlessly throughout the entire range of years that it was tested with.

 

(Note: After Jewish year 689472, the Jewish calendar repeats itself perfectly. Years 689473, 4, 5, etc. are identical in all their properties (other than year number) to years 1, 2, 3, etc.)

 

The second number in line 2 is that month's month-in-year number, calculated by subtracting from the  months-from-epoch value for that Elul the total number of months up to the beginning of the derived year number (Y), obtained by the formula (235Y - 234)\19, where \ is an integer division in which the fractional portion of the quotient is stripped away leaving only the integer portion.


I am satisfied that the formula works correctly and that, within the range of years it was tested with, all the values produced were within the value range of the long integer data type.

 

Cheers, and a happy and sweet new year for next new moon.
 




--

Amos Shapir