Moon algorithms

Hello everybody,

Are there any astronomers here?

I am looking for algorithms to determine the position of the moon for gardening: zodiacal position, apogee, perigee, rising phase, descending phase.

Do you know a place where I can find these calculation methods?

Thanks

You could try this site: https://www.mooncalc.org.
It has an API.

Thank you @Torsten_Bernhard

I don’t see zodiac position of the moon. It could be a solution to test some part of my future code results. I’m not looking for an API.

Have)-you checked @ wikipedia ?

Example of data found at the above URL:

When I’m not in front of my computer I garden. What effect does the moon have on gardening???

People (oldsters, when I was young) says there are times (regarded from Moon phases) to do things (seed the earth ? Move young tomatoes from “nursery” to the garden…).

But I forgot what / when, etc.

Some believe on moon influence for gardening: https://gardeningbythemoon.com
It’s a also a organization method for gardening plan

1 Like

There are books to know about that; I have a friend (80y/o) who knows about that too.

1 Like

Wikipedia don’t give any code ^^

2 Likes

If you move the Mouse Cursor above a word (two words) like Orbital Excentricity, you will get a popup window with explanations and a click in the gear will go to the page.

Of course, no Xojo code (probably) nor neutral algorithm (and I cannot help here as I never learn that).

Screen shot for Orbital Excentricity:

still no code !

1 Like

Want a project instead ? :wink:

1 Like

here are free codes for astronomical calculus (in C but easily transposable to basic)
http://www.naughter.com/aa.html
and the C files
http://www.naughter.com/download/aaplus.zip

1 Like

It’s look complex but I don’t see any zodiac position in this code

Yes I’m a stargazer and a long time ago used to compute precise ephemerides for my club, for sun, moon, planets and eclipses down to 1 arc second and 1 second in time. Unfortunately, the moons orbit isn’t as simple as your first post suggests, because all the orbital elements change - significantly - with time.

The book you want is “Astronomical Formulae for Calculators” by Jan Meeus. This presents the maths and you’ll have to write the code from that, NB I wrote most of that books maths in RPN for HP41CX.

Most important of all, Meeus provides worked examples for each section - and your code must produce results that agree to the last decimal place - otherwise you have an error somewhere.

A lot of astro apps are unfortunately written by people who don’t know how to verify the results.

One source you could use to check results is the NASA/JPL ephemeris at Orbits & Ephemerides.

Lastly the app that almost every serious stargazer uses is SkySafari, for MacOS, iOS and Android. It’s not cheap, but it is very mature. This also provides the data you seek, and you could use it to verify your results.

There are code libraries in C and other languages, but you will need to translate them to Xojo, and be able to verify the results carefully against the resources above.

Blindly translating from another language to Xojo and hoping it works is unlikely to succeed - you MUST verify the results.

The ultimate test, of course, is to pull out a telescope, look up, and measure where things are, and when.

1 Like

the C files on my post above are using the calculus methods described in this book.

Here is some Xojo code for the phase of the moon:

Public Function MoonPhase(dt As Date) as Double
  'Returns phase of moon as a decimal value between 0 and 1
  'Zero indicates new moon
  'Calculation is based on offset from benchmark new moon, 1/6/2000 12:24:01.
  'This is the phase at 00:00:00 UTC on the given date, unless a time of day is specified.
  'Converting to local time may shift the date by +/- 1 day.
  '0.00: new moon
  '0.25: first quarter
  '0.50: full moon
  '0.75: 3rd quarter
  
  dim y,m,d,a,b,c,e,f As Integer
  dim h,jd,dn,nm,pm As Double
  y = dt.Year
  m = dt.Month
  d = dt.Day
  h = (((dt.Hour*60)+dt.Minute)*60+dt.Second)/86400 'fractional day
  a = y\100
  b = a\4
  c = 2-a+b
  e = 365.25*(y+4716)
  f = 30.6001*(M+1)
  jd = c+d+e+f+h-1524.5
  dn = jd-2451549.5
  nm = dn/29.53
  pm = nm-(nm\1)
  Return pm
End Function
1 Like

I could recommend Astronomical Algorithms by Meeus, or Celestial calculations by Lawrence, but the best source I’ve found is a Paul Schlyter of Stockholm Sweden. I have very old printouts of some of his work. It may not still exist. Here are some urls you can try. welcome.to /pausch. hotel04.ausys.se/pausch. stjarnhimlen.se.
There are a couple of good astro guides for calculators that are pretty good. Good Luck.
Kenny

Hello @Kenneth_Fisher

I’m sorry but the urls you send are not correct :smiling_face_with_tear: