HP Prime Forum
computing apogee and perigee of the moon - Printable Version

+- HP Prime Forum (http://forum.hp-prime.de)
+-- Forum: HP Prime (/forumdisplay.php?fid=1)
+--- Forum: Software (/forumdisplay.php?fid=4)
+--- Thread: computing apogee and perigee of the moon (/showthread.php?tid=85)



computing apogee and perigee of the moon - cdeaglejr - 15-03-2016 12:16 PM

This HP Prime program demonstrates an application of Brent's extrema function posted earlier in this forum. This example calculates the calendar date and UTC of the closest (perigee) and farthest (apogee) points of the moon in its orbit around the earth. The user provides a calendar month and year for the calculations. The search interval is "hard-wired" from day 1 to day 30 of the month.

Here are the results for this example. The geocentric distance is the location of the center of the moon relative to the earth center at the time of the celestial event.

PERIGEE OF THE MOON

calendar date Dec 4, 2013

UTC time 10 hr 18 min 49.536 sec

geocentric distance = 360063.394098 km

APOGEE OF THE MOON

calendar date Dec 19, 2013

UTC time 23 hr 42 min 14.688 sec

geocentric distance = 406253.383003 km

This application uses special versions of two algorithms. For this example, the minima routine is named minima_apmoon and the objective function has the name apmoon_func.


RE: computing apogee and perigee of the moon - cdeaglejr - 23-03-2016 08:41 PM

Updated for the physical calculator. The main program and all support routines are in one single file so that the main program can use global variables.