iconEuler Reference

Astronomical Functions

Load with "load astro", help with "help astro.e". See also the example notebook for this package.

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, sec=0)
  Days since J2000.0
  
  Assumes 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, sec=0)
  Julian day number
  
  Assumes 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 jdaynow ()
  Current Julian day number assuming the Gregorian calendar
function gst (day)
  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)
  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)
  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
  Apparent geocentric longitude, latitude and distance of the Moon
  
  Corrected for nutation using a low precision nutation theory
function moontable (position, day1, day2, inc)
  Table of positions of the moon
  
  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)
  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)
  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)
  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)
  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)
  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)
  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)
  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)
  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)
  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)
  Apparent equatorial coordinates
  
  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)
  Mean obliquity of ecliptic
  
  given:   TD Instant as days since J2000.0 in 'day'
function raltaz (day, station, equatorial)
  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)
  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)
  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)
  Spherical coordinates of object in vector
  
  given: vector with cartesian coordinates of object
  note: returns decimal degrees for angles
function sun (day)
  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 meanequ (day, ecliptic)
  TD instant in day and 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)
  Geometric equatorial coordinates of Mercury
  
  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)
  Geometric equatorial coordinates of Jupiter
  
  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)
  Geometric equatorial coordinates of Venus
  
  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)
  Geometric equatorial coordinates of Mars
  
  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)
  Astrometric equatorial coordinates of Mars
  
  given: the TD instant in day
  returns: the astrometric equatorial coordinates of Mars
  note: corrected for light travel time and aberration
function venus (day)
  Apparent equatorial coordinates of Venus
  
  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)
  Apparent equatorial coordinates of Mercury
  
  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)
  Apparent equatorial coordinates of Jupiter
  
  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)
  Apparent equatorial coordinates of Mars
  
  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)
  Apparent equatorial coordinates of Saturn
  
  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)
  Apparent equatorial coordinates of planet
  
  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)
  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
locBrum:=[-1.91667, 52.5, 120];
locSettel:=[-2 + 18/60, 54 + 5/60, 200];
locReekie:=[-3 + 12/60, 55 + 57/60, 50];
locIngolstadt:=[11.433,48.767,400];
function tmoon (day, station)
  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)
  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)
  String with hours, minutes and seconds of day hours
  
  >hmsprint(12.5)
function altitude (now, planet, loc)
  Altitude of the planet at now and loc.
  
  >altitude("sun",day(2008,1,2),here)
function rise (planet, now, loc)
  Next rise of planet after now at loc.
function set (planet, now, loc)
  Next set of planet after now at loc.
function highest (planet, now, loc)
  Next highest position of planet after now at loc.
function lowest (planet, now, loc)
  Next lowest position of planet after now at loc.
function helpprintday1 (y,t)


function helpprintday2 (m,y,t)


function printday (t)
  a string based on the date
function getymdhms (t)
  vector [y,m,d,h,mi,sec] for a time date

Documentation Homepage