hp41programs

EqSol Equinoxes and Solstices for the HP-41
 

Overview
 

 1°)  Program#1
 2°)  Program#2
 

-The following programs calculate the times of the equinoxes and solstices.
-The accuracy is of the order of 5 minutes over the time span  [+1000 , +3000].
-The results are given in Ephemeris Time.
 

1°)  Program#1
 

-This routine uses the formulae given by Jean Meeus in reference [1]
 

Data Register:   R00: temp
Flags: /
Subroutine:   "DT"  ( cf "Julian and Gregorian Calendar for the HP-41 )
                        none if you have a Time Module

-Line 136 may be replaced by     1. 012  X<>Y   DATE+    if you have a Time Module
 
 

 01  LBL "EQSOL"
  02  DEG
  03  365242374
  04  STO 00
  05  X<> Z
  06   E3
  07  /
  08  2
  09  -
  10  ENTER^
  11  ENTER^
  12  GTO IND T
  13  LBL 01
  14  4
  15  *
  16  CHS
  17  52
  18  +
  19  *
  20  RCL 00
  21  +
  22  *
  23  79310
  24  GTO 12
  25  LBL 02
  26  9
  27  *
  28  PI
  29  +
  30  *
  31  RCL 00         
  32  748
  33  -
  34  +
  35  *
  36  172068
  37  GTO 12
  38  LBL 03
  39  PI
  40  *
  41  116
  42  -
  43  *
  44  RCL 00
  45  356
  46  -
  47  +
  48  *
  49  265717
  50  GTO 12
  51  LBL 04
  52  8
  53  *
  54  CHS
  55  62
  56  -
  57  *
  58  RCL 00         
  59  366
  60  +
  61  +
  62  *
  63  355560
  64  LBL 12
  65  +
  66  .1
  67  %
  68  STO Y
  69  365250
  70  /
  71  STO 00
  72  329645
  73  *
  74  23
  75  -
  76  COS
  77  202
  78  RCL 00
  79  *
  80  18
  81  -
  82  COS
  83  +
  84  20
  85  *
  86  19341
  87  RCL 00         
  88  *
  89  35
  90  -
  91  COS
  92  49
  93  *
  94  +
  95  4452671
  96  RCL 00
  97  *
  98  22
  99  +
100  COS
101  18
102  *
103  +
104  450369
105  RCL 00
106  *
107  73
108  +
109  COS
110  16
111  *
112  +
113  225184
114  RCL 00         
115  *
116  9
117  -
118  COS
119  14
120  *
121  -
122   E4
123  /
124  +
125  INT
126  LASTX
127  FRC
128  X<0?
129  DSE Y
130  ""
131  24
132  ST* Y
133  MOD
134  HMS
135 X<>Y
136  XEQ "DT"
137  END


   ( 241 bytes / SIZE 001 )
 
 

      STACK        INPUTS      OUTPUTS
           Y         YYYY        hh.mnss
           X             k   YYYY.MNDD

 where   YYYY =  year

      k = 1  for the spring equinox           k = 3  for the autumn equinox                ---Execution time = 12s---
      k = 2  for the summer solstice         k = 4  for the winter solstice

Example:    Find the times of the equinoxes and solstices of the year 2004

   2004  ENTER^
      1     XEQ "EQSOL"   >>>>    2004. 0320    X<>Y    6.5040        (  2004 March 20   at   6h50m40s  ET  )

   2004  ENTER^
      2        R/S            >>>>        2004.0621   X<>Y    0.5823        (  2004  June 21  at   0h58m23s  ET  )

   2004  ENTER^
      3        R/S           >>>>         2004.0922   X<>Y   16.3013       (  2004  September 22  at  16h30m13s  ET  )

   2004  ENTER^
      4        R/S          >>>>          2004.1221   X<>Y   12.4146       (  2004  December 21  at  12h41m46s  ET  )

-Subtract about 1 minute to get the result in Universal Time in 2004
  and round to the nearest minute.
 

2°)  Program#2
 

-This version calls a subroutine that computes the coordinates of the Sun ( Distance Earth-Sun in X, Mean Longitude in Y )
-It uses an iterative method.
 

Data Register:   R00 & R01: temp
Flags: /
Subroutines:   "SUN3"  ( cf "Astronomical Ephemeris for the HP-41" § 9 )
                            "DT"   ( cf "Julian and Gregorian Calendar for the HP-41" )

-Lines 44 to 52 may be replaced by    FLOOR   LASTX   FRC2   24   *
 where  FLOOR  and   FRC2  are M-code routines listed in "A Few M-Code Routines for the HP-41"
-Line 49 = TEXT 0  or another  NOP instruction like  LBL 00  ....
 
 

01  LBL "EQS"   
02  STO 01
03 X<>Y
04  2 E3
05  -
06  4
07  *
08  +
09  90
10  ST* 01
11  *
12  10
13  -
14  360008         
15  /
16  STO 00
17  19341
18  *
19  55
20  + 
21  SIN
22  209
23  /
24  ST+ 01
25  LBL 01
26  XEQ "SUN3"
27  176 
28  *
29  1/X
30  -
31  RCL 01
32  -
33  COS
34  6297
35  /
36  ST- 00
37  ABS
38  2 E-9
39  X<Y?
40  GTO 01
41  RCL 00         
42  365250
43  *
44  INT
45  LASTX
46  FRC
47  X<0?
48  DSE Y
49  ""
50  24
51  ST* Y
52  MOD
53  HMS
54 X<>Y
55  XEQ "DT"     
56  END
 


   ( 108 bytes / SIZE 002 )
 
 

      STACK        INPUTS      OUTPUTS
           Y         YYYY        hh.mnss
           X             k   YYYY.MNDD

 where   YYYY =  year

      k = 1  for the spring equinox           k = 3  for the autumn equinox
      k = 2  for the summer solstice         k = 4  for the winter solstice

Example:    With the same year 2004 , it yields

   2004  ENTER^
      1     XEQ "EQS"   >>>>       2004/03/20    X<>Y    6h48m37s                ---Execution time = 42s---

   2004  ENTER^
      2        R/S            >>>>        2004/06/21    X<>Y    0h58m32s                ---Execution time = 42s---

   2004  ENTER^
      3        R/S           >>>>         2004/09/22    X<>Y   16h31m23s                ---Execution time = 42s---

   2004  ENTER^
      4        R/S          >>>>          2004/12/21    X<>Y   12h41m10s                ---Execution time = 42s---
 

Notes:

-The accuracy depends of course on the precision given by "SUN"
-Here, the accuracies are approximately the same over the time-span [1000,3000]

-If your own program only calculates the longitude of the Sun, delete line 28

-The advantage of this version is that about 130 bytes are saved
-But on the other hand, it is more than 3 times slower
-You can reduce the number of iterations by choosing a better initial guess...
 

Reference:

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