Press "Enter" to skip to content

Little useless-useful R function – Full moon finder

[This article was first published on R – TomazTsql, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)


Want to share your content on R-bloggers? click here if you have a blog, or here if you don’t.

Another one from the series [1,2,3,4] of useless functions. This one is particularly useful when you have overcast weather. And you are feeling moody, feel slightly off-balance and that causes you behaving erratically.

The full moon function, or should we call it fool moon – due to it’s simplistic and approximate nature, calculates the the difference between the date (only date, no time, no long/lat coordinates) and Julian constant. Should you be using a different calendar, don’t run the function, just look out the window.

The function is written based on generalized equation for julian day numbers and months. Another one could be to calculate RMSE of the predicted values and realization of lunar behavior (lunatic start time). In this case – reversed engineering – you would use the the approximate date/time for the first new moon after that date if the synod period was constant. This number than obtained is only empirically proven by recursively solving for the new “possible date/time” of lunar behavior and calculate the prediction error. In order to minimize the RMSE value of the difference between the full moon dates/times predicted formula and the dates/times for the full moon over the next 10 years you get something like this.

And the formula is pretty useless as well (using epoch Unix time format and the sine function. But this is not wacky enough (with help of WolframAlpha):

nn 

Final version of R function is:

IsItFullMoon is getting full, else empty, based on Hijri (Kuwait) Calendar da = 14.50 & dec*cycle 

As of writing this blog post, the function returns:

and I think, I will just to that – go to sleep. As always, the wacky version of R code is available at Github.

Happy R-ing!!!

Be First to Comment

Leave a Reply

Your email address will not be published.