hp41programs

RisTranSet Rising-Transit-Setting for the HP-41
 

Overview
 

 1°)  Mean Sidereal Time at Greenwich
 2°)  Rising-Transit-Setting
 3°)  Simplified Programs
 4°)  For the Sun Only


-"RTS" calculates the times of rising, transit and setting of a celestial body on a day D and the geometric altitude at the moment of transit.
-For a better precision, the coordinates ( right ascension and declination ) must be obtained independently on days D-1, D , D+1 ( 0h UT )
-But first, we need a routine to compute the mean sidereal time at Greenwich:
 

1°)  Mean Sidereal Time at Greenwich
 

Data Register:  R00
Flag: /
Subroutine:  "J0" or "J1" or "J2" ( cf "Julian & Gregorian Calendars" for the HP-41" )
                          none if you have a Time module.

-Line 03 may be deleted if you replace line 05 by XEQ "J1" or XEQ "J2"
-If you have a Time module, lines 05 to 08 may be replaced by   1.012  DDAYS  24  *  -
-Line 11 stores the number of millenium since 2000/01/01  0h , but is not really necessary here.
 
 

 01  LBL "MST"
 02  HR
 03  STO Z 
 04  X<>Y
 05  XEQ "J0"
 06  24
 07  *
 08  +
 09  8766 E3
 10  /
 11  STO 00 
 12  .26
 13  %
 14  24000.5134
 15  +
 16  *
 17  6.6645
 18  +
 19  +
 20  24
 21  MOD
 22  HMS
 23  END

 
( 58 bytes / SIZE 001 )
 
 

       STACK        INPUTS      OUTPUTS
           Y   YYYY.MNDD             /
           X     hh.mnss (UT)  HH.MNSS (MST)

 
Example:   Find the mean sidereal time at Greenwich on 2005/01/27 at 14h29m16s

   2005.0127  ENTER^
       14.2916  XEQ "MST"  >>>>   MST =  22h57m08s
 

2°)  Rising-Transit-Setting
 

Data Registers:  R00 and R07 thru R15 are used for temporary data storage.       ( Registers R01 to R06 are to be initialized before executing "RTS" )

                              ( on day D-1 )        ( on day D )        ( on day D+1 )         ( at 0h )

                           •  R01 = RA(-1)   •  R03 = RA(0)   •  R05 = RA(+1)          RA = right ascension ( hh.mnss )
                           •  R02 = decl(-1)  •  R04 = decl(0)  •  R06 = decl(+1)         decl = declination  ( ° .  '  " )

Flags:

     Set Flag   F00  for the Sun
     Set Flag   F02  for the Moon    ( Clear these 2 flags for the other celestial bodies )

Subroutine:  "MST"
 
 

  01  LBL "RTS"
  02  DEG
  03  STO 12
  04  RDN
  05  STO 11
  06  CLX
  07  XEQ "MST"
  08  RCL 03       
  09  X<>Y
  10  HMS-
  11  HR
  12  RCL 11
  13  HR
  14  15
  15  /
  16  -
  17  24
  18  MOD
  19  STO 13
  20  .34
  21  FS? 00
  22  .5
  23  FS? 02
  24  -.073
  25  HR
  26  SIN
  27  STO 00
  28  2
  29  FS? 02
  30  3
  31  STO 15
  32  24.0657
  33  STO 14
  34  CLX
  35  STO 08 
  36  STO 09       
  37  STO 10
  38  LBL 01
  39  RCL 08
  40  STO 07
  41  XEQ 02
  42  STO 08
  43  XEQ 03
  44  ST- 08
  45  RCL 10
  46  STO 07
  47  XEQ 02
  48  STO 10
  49  XEQ 03
  50  ST+ 10
  51  RCL 09
  52  STO 07
  53  XEQ 02
  54  STO 09
  55  DSE 15
  56  GTO 01
  57  XEQ 03
  58  24
  59  ST* 08
  60  ST* 09
  61  ST* 10
  62  R^
  63  ASIN
  64  HMS
  65  RCL 10       
  66  HMS
  67  RCL 09
  68  HMS
  69  RCL 08
  70  HMS
  71  RTN
  72  LBL 02
  73  RCL 01
  74  HR
  75  RCL 05
  76  HR
  77  RCL 03
  78  HR
  79  XEQ 04
  80  RCL 13
  81  +
  82  RCL 14
  83  /
  84  RTN
  85  LBL 03
  86  RCL 02
  87  HR
  88  RCL 06
  89  HR
  90  RCL 04
  91  HR
  92  XEQ 04
  93  RCL 04       
  94  HR
  95  +
  96  ENTER^
  97  SIN
  98  RCL 12
  99  HR
100  SIN
101  *
102  STO Z
103  RCL 00
104  +
105  CHS
106  X<>Y
107  COS
108  RCL 12
109  HR
110  COS
111  *
112  ST+ T
113  /
114  SF 25
115  ACOS
116  RCL 14       
117  /
118  15
119  /
120  FC?C 25
121  CLX
122  RTN
123  LBL 04
124  ST- Z
125  -
126  STO Z
127  X<>Y
128  ST- Z
129  +
130  RCL 07
131  *
132  +
133  RCL 07
134  *
135  2
136  /
137  END

 
   ( 199 bytes / SIZE 016 )
 
 

            STACK            INPUTS         OUTPUTS
                 T                 /   h = altitude* ( ° .  '  " )
                 Z   Date ( YYYY.MNDD )   setting(UT) (hh.mnss)
                 Y     Longitude ( ° .  '  " )   transit(UT)  (hh.mnss)
                 X     latitude     ( ° .  '  " )   rising (UT)  (hh.mnss)

 * where  h = the geometric altitude of the center of the body at the time of transit.

Example1:   Find the times of rising, transit and setting of the Sun at Seattle ( 122°19'51"W ;  47°36'23"N )  on 2005/01/27

-First, we find the right ascension and declination of the Sun on 2005/01/26 , 2005/01/27 , 2005/01/28 at 0h UT  ( cf "Astronomical Ephemeris for the HP-41" )
 and we store these values into R01 thru R06:

       20.3404  STO 01      20.3813  STO 03     20.4221  STO 05
     -18.4416  STO 02     -18.2900  STO 04    -18.1324  STO 06

then,            SF 00  CF 02

            2005.0127  ENTER^
            -122.1951  ENTER^
               47.3623  XEQ "RTS"   >>>>    Rising =  15h41m39s (UT)                                       ---Execution time = 34s---
                                                    RDN    Transit = 20h22m12s (UT)
                                                    RDN    Setting = 25h03m17s (UT)    ( i-e   1h03m17s  on  2005/01/28 )
       RDN  altitude of the Sun at the time of transit =  24°07'48"

Note:

-For the Moon,   CF 00   SF 02   ,   execution time = 47 seconds

Example2:   Same questions for Sirius.  The right ascension and declination are  6h45m23s  and  -16°43'18"  for this date.

         6.4523   STO 01   STO 03   STO 05       the coordinates may be regarded as constant.
      -16.4318   STO 02   STO 04   STO 06

then,             CF 00   CF 02

             2005.0127   ENTER^      ( or  2005.0127   RCL 11   RCL 12   XEQ "RTS" )
              -122.1951  ENTER^
                 47.3623  XEQ "RTS"   >>>>    Rising =  1h42m05s (UT)                                       ---Execution time = 34s---
                                                     RDN    Transit =  6h28m09s (UT)
                                                     RDN    Setting = 11h14m14s (UT)
           RDN  altitude of Sirius at the time of transit =  25°40'19"

Note:

-If the body is circumpolar, there will be no rising and setting: the star will remain above ( or below ) the horizon.
-In this case however, "RTS" yields ( approximately ) the same values in X, Y, Z registers

-For example, with the pole star ( RA = 2h37m39s ; Decl = 89°17'10" )   "RTS" gives   X = Y = Z = 2h21m06s
  but since  T = altitude of the star at the instant of transit = 48°19'13"
  we can deduce that X and Z are meaningless results.
 

Remarks:
 

-The longitudes are measured positively Eastward from the meridian of Greenwich ( otherwise, replace line 16 by + instead of - ).
-The time of transit is ( almost ) always between  0h and 24h but the time of rising may be negative ( day D-1 ) ( press 24  HMS+ )
  and the time of setting greator than 24 ( day D+1 ).
-3 iterations are performed for the Moon, 2 in the other cases ( lines 28 to 31 ).One would be enough if the coordinates are constant.
-A quadratic interpolation formula is used.
-Line 25, register X contains a small angle -h0  that takes the refraction into account ( and the parallax for the Moon ).

-If you are situated at an altitude A ( in meters ) above sea level and/or if the horizon is limited by mountains, add to  -h0 the correction:
     arccos (a/(a+A)) - arctan H/d     where

            a = 6378137 m = the radius of the Earth
           H = height of the mountain
           d = distance mountain-observer.                   ( Add this term after line 25 )

-In fact, the refraction also depends on the air temperature and pressure ( cf "Astronomical Refraction for the HP-41" )
 and rising and setting times are accurate to 1 minute only.
 

3°)  Simplified Programs
 

-If low accuracy is sufficient, we may consider the right ascension & declination as constants:
-The program will be shorter and faster.
 

Formulae:      cos H = ( Sin h0 -  Sin d  Sin b ) / ( Cos d  Cos b )               where  b = latitude  &   d = declination

      time(rise)   =   0.99727 ( a - L - ST - H )
    time(transit) =   0.99727  ( a - L - ST )                        with    a = right-ascension  &  L = longitude
      time(set)    =   0.99727 ( a - L - ST + H )
 

Data Registers:  R00 and R03 to R06: temp.                   ( Registers R01- R02 & R16-R17 are to be initialized before executing "RTS" )

                         •  R01 = a  ( hh.mnss )             •  R16 = L ( positive East )   ( ° .  '  " )
                         •  R02 = d   ( ° .  '  " )               •  R17 = b  ( ° .  '  " )

Flags:

     Set Flag   F00  for the Sun
     Set Flag   F02  for the Moon    ( Clear these 2 flags for the other celestial bodies )

Subroutine:  "MST"
 
 

 01  LBL "RTS"
 02  DEG
 03  0
 04  XEQ "MST"
 05  RCL 01       
 06  X<>Y
 07  HMS-
 08  HR
 09  RCL 16
 10  HR
 11  15
 12  /
 13  -
 14  24
 15  MOD
 16  STO 03
 17  STO 04
 18  STO 05       
 19  .34
 20  FS? 00
 21  .5
 22  FS? 02
 23  -.073
 24  HR
 25  SIN
 26  STO 00
 27  RCL 02
 28  HR
 29  1
 30  P-R
 31  RCL 17
 32  HR
 33  1
 34  P-R
 35  ST* Z
 36  X<> T
 37  *
 38  STO 06       
 39  RCL 00 
 40  +
 41  CHS
 42  X<>Y
 43  ST+ 06
 44  /
 45  SF 25
 46  ACOS
 47  15
 48  /
 49  FC?C 25
 50  CLX
 51  ST- 03
 52  ST+ 05        
 53  .99727
 54  ST* 03
 55  ST* 04
 56  ST* 05
 57  RCL 06
 58  ASIN
 59  HMS
 60  RCL 05
 61  HMS
 62  RCL 04       
 63  HMS
 64  RCL 03 
 65  HMS
 66  END

 
    ( 106 bytes / SIZE 018 )
 
 

            STACK            INPUTS         OUTPUTS
                 T                 /   h = altitude* ( ° .  '  " )
                 Z                 /   setting(UT) (hh.mnss)
                 Y                 /   transit(UT)  (hh.mnss)
                 X  Date ( YYYY.MNDD )   rising (UT)  (hh.mnss)

 * where  h = the geometric altitude of the center of the body at the time of transit.

Example:   Find the times of rising, transit and setting of the Sun at Seattle ( 122°19'51"W ;  47°36'23"N )  on 2005/01/27

            -122.1951  STO 16
               47.3623  STO 17

-Here, we can use the right ascension and declination of the Sun on  2005/01/27  12h UT  ( cf "Astronomical Ephemeris for the HP-41" )
-We get:  RA = 20h40m17s & Decl = -18°21'15" and we store these values into R01 & R02:

      20.4017   STO 01
     -18.2115   STO 02

then,            SF 00  CF 02

      2005.0127   XEQ "RTS"   >>>>    Rising =  15h41m13s (UT)                                                            ---Execution time =7s---
                                                RDN    Transit = 20h20m47s (UT)
                                                RDN    Setting = 25h00m20s (UT)       ( i-e   1h00m20s  on  2005/01/28 )
                                                RDN   altitude  =  24°02'22"                 ( at the time of transit )

Notes:

-In this example, the error is about 3 minutes which may be acceptable.
-For the stars or for slow planets, the 2 versions are equivalent.
-Contrariwise, with the Moon, the differences are of course much more important.

-But we can iterate and re-calculate the positions at several instants:
-We have saved bytes, not always time...

-I've chosen R16 & R17 to store the longitude & latitude because they are unchanged by the ephemeris programs.
-If you prefer other registers, change lines 09 and 31 according to your choice.

-If you want to get the azimuth Az at the instant of set, you have the following formula:

    Cos Az = ( Sin h0 Sin b - Sin d ) / ( Cos b Cos h0 )           where  b = latitude  &   d = declination
 

Data Registers:  R00 and R03 to R08: temp.                   ( Registers R01- R02 & R16-R17 are to be initialized before executing "RTS" )

                         •  R01 = a  ( hh.mnss )             •  R16 = L ( positive East )   ( ° .  '  " )
                         •  R02 = d   ( ° .  '  " )               •  R17 = b  ( ° .  '  " )

Flags:

     Set Flag   F00  for the Sun
     Set Flag   F02  for the Moon    ( Clear these 2 flags for the other celestial bodies )

Subroutine:  "MST"
 
 

 01  LBL "RTS"
 02  DEG
 03  0
 04  XEQ "MST"
 05  RCL 01       
 06  X<>Y
 07  HMS-
 08  HR
 09  RCL 16
 10  HR
 11  15
 12  /
 13  -
 14  24
 15  MOD
 16  STO 03
 17  STO 04
 18  STO 05
 19  .34
 20  FS? 00
 21  .5
 22  FS? 02
 23  -.073
 24  HR
 25  1 
 26  P-R
 27  STO 08       
 28  X<>Y
 29  STO 00
 30  CHS
 31  STO 07
 32  RCL 17
 33  HR
 34  1
 35  P-R
 36  ST* 08
 37  X<>Y
 38  ST* 07
 39  RCL 02 
 40  HR
 41  1 
 42  P-R
 43  ST* T
 44  RDN
 45  ST- 07
 46  *
 47  STO 06       
 48  RCL 00
 49  +
 50  CHS
 51  X<>Y
 52  ST+ 06
 53  /
 54  SF 25
 55  ACOS
 56  15
 57  /
 58  FC? 25
 59  CLX
 60  ST- 03
 61  ST+ 05
 62  .99727
 63  ST* 03
 64  ST* 04
 65  ST* 05
 66  RCL 07       
 67  RCL 08
 68  /
 69  SF 25
 70  ACOS
 71  FC?C 25
 72  CLX
 73  HMS
 74  STO 07
 75  RCL 06
 76  ASIN
 77  HMS
 78  RCL 05
 79  HMS
 80  RCL 04       
 81  HMS
 82  RCL 03 
 83  HMS
 84  SIGN
 85  CLX
 86  RCL 07
 87  X<> L
 88  END

 
    ( 134 bytes / SIZE 018 )
 
 

            STACK            INPUTS         OUTPUTS
                 T                 /   h = altitude* ( ° .  '  " )
                 Z                 /   setting(UT) (hh.mnss)
                 Y                 /   transit(UT)  (hh.mnss)
                 X  Date ( YYYY.MNDD )   rising (UT)  (hh.mnss)
                 L                 /     Az ( ° .  '  " ) = R07

 * where  h = the geometric altitude of the center of the body at the time of transit.

Example:   Same questions for Sirius.  The right ascension and declination are  6h45m23s  and  -16°43'18"  for this date.

         6.4523   STO 01                         -122.1951  STO 16
      -16.4318   STO 02                            47.3623  STO 17

             CF 00   CF 02

             2005.0127   XEQ "RTS"   >>>>    Rise   =  1h42m05s (UT)                                       ---Execution time = 9s---
                                                      RDN    Transit =  6h28m09s (UT)
                                                      RDN      Set    = 11h14m14s (UT)
                                                      RDN        h     =  25°40'19" = altitude of Sirius at the time of transit

                                                     LASTX  =  Az  =  65°25'18" = Azimuth of Sirius at the time of set = R07

-The Azimuth at the time of rising = - Az = - 65°25'18"
-Tha azimuths are reckoned positively clockwise from South.


4°)   For the Sun Only


-This program computes all the data needed to get the results for the Sun.
-The position of the Sun at 12h is calculated without taking the perturbations into account.
-However, it seems enough, at least between 1950 & 2050 ( and probably a little more... )

Data Registers:  R00 and R03 to R08: temp.               

                            R01 = a  ( deg )                  R07 = L ( positive East )   ( ° .  '  " )
                            R02 = d  ( deg )                  R08 = b  ( ° .  '  " )

Flags:  F25
Subroutine:  "J0" or "J1" or "J2" ( cf "Julian & Gregorian Calendars" for the HP-41" )

 01 LBL "SRTS"
 02 DEG
 03 STO 08        
 04 RDN
 05 STO 07
 06 X<>Y
 07 XEQ "J2"
 08 STO 00
 09 .4928237
 10 STO 03
 11 ST+ X
 12 *
 13 79.539
 14 -
 15 STO 04
 16 77.063
 17 RCL 00
 18 21242
 19 /
 20 -
 21 +
 22 STO 05
 23 SIN
 24 1.915
 25 *
 26 +
 27 RCL 05        
 28 ST+ X
 29 SIN
 30 50
 31 /
 32 +
 33 1
 34 P-R
 35 549.4
 36 SQRT
 37 1
 38 P-R
 39 R^
 40 ST* Z
 41 *
 42 X<>Y
 43 ASIN
 44 STO 02
 45 X<> Z
 46 R-P
 47 X<>Y
 48 STO 01        
 49 RCL 04
 50 -
 51 RCL 07
 52 HR
 53 -
 54 RCL 03
 55 +
 56 15
 57 /
 58 12
 59 ST+ Y
 60 ST+ X
 61 MOD
 62 STO 03
 63 STO 04
 64 STO 05
 65 RCL 02
 66 1
 67 P-R
 68 RCL 08        
 69 HR
 70 1
 71 P-R
 72 ST* Z
 73 X<> T
 74 *
 75 STO 06
 76 .5
 77 HR
 78 SIN
 79 +
 80 CHS
 81 X<>Y
 82 ST+ 06
 83 /
 84 SF 25
 85 ACOS
 86 15
 87 /
 88 FC?C 25
 89 CLX
 90 ST- 03
 91 ST+ 05
 92 .99727
 93 ST* 03
 94 ST* 04
 95 ST* 05
 96 RCL 06        
 97 ASIN
 98 HMS
 99 RCL 05
100 HMS
101 RCL 04
102 HMS
103 RCL 03
104 HMS
105 END

 
       ( 172 bytes / SIZE 009 )
 
 

                STACK                 INPUTS              OUTPUTS
                    T                       /        h = altitude* ( ° .  '  " )
                    Z    Date ( YYYY.MNDD )        setting(UT) (hh.mnss)
                    Y  Longitude ( ° ' " ) ( positive East )        transit(UT)  (hh.mnss)
                    X             Latitude ( ° ' " )
       rising (UT)  (hh.mnss)

 * where  h = the geometric altitude of the center of the body at the time of transit.

Example:   Find the times of rising, transit and setting of the Sun at Seattle ( 122°19'51"W ;  47°36'23"N )  on 2005/01/27

      2005.0127   ENTER^
      -122.1951    ENTER^
        47.3623     XEQ "SRTS"   >>>>    Rising =  15h41m12s (UT)                                                                       ---Execution time =12s---
                                                  RDN    Transit = 20h20m45s (UT)
                                                  RDN    Setting = 25h00m18s (UT)       ( i-e   1h00m18s  on  2005/01/28 )
                                                  RDN   altitude  =  24°02'15"                      ( at the time of transit )



Reference:

[1]  Jean Meeus , "Astronomical Algorithms" - Willmann-Bell  -  ISBN 0-943396-61-1