Post Reply 
(12C) Full Moon
01-22-2018, 06:30 AM (This post was last modified: 01-22-2018 03:38 PM by Gamo.)
Post: #1
(12C) Full Moon
This program compute the next date of full moon.
Date format used D,MY (Day Month Year)
Input any date range from 15 January 1900 through 25 November 4046

Example: "Make sure to set date format to g > D.MY"

Today Date is 22.012018 press R/S
Result is 31.01 next full moon is on January 31st

To see full date digits: Press 0 > g > DATE

Result in full is 31,01,2018 [3]
31 January 2018 on Wednesday

1=Monday
2=Tuesday
3=Wednesday to 7=Sunday


Remark: Some month will be late or early by ± one day.

Code:

15,011900
ΔDYS
CHS
LSTx
X<>Y
147653
ENTER
5
EEX
3
÷
÷
LSTx
X<>Y
INTG
1
+
x
,5
+
INTG
DATE
GTO 00

Gamo
Find all posts by this user
Quote this message in a reply
01-22-2018, 11:31 AM
Post: #2
RE: (12C) Full Moon
(01-22-2018 06:30 AM)Gamo Wrote:  This program compute the date of full moon start from 15/01/1900
Date format used D,MY (Day Month Year)
Input any date range from 15 January 1900 through 25 November 4046
Nice. How would the program be for the HP 35s calculator?
Pedro
Find all posts by this user
Quote this message in a reply
01-22-2018, 01:27 PM (This post was last modified: 01-24-2018 08:16 AM by Dieter.)
Post: #3
RE: (12C) Full Moon
(01-22-2018 11:31 AM)PedroLeiva Wrote:  Nice. How would the program be for the HP 35s calculator?

The 35s does not have date functions (ΔDAYS, DATE+). So the major part of such a program would consist of two routines that convert a Gregorian date to a Julian day number and vice versa. I have posted such a program in the General Software Library. The rest can be directly translated from the 12C program.

So enter the linked program and then add this routine:

Code:
M001 LBL M
M002 XEQ J001  // calculate JDN of input
M003 2415035   // JDN of 15 Jan 1900
M004 -         // days since 15 Jan 1900
M005 29,5306   // shorter for 147653/5000
M006 INT÷      // number of complete moon cycles
M007 LastX
M008 x         // number of days of these cylces
M009 LastX
M010 +         // add one more cycle to get next full moon
M011 2415035,5 // add this number of days to 15 Jan 1900
M012 +         // + 0,5 days for rounding to closest date
M013 IP
M014 GTO J001  // and convert back to Gregorian date

You may also try this version:

Code:
M001 LBL M
M002 XEQ J001  // calculate JDN of input
M003 ENTER     // and save it on the stack
M004 ENTER
M005 2415035   // JDN of 15 Jan 1900
M006 -
M007 29,5306   // shorter for 147653/5000
M008 RMDR
M009 LastX
M010 X<>Y
M011 -
M012 +         // add to JDN of input date
M013 0,5
M014 +         // round new JDN to full days
M015 IP
M016 GTO J001  // and convert back to Gregorian date

These routines should do the same calculation as the 12C program, but please do your own tests. ;-)
For the given example it should return this:

Code:
22,012018 [XEQ] M [ENTER]

=> 3
   31,012018

Does this work?

Edit: at least for UTC the dates may be one day early here and there. Run the program a second time with the calculated date. If the output is the same as the input the full moon seems to be on the next day. Try 1,012018 and get 1,012018 again. Actually the full moon was on 2,012018 (but less than an hour past midnight UTC).

For local time on the North and South American continent the error seems to be more evenly distributed. For UTC maybe line M011 in the first program should better be 2415036 (and line M013 in the second version changed to 1, respectively). But I haven't made any extensive tests.

Dieter
Find all posts by this user
Quote this message in a reply
01-24-2018, 12:10 AM
Post: #4
RE: (12C) Full Moon
(01-22-2018 01:27 PM)Dieter Wrote:  
(01-22-2018 11:31 AM)PedroLeiva Wrote:  Nice. How would the program be for the HP 35s calculator?

The 35s does not have date functions (ΔDAYS, DATE+). So the major part of such a program would consist of two routines that convert a Gregorian date to a Julian day number and vice versa. I have posted such a program in the General Software Library. The rest can be directly translated from the 12C program.
Hi Dieter:

I got same results. Two comments: a) first time flag 0 was active and I got X=4,00 and Y= 16,022018. Then I cancel flag 0 and the results were as yours; b) to show year the display has to be on FIX6.

With both LBL M routings I got same results In first case you doble step 10, so the total steps number are 16, not 15.

Pedro
Find all posts by this user
Quote this message in a reply
01-24-2018, 08:15 AM (This post was last modified: 01-24-2018 08:23 AM by Dieter.)
Post: #5
RE: (12C) Full Moon
(01-24-2018 12:10 AM)PedroLeiva Wrote:  I got same results. Two comments: a) first time flag 0 was active and I got X=4,00 and Y= 16,022018. Then I cancel flag 0 and the results were as yours;

Sure. If flag 0 is set the linked J program assumes a proleptic Julian calender. ;-)

(01-24-2018 12:10 AM)PedroLeiva Wrote:  b) to show year the display has to be on FIX6.

It should be, yes. This also applies to other date programs using the mm.ddyyyy format.

(01-24-2018 12:10 AM)PedroLeiva Wrote:  With both LBL M routings I got same results In first case you doble step 10, so the total steps number are 16, not 15.

Yes, step M010 appeared twice. I now have corrected this.

Dieter
Find all posts by this user
Quote this message in a reply
01-24-2018, 08:25 AM
Post: #6
RE: (12C) Full Moon
(01-22-2018 06:30 AM)Gamo Wrote:  Example: "Make sure to set date format to g > D.MY"

Hint: if you replace 15,011900 with 10,101897 the program will work in either date mode. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
01-25-2018, 01:23 AM
Post: #7
RE: (12C) Full Moon
Thanks Dieter
Now work on both DATE format.

Gamo
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)