# NavList:

## A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

**Re: making your own almanac**

**From:**Dan Allen

**Date:**2007 Jan 8, 11:50 -0700

On 8 Jan 2007, at 4:02 AM, Joel wrote: > Can anyone on the list direct me to some (simple?) sources that would > describe how one would go about making his or her own almanac. I > just > finished reading a fictional biography of Nathaniel Bowditch called > "carry on Mr Bowditch" that was written for young adults in the > 1950's. > The author has the 14 year old Bowditch "writing his own almanac" . > Whether or not this actually happened, I am curious as to how one > would > approach this task. The answer to this question would take hundreds of pages to really explain well. Such a book is called "Explanatory Supplement to the Nautical Almanac and Astronomical Ephemeris" and is published by the US and UK Naval Observatories. Plan on lots of mathematics. For a simpler view of things, one can reduce basic solar motions to about one page of programming code. Here is some JavaScript code I wrote to do this. It is designed to be used in a web page such as this one of mine at http://danallen46.homeunix.org/S2K.htm --- snip here --- /* all arguments and results are in decimal degrees */ var D2R = Math.PI/180; var R2D = 180/Math.PI; var lat,lon,tz; function Floor(x) { return Math.floor(x); } function Round(x) { return Floor(x+0.5); } function Mod(x,y) { return x - y * Math.floor(x/y); } function Sin(x) { return Math.sin(x*D2R); } function Cos(x) { return Math.cos(x*D2R); } function Tan(x) { return Math.tan(x*D2R); } function ASin(x) { return Math.asin(x)*R2D; } function ATan2(y,x){ return Math.atan2(y,x)*R2D; } function Julian(year,month,day,hr,min,sec) { var m,y,a,b,jd; if (month <= 2) { y = year - 1; m = month + 12 } else { y = year; m = month } a = Floor(y/100); if (y < 1582 || y == 1582 && (m < 10 || m == 10 && day <=4)) b = 0; else b = 2 - a + Floor(a/4); jd = Floor(365.25*(y+4716)) + Floor(30.6001*(m+1)) + day + b - 1524.5; jd += (hr-12)/24 + min/(24*60) + sec/(24*3600); return jd; } function J2000(date,time) /* mm.ddyyyy - HP calculator compatible */ { var m,d,y,hr,min,sec; m = Floor(date); d = Floor((date - m)*100); y = Floor(1000000*(date - Floor(date) - d/100)+0.5); hr = Floor(time); min = Floor((time - hr)*100); sec = Floor((time - hr - min/100)*10000); return (Julian(y,m,d,hr+tz,min,sec) - Julian(2000,1,1,12,0,0))/36525; } function CalcSun(form) { var t,l,m,e,c,sunLong,trueAnom,radius,ecc,ra,dec,gst,lha,eqt,alt,az; lat = parseFloat(form.lat.value); lon = parseFloat(form.lon.value); tz = parseFloat(form.tz.value); t = J2000(parseFloat(form.date.value),parseFloat(form.time.value)); l = Mod(280.46646 + 36000.76983*t + 0.0003032*t*t,360); m = Mod(357.52911 + 35999.05029*t + -0.0001537*t*t,360); e = (0.016708634 + -0.000042037*t + -0.0000001267*t*t); c = (1.914602 + -0.004817*t + -0.000014*t*t) * Sin(m); c += (0.019993 + -0.000101*t) * Sin(m*2); c += (0.000289) * Sin(m*3); sunLong = l + c; trueAnom = m + c; radius = (1.000001018 * (1 - e*e)) / (1 + e * Cos(trueAnom)); ecliptic = (84381.448 + -46.815*t - 0.00059*t*t + 0.001813*t*t*t) / 3600; omega = 125.04 - 1934.136*t; apparentLong = sunLong - 0.00569 - 0.00478*Sin(omega); apparentEcliptic = ecliptic + 0.00256 * Cos(omega); ra = Mod(ATan2(Cos(apparentEcliptic)*Sin(apparentLong),Cos (apparentLong)),360); dec = ASin(Sin(apparentEcliptic)*Sin(apparentLong)); gst = (280.46061837 + 0.000387933*t*t + -2.58331180573E-8*t*t*t); gst += t*36525*360.985647366; gst = Mod(gst,360); lha = gst - lon - ra; eqt = (sunLong - ra) - (sunLong - l); /* positive values occur before UT */ if (eqt > 300) eqt = eqt - 360; alt = ASin(Sin(lat) * Sin(dec) + Cos(lat) * Cos(dec) * Cos(lha)); az = 180 + ATan2(Sin(lha),Cos(lha) * Sin(lat) - Cos(lat)*Tan(dec)); form.sunLong.value = sunLong; form.radius.value = radius; form.ra.value = ra; form.dec.value = dec; form.eqt.value = eqt; form.localNoon.value = lha+lon; form.az.value = az; form.alt.value = alt; } function CalcNow(form) { var d = new Date(); form.date.value = d.getMonth() + 1 + d.getDate()/100 + d.getFullYear ()/1000000; form.date.value = Round(form.date.value*10000000)/10000000; form.time.value = d.getHours() + d.getMinutes()/100 + d.getSeconds()/ 10000; form.time.value = Round(form.time.value*10000)/10000; CalcSun(form); } --- The accuracy of this code is not as good as more extensive codes. The best accuracy is achieved by numerically integrating the JPL solar model called DE405. More is available here: http://iau-comm4.jpl.nasa.gov/README with someone having done this here: http://www.ephemeris.com/software.html Dan Allen N39.997� W111.757� --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to NavList@fer3.com To unsubscribe, send email to NavList-unsubscribe@fer3.com -~----------~----~----~----~------~----~------~--~---