This is an hp48g program to convert from equatorial (declination and right ascension) to the horizon (altitude and azimuth) coordinates. Altitude varies from -90 to +90 degrees; true North is +90 degrees. Azimuth (measured West from South) varies from 0 to 360 degrees. Azimuth (measured East from North (is 0)) ranges from -180 to +180 degrees. When you set the time to UTC choose 24-hour time and M/D/Y date *display*. Check yourself by calculating once with the default date, checking the time on the calculator, and calculating once with the date you enter mm.ddyyyy. The internal storage of the M/D/Y date display is mm.ddyyyy (another storage also exists!)




input screen output screen







+ why hp48g ?

+ about the program

+ source code in user rpl for*your*own*personal*use*only thanks

+ accuracy

For setting circles, many people use a tape measure around the azimuthal circle and a protractor for the altitude measure. I did a variation of this: scanning a portion of a tape measure, resizing the length of the 1/8 inch divisions so that 360 "units" equals the circumference, removing the inch numbers and adding degree numbers in my favorite image processor. The whole circle needs to be pieced together after printing:zero to 180 going east and going west, and scotchtaped together and to the circumference. The protractor was scanned and resized while maintining the aspect ratio. Before and after resizing (or resampling) I printed out and actually measured things because the printer setup page also has some scaling on it that can affect things. Adobe Photoshop (maybe Gimp for Linux) , Paintshop Pro5 for a functioning demo in Windows95) and many others should all get the job done.

Made by Hewlitt-Packard, the hp48g is mostly thought of as a graphic calculator. With 32K of RAM, the RPL language has more than 575 commands with which to program this tiny hand held computer using 3 AAA batteries (that don't need replacement after months of use). It has an RS232 serial port, infra red port, a programmable alarm, and it keeps track of the time and date. You will want to set it to UTC.

back

The hp48 program ALTAZ is written in user RPL. It converts Right Ascension and Declination from the Equatorial Coordinate System to Altitude and Azimuth in the Horizon Coordinate System.

It's subroutines: INDATA accepts six pieces of data in a window. The defaults are set for latitude, longitude of Seattle, Washington,current UTC time and date(provided you set 24 hour time UTC )and the date mm.ddyyyy and the RA, decl of Polaris. Declination(decl) is entered as degrees.minutes (using two place values) followed by seconds (with two place values) and fractional part of seconds. Declination is positive north of the equator and negative if south. Latitude(lat) is the observer's latitude, positive in the northern hemisphere and negative in the southern. Right ascension (ra) is input as hours.minutes(two places) seconds(two places)and fractions of a second. Longitude(long) is the observer's longitude(positive west of Greenwich and negative east of Greenwich) dd.mmSSs. The time(UTC) is input as hh.mmSSs where minutes (mm) and seconds(SS) have two place values. The date(date) is expressed as mm.ddyyyy with mm being the number of the month, dd the date (two place values)and yyyy the year. The date must be greater than October 15, 1582 (10.151582) for the HP48 to understand it. INDATA converts these six input vaLlues to degrees and fractions of degrees for decl(level 6 on the stack),lat, RA, long (level 3), time in fraction of a day, and date mm.ddyyyy (level 1 on the stack).

JD0(that is a zero for Julian Date at time 0 UT). Accepts level 1 mm.ddyyyy as input and calculates JD0 using the formula (IP means integral part) for dates greater than 10.151582 and mm > 2

		
			JD0 = IP(365.25 * yyyy)  +  IP(30.6001 * (mm + 1))

					+ dd  + 1720994.5  +

					 2 + IP[IP(yyyy/100)/4]  - IP(yyyy/100)  

		

for mm less than or equal to 2 make the substitution mm = mm + 12 and yyyy = yyyy - 1 and use the formula above. This formula comes from Astronomical Formulae for Calculators by Jean Meeus (1988, Willmann-Bell,Richmond)page 24. It has been checked for the following values: 10.041957 input ( 2436115.5 output) Following values come from Astronomical Algorithms by Jean Meeus (1991, Willmann-Bell,Richmond). He uses a different formula for JD0 in his newer book; the values both agree: 1987Jan27.0 (2446822.5) 1988Jan27.0 (2447187.5) 1900Jan1.0 (2415020.5) 1600Dec31 (2305447.5)

GMST calculates Greenwich Mean Sidereal Time expressed as an angle from 0 to 360 degrees. From the value of JD0 on level 1 and time in terms of fraction of a day on level 2, adding JD0 and the fraction of day to form JD, the Julian date. The quantity T is defined as: T = (JD - 2451545.0)/36525 GMST is calculated from the formula on page 84 of Astronomical Algorithms:


 GMST = 280.46061837 + 360.98564736629*(JD-2451545.0)
					+ 0.000387933*T*T   -T*T*T/38710000  
			

In order to bring this into the range of 0 to 360 degrees the quantity [IP(GMST/360)]*360 is subtracted and GMST is tested for being less than 0 degrees;add 360 in that case.

HA calculates hour angle from GMST, longitude and RA. HA = GMST - long - RA

ANGLES calculates ALT(altitude is positive in the northern hemisphere above the horizon(is 0 degrees)and ranges from -90 to +90) and AZ(azimuth measured Westward from the South, same convention as the hour angles) ranges from 0 to 360 degrees. You can also express AZ as measured Eastward from the North with range -180 to +180 degrees. Using the formulas on page 89 of Astronomical ALgorithms and the value of HA we calculated, DECL and LAT that was input at the beginning, the angles come from these formulas(widely available and the result of spherical trigonometry). See the mathematical astronomy webpages of Paul Schlyter astronomical positions :


	tan(AZ)= sin(ha)/(cos(ha)*sin(lat)-tan(decl)*cos(lat))
			     
	sin(ALT)=sin(decl)*sin(lat) + cos(decl)*cos(lat)*cos(ha)	
			
back

The code is entered in the directory with the same name as the main program, ALTAZ. Enter the code as follows, except that SQRT and <= uses the symbols on the HP48G.



	      << INDATA JD0 GMST HA ANGLES >> ' ALTAZ  STO



	
		<< 
		    " RA DECL        ALT  AZ"
			{ { "decl"   "dd.mmsss N is+ "}
			  { "lat"    "dd.mmsss N is+ "}
			  ( "ra"     "hh.mmsss W is+fromS"}
			  ( "long"   "dd.mmsss W is+ "}
			  { "UTC"    "hh.mmsss Greenwich"}
			  { "date"   "mm.ddyyyy" } }
				{ 2 }  { } 
			{ 89.15  47.37  2.3  122.2  TIME  DATE  }
			INFORM  DROP  DUP  1  4  SUB HMS->  OBJ->
			DROP  SWAP  15 *  SWAP  5  ROLL  5  6  SUB
			OBJ->  DROP  SWAP  ->NUM  HMS->  24 /  SWAP
			->NUM  >>  ' INDATA  STO






			<< DUP IP SWAP FP 100 * DUP  IP  SWAP  
			   FP  10000  *  ROT  DUP  CASE  2 <=  
			   THEN  12  +  SWAP  1  -  SWAP  END  END
			   1  +  30.6001  *  IP  ROT  +  SWAP  DUP  
			   365.25  *  IP  1720994.5  +  ROT  +  SWAP
			   DUP  CASE  1582 >  THEN  100  /  IP  
			   DUP  4  /  IP  SWAP  -  2  +  END  DROP  0
			   END  +  >> ' JD0  STO





			<<  +  2451545  -  DUP  360.985647366  *  
			    280.46061837  +  SWAP  36525  /  DUP  DUP  *
			    DUP  .000387933  *  3  ROLLD  *  -38710000  /
			    +  +  DUP  360  /  IP  360  *  -  DUP  CASE
			    0 <  THEN  360  +  END  END  >>  ' GMST  STO

		



			<<  3  ROLLD  +  -  >>  ' HA  STO






	<<   ->  DECL  LAT  HA
	<<  'ASIN(SIN(LAT)* SIN(DECL) + COS(LAT) *COS(DECL) *COS(HA))'
			    EVAL  'ALT'  ->TAG 
		IFERR  
	  ' ATAN(SIN(HA)/(COS(HA)*SIN(LAT)-TAN(DECL)*COS(LAT)))'
	      EVAL  THEN 90 END  DUP SIGN  'SIN(HA)' EVAL SIGN
		    -> T S  <<  IF 'T > 0' THEN IF 'S > 0' 
			         THEN 0 ELSE 180 END
				    ELSE IF 'S > 0' THEN 180 ELSE 360
					END END >>  + DUP 
		'AZdegWfromS' ->TAG  SWAP 180 
	 'AZdegEfromN'  ->TAG  >>  ' ANGLES  STO





back

In the following, the values of (RA,DECL) are from Bishop,Roy(editor) Observors Handbook 1998 (The Royal Astronomical Society, Toronto,1997). The ALT, AZ values on the left are computed from the online MICA(Multiyear Interactive Computer Almanac), which claims to be the same calculations as the Astronomical Almanac. In order to get their altitude values to the same range (-90,+90) , the values were subtracted from 90. In order to get their azimuth values to the same range (-180,+180)E of N values greater than 180 had 360 subtracted from them. The time is 19.14 UTC. The date 06.031998 (input for June 3,1998). The latitude and longitude are the defaults (47.36 N, 122.20 W).



	ALT, AZ from aa     Star(RA,DECL)	ALT, AZ hp48altaz 
      _____________        ____________           _____________

	 48.58, -.65  	Polaris(2.30,89.15)	48.3,	-.399
		      	
 	57.8,160.28	Aldebaran(4.359,16.30)	57.61,160.18		

	31.6, 156.10	Rigel(5.145,-8.12)	31.30,156.06

	75.78, 88.43 	Capella(5.166,46.0)	75.55, 88.62

	42.48, 137.10	Betelgeuse(5.551,7.24)	42.07, 137.17

	15.42, 137.23	Serius(6.452,-16.43)	14.99, 137.33

	25.95, 112.27	Procyon(7.393,5.14)	25.86, 112.38

	ALT, AZ from aa     Star(RA,DECL)	ALT, AZ hp48altaz 
      _____________        ____________           _____________

	41.66, 92.07	Pollux(7.453,28.02)	41.46, 92.16

	6.55, 79.03	Regulus(10.083,11.59)	 6.22, 79.02

	-42.11, 52.42	Spica(13.251,-11.08)	-42.18,52.68

	-19.42, 24.23	Arcturus(14.157,19.12)	-19.75, 24.25

	-67.37, -21.95	Antares(16.294,-26.26)	-67.66, -21.73

	 3.87, -30.91	Vega(18.369,38.46)	 3.83, -30.96

	-12.58, -60.92	Altair(19.508,8.51)	-12.89, -60.99

	 22.58, -46.63	Deneb(20.414,45.17)	 22.33, -46.41

	-11.38, -121.72	Fomalhaut(22.576,-29.38) -11.59,-121.61



 Example 12b page 91 of Astronomical Algorithms by 
Jean Meeus(Willmann-Bell,1991,Richmond)
apparent decl: -6.43116  (he corrects for apparent sidereal time )
lat: 38.5517
apparent ra: 23.09166        his answer:ALT: 15.1249deg   my answer: 15.1241
long: 77.0356                           AZ:  68.0337deg              68.0344  
time:19.2100                       
date:04.101987



Example from Keith Burnett's webpages

approximate astronomical positions 
  Hale Bopp
decl: 42.10
lat:  52.5
ra:   22.5110                               his:ALT:24.3983  my:  24.5968
long: 1.55                                      AZ: 51.7039       51.8131
time: 4.30
date: 03.141997




Example page 45 of Spherical Astronomy by Robin Green 
(Cambridge U. Press,1985,London)
decl:  2.08
lat:  40.15                              his:ALT: 26.0564     my:26.09197
ra:   12.283                                  AZ: 68.9221        68.88309
long: 83.31              (he measures az W of N and his answer of 111.0779
time: 14.42                must be subtracted from 180 to compare with our
date: 01.071985                             W of S convention)



Example 8b page 46 of Astronomical Formulae for Calculators 
4th edition by Jean Meeus (Willmann-Bell,1988,Richmond)
apparent decl:  8.25581    He uses corrections to sidereal time(and hence
lat:           50.4755    hourangle which I have not included.They should be 
apparent ra:   10.5735681         around 1/5 of a second. 
long:          -0.172594                his:ALT:  36.5405    my:  34.4658
time:           4.34                         AZ: -51.6992        -55.9339
date:          11.131978         


back copyright
1