HP Prime Forum

Full Version: computing apogee and perigee of the moon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.


calendar date Dec 4, 2013

UTC time 10 hr 18 min 49.536 sec

geocentric distance = 360063.394098 km


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.
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.
Reference URL's