Astronomical functions taken from Jean Meeus - 'Astronomical Algorithms' Montenbruck and Pfleger - 'Astronomy on the Personal Computer' Duffett-Smith - 'Practical astronomy with your calculator' and other sources.
Written by Keith Burnett.
function ddegrees (d, m, s) converts degrees minutes and seconds to decimal degrees
function dsin (x) returns sine of x degrees
function dcos (x) returns cosine of x degrees
function dtan (x) returns tangent of x degrees
function dasin(x) returns angle in degrees corresponding to x
function dacos(x) returns angle in degrees corresponding to x
function datan(x) returns angle in degrees corresponding to x
function datan2(y, x) returns the angle in degrees within the correct quadrant given the coordinates y, x on the unit circle
function overwrite day (y0, m0, d, h=0, min=0) returns the days since J2000.0 number assuming the Gregorian calendar after 1582 Oct 4th given the year, month, day, hour and minute This method is modified from Duffett-Smith Calculator page 7 Negative years CE are numbered according to the astronomical convention - i.e. calendrical year 1 BC is year zero in this function
function jday (y0, m0, d, h=0, min=0) returns the julian day number assuming the Gregorian calendar after 1582 Oct 4th given the year, month, day, hour and minute This method is taken from Duffett-Smith Calculator page 7
function gst (day) returns the greenwich siderial time corresponding to the number of days before J2000.0 (Meeus Ch 11). Answer is given in degrees (360 = siderial day)
function gmoon (day) returns the mean geocentric longitude, latitude and distance of the Moon given the instant in days since J2000.0 based on the truncated ELP-2000/82 theory in Meeus' book C45 - claimed good to 10 arcsec in longitude, 4 arcsec in latitude.
function nutation(day) returns the values of delta-phi and delta-epsilon in degrees for UT instant. See Meeus Ch21 - good to 0.5 arcsec in phi and 0.1 arcsec in epsilon Returns a vector with entries [dphi, deps, 0] for compatibility
function amoon(day) returns the apparent geocentric longitude, latitude and distance of the Moon corrected for nutation using a low precision nutation theory
function table (position, day1, day2, inc) builds a table of positions given the position function name, a starting UT instant, a stopping UT instant and a time increment. Each row of the table is a position.
function hearth(day) returns the heliocentric ecliptic latitude of the Earth given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC
function hvenus(day) returns the heliocentric ecliptic latitude of Venus given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC
function zzterm(a, t) calculates the value of a periodic term in the VSOP82 analytical theory for the position of the planets - called by the planet position functions
function hjupiter(day) returns the heliocentric ecliptic latitude of Jupiter given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC Accuracy of order 4 arcsec in longitude
function hmars(day) returns the heliocentric ecliptic latitude of Mars given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC More terms than Meeus included as an experiment
function hmercury(day) returns the heliocentric ecliptic latitude of Mercury given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC More terms than Meeus included as an experiment
function hsaturn(day) returns the heliocentric ecliptic latitude of Saturn given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC More terms than Meeus included as an experiment
function huranus(day) returns the heliocentric ecliptic latitude of Uranus given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC More terms than Meeus included as an experiment
function hneptune(day) returns the heliocentric ecliptic latitude of Neptune given the UT instant. Mean coordinates referred to equinox of date vector returned gives [lambda, beta, delta (au) ] See chapter 31 of Meeus for method - coefficients from NASA ADC More terms than Meeus included as an experiment
function moon(day) returns apparent geocentric equatorial coordinates of Moon given the UT instant day.
function equatorial(day, ecliptic, e) given: the UT instant in day, a vector containing the ecliptic coordinates and the obliquity of the ecliptic in e. The geocentric distance r is 'passed through'. returns: the equatorial coordinates as ra (degrees) and dec and r. note: obliquity argument allows choice of apparent, mean or J2000.0 equator. Function obiquity(day) returns the mean obliquity, add nutation[2] for apparent.
function apparent(day, ecliptic) given: the UT instant in day and a vector containing the mean ecliptic coordinates. returns: the apparent equatorial coordinates as ra (degrees) dec and r in a.u. referred to the equinox and true ecliptic of date
function obliquity (day) returns: mean obliquity of ecliptic given: TD Instant as days since J2000.0 in 'day'
function raltaz (day, station, equatorial) returns: altitude and azimuth of object given: 'day' - TD instant 'station' - vector containing geographical longitude, latitude height and air temperature and pressure of observer. (west, south negative, decimal degrees, metres asl, degrees C and millibars) note: for the Moon, use topocentric equatorial coords from tmoon - for other objects use 'apparent' coordinates refraction correction applied as in Meeus ch 15, p102 function altaz has no refraction correction
function altaz (day, station, equatorial) returns: altitude and azimuth of object given: 'day' - TD instant 'station' - vector containing geographical longitude, latitude height and air temperature and pressure of observer. (west, south negative, decimal degrees, metres asl, degrees C and millibars) 'equatorial' - vector of equatorial coordinates of object note: for the Moon, use topocentric equatorial coords from tmoon - for other objects use 'apparent' coordinates This function does NOT correct for refraction - see raltaz
function cart(sph) returns: cartesian coordinates of object in vector given: vector with [ra/long, dec/lat, r] of object note: assumes decimal degrees for angles
function sph(cart) returns: spherical coordinates of object in vector given: vector with cartesian coordinates of object note: returns decimal degrees for angles
function sun (day) returns: apparent equatorial coordinates of the Sun (geocentric) given: TD instant in day note: coordinates returned as vector [ra (degs), dec, r (au)] based on Meeus truncation of VSOP87 - he claims 1"
function overwrite mean (day, ecliptic) given: the TD instant in day and a vector containing the mean ecliptic geocentric coordinates. returns: the mean equatorial coordinates as ra (degrees) dec and r in a.u. referred to the equinox and mean ecliptic of date note: no nutation or aberration correction at all
function gmer(day) given: the TD instant in day returns: the geometric equatorial coordinates of Mercury note: no correction for light travel time, abberation or nutation
function gjup(day) given: the TD instant in day returns: the geometric equatorial coordinates of Jupiter note: no correction for light travel time, abberation or nutation
function gven(day) given: the TD instant in day returns: the geometric equatorial coordinates of Venus note: no correction for light travel time, abberation or nutation
function gmar(day) given: the TD instant in day returns: the geometric equatorial coordinates of Mars note: no correction for light travel time, abberation or nutation
function amar(day) given: the TD instant in day returns: the astrometric equatorial coordinates of Mars note: corrected for light travel time and aberration
function venus(day) given: the TD instant in day returns: the apparent equatorial coordinates of Venus note: corrected for light travel time, aberration and nutation
function mercury(day) given: the TD instant in day returns: the apparent equatorial coordinates of Mercury note: corrected for light travel time, aberration and nutation
function jupiter(day) given: the TD instant in day returns: the apparent equatorial coordinates of Jupiter note: corrected for light travel time, aberration and nutation
function mars(day) given: the TD instant in day returns: the apparent equatorial coordinates of Mars note: corrected for light travel time, aberration and nutation
function saturn(day) given: the TD instant in day returns: the apparent equatorial coordinates of Saturn note: corrected for light travel time, aberration and nutation
function zzaplanet(planet, day) given: the TD instant in day and heliocentric coordinate function in string 'planet' returns: the apparent equatorial coordinates of planet note: corrected for light travel time, aberration and nutation this function is not normally used interactively
function topocentric(day, station, pos) returns: topocentric equatorial coordinates of body given: function 'pos' to obtain apparent coords of body TD instant in 'day' station - lat, long, height, temp, pressure of observing location
function tmoon(day, station) returns: topocentric equatorial coordinates of Moon given: TD instant in 'day' 'station' - vector lat, long, height (m), temp (C), and pressure (mB) of observing location
function librate(day) returns: selenographic longitude and latitude of the sub earth point position angle of the Moon's rotation axis given: TD instant in days since J2000.0 note: Geocentric librations as in Meeus Ch 51
function hmsprint (x) returns: string with hours, minutes and seconds of day hours x example: hmsprint(12.5)
function altitude (now, planet, loc) returns: altitude of the planet at now and loc. example: altitude("sun",day(2008,1,2),here)
function rise (planet, now, loc) returns: next rise of planet after now at loc.
function set (planet, now, loc) returns: next set of planet after now at loc.
function highest (planet, now, loc) returns: next highest position of planet after now at loc.
function lowest (planet, now, loc) returns: next lowest position of planet after now at loc.
function intbisect (f,a0,b0) Integer bisection
function helpprintday1 (y,t)
function helpprintday2 (m,y,t)
function printday (t) returns: a string based on the date
function getymdhms (t) returns: vector [y,m,d,h,mi,sec] for a time date