HP Forums
Creating a Chebyshev ephemeris of the moon - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Creating a Chebyshev ephemeris of the moon (/thread-18973.html)



Creating a Chebyshev ephemeris of the moon - cdeaglejr - 10-17-2022 02:03 PM

This HP Prime program can be used to create a Chebyshev representation of the geocentric position vector of the moon. The first part of the software demonstrates how to create the coefficients and the second part illustrates how to evaluate the coefficients and produce a lunar position vector.

The "fit" or degree of the representation is defined in the software with the following

// define order of "fit" or approximation

EXPORT nfit := 21;

For the moon and planets nfit = 18-21 is usually adequate.

The initial date and length of the approximation is defined in the software with

// define initial utc calendar date of the Chebyshev ephemeris

month := 10;

day := 21;

year := 2022;

For the complicated motion of the moon, a fit interval of 10-30 days is recommended.

// create 30 day Chebyshev ephemeris

deltat := 30.0;

Once the coefficients have been created, they can be evaluated for any time within the fit interval with the following source code

// select a valid tdt julian day within the span
// of the chebyshev ephemeris

delta_days := 10.56788;

jdtdt := jdtdt1 + delta_days;

x := (jdtdt - 2451545.0) / 36525.0;

// evaluate Chebyshev ephemeris at user-defined x

rmoon_cheby(1) := cheby_eval(ta, tb, nfit, rx_poly, x);

rmoon_cheby(2) := cheby_eval(ta, tb, nfit, ry_poly, x);

rmoon_cheby(3) := cheby_eval(ta, tb, nfit, rz_poly, x);

The coefficients need only be created once. They can then be used to compute the position of the moon repeatedly. This is useful because the Chebyshev approach is faster than evaluating an analytic algorithm for the moon's position.

The final part of the software displays the differences between the Chebyshev and analytic ephemeris for a single time within the approximation interval.