Way back in the dark ages (1985 or so) there was a book title Astronomy With Your Personal Computer by Peter Duffett-Smith. This book provided BASIC routines for various astonomical calculations: date/time conversions, planetary location, eclipse information, etc. Some of the calculations would be handy for some mobile apps I'm working on, so I decided to look into converting the code to C#.
Just looking at a few lines of the sample programs in the book, it becomes quickly obvious that simply converting the code line-by-line is not a good idea - if nothing else, the precision of the calculations is suspect, and many of the old BASIC commands are just inefficient. Plus, I'm not trying to infringe on any copyrights here!
So, my goal here will be to simply duplicate the purpose of each of the major subroutines in the book in C#. I've listed them below, and as future blog posts are written I'll come back and add the appropriate link.
Subroutine |
Description |
DEFAULT |
default value input routine
No need to convert this one... |
YESNO |
'Y' or 'N' input routine
Yeah, skip this one too... |
MINSEC |
converts between decimal hours/degrees and minutes/seconds form |
JULDAY |
calendar date to Julian day number since 1900 January 0.5 |
CALDAY |
Julian day number since 1900 January 0.5 to calendar date |
TIME |
converts between local civil and sidereal times |
EQHOR |
converts between equatorial and horizon coordinates |
HRANG |
converts between right ascension and hour angle |
OBLIQ |
calculates the value of the obliquity of the ecliptic |
NUTAT |
finds corrections for natation in longitude and obliquity |
EQECL |
converts between equatorial and ecliptic coordinates |
EQGAL |
converts between equatorial and galactic coordinates |
GENCON |
converts between any of the coordinate systems
Gotta love that subroutine name! |
PRCESS1 |
approximate precession of equatorial coordinates |
PRCESS2 |
rigorous precession of equatorial coordinates |
PARALLX |
converts between geocentric and apparent position |
REFRACT |
calculates the effect of atmospheric refraction |
RISET |
finds the circumstances of rising and setting |
ANOMALY |
solves Kepler's equation for elliptical motion |
SUN |
finds the ecliptic coordinates of the Sun |
SUNRS |
finds the circumstances of sunrise and sunset |
PELMENT |
returns the orbital elements of the major planets |
PLANS |
finds the position of a planet |
MOON |
finds the position and parallax of the Moon |
MOONRS |
finds the circumstances of moonrise and moonset |
MOONNF |
finds the times of new and full moon |
ECLIPSE |
finds the circumstances of lunar and solar eclipses |
DISPLAY |
displays an eclipse in graphical form |
ELOSC |
finds positions from osculating elliptical elements |
RELEM |
converts elliptic orbital elements from one epoch to another |
PCOMET |
finds the position of a comet from parabolic elements |
PFIT |
finds parabolic elements from observations |
EFIT |
finds elliptical elements from observations |
Technorati Tags: Astronomy