Overview
1°) Program#1 [
1000 , 3000 ]
2°) Program(s)#2 [ 1900 , 2100
]
3°) Program#3
Latest Update: §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.
-The results are given in Ephemeris Time.
1°) Program#1 [ 1000 , 3000 ]
-This routine uses 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 28 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.5024
( 2004 March 20 at 6h50m24s ET
)
2004 ENTER^
2
R/S >>>>
2004.0621 X<>Y 0.5811
( 2004 June 21 at
0h58m11s ET )
2004 ENTER^
3
R/S >>>>
2004.0922 X<>Y 16.3017
( 2004 September 22
at 16h30m17s ET )
2004 ENTER^
4
R/S >>>>
2004.1221 X<>Y 12.4154
( 2004 December 21
at 12h41m54s ET )
-Subtract about 1 minute to get the result in Universal Time in 2004 and
round to the nearest minute.
-We can save several bytes if the dates are between 1900 & 2100:
Data Register: R00: temp
Flags: /
Subroutine: "DT" ( cf "Julian
and Gregorian Calendar for the HP-41 )
none if you have a Time Module
-Line 113 may be replaced by 1.012
X<>Y DATE+ if you have a Time Module
01 LBL "EQS" 02 DEG 03 36524237 04 STO 00 05 X<> Z 06 2 07 10^X 08 / 09 20 10 - 11 ENTER 12 GTO IND Z 13 LBL 01 14 RCL 00 15 * 16 79310 17 GTO 12 18 LBL 02 19 RCL 00 20 74 21 - 22 * 23 172068 |
24 GTO 12 25 LBL 03 26 CHS 27 RCL 00 28 35 29 - 30 + 31 * 32 265717 33 GTO 12 34 LBL 04 35 RCL 00 36 37 37 + 38 * 39 355560 40 LBL 12 41 + 42 .1 43 % 44 STO Y 45 36525 46 / |
47 STO 00 48 32964 49 * 50 23 51 - 52 COS 53 20 54 RCL 00 55 * 56 18 57 - 58 COS 59 + 60 20 61 * 62 1934 63 RCL 00 64 * 65 35 66 - 67 COS 68 49 69 * |
70 + 71 445267 72 RCL 00 73 * 74 28 75 + 76 COS 77 18 78 * 79 + 80 45037 81 RCL 00 82 * 83 73 84 + 85 COS 86 16 87 * 88 + 89 22518 90 RCL 00 91 * 92 8 |
93 - 94 COS 95 14 96 * 97 - 98 4 99 10^X 100 / 101 + 102 INT 103 LASTX 104 FRC 105 X<0? 106 DSE Y 107 FRC 108 24 109 ST* Y 110 MOD 111 HMS 112 X<>Y 113 XEQ "DT" 114 END |
( 200 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 = 10s---
k = 2 for the summer solstice
k = 4 for the winter solstice
Example: Find the times of the equinoxes and solstices of the year 2023
2023 ENTER^
1 XEQ "EQS"
>>>> 2023.0320
X<>Y 21.2356
( 2023 March 20 at 21h23m56s ET
)
2023 ENTER^
2
R/S >>>>
2023.0621 X<>Y 15.0143
( 2023 June 21 at
15h01m43s ET )
2023 ENTER^
3
R/S >>>>
2023.0923 X<>Y 6.5055
( 2023 September 23 at 6h50m55s ET
)
2023 ENTER^
4
R/S >>>>
2023.1222 X<>Y 3.3007
( 2023 December 22 at 3h30m07s ET
)
-We can save again several bytes without GTO IND and with only 3 decimals in all the formula.
-But we use more registers.
Data Registers: R00...R05: temp
Flags: /
Subroutine: "DT" ( cf "Julian
and Gregorian Calendar for the HP-41 )
none if you have a Time Module
-Line 108 may be replaced by 1.012
X<>Y DATE+ if you have a Time Module
01 LBL "EQS" 02 DEG 03 STO 05 04 CLX 05 2 06 10^X 07 / 08 20 09 - 10 STO 00 11 36524237 12 STO 03 13 * 14 79310 15 + 16 STO 01 17 RCL 03 18 74 19 - 20 RCL 00 21 * 22 172068 |
23 + 24 STO 02 25 RCL 03 26 35 27 - 28 RCL 00 29 ST- Y 30 * 31 265717 32 + 33 X<> 03 34 37 35 + 36 RCL 00 37 * 38 355560 39 + 40 STO 04 41 RCL IND 05 42 .1 43 % 44 36525 |
45 / 46 STO 00 47 32964 48 * 49 23 50 - 51 COS 52 RCL 00 53 20 54 * 55 18 56 - 57 COS 58 + 59 RCL 00 60 445267 61 * 62 28 63 + 64 COS 65 + 66 ST+ X |
67 + 68 RCL 00 69 1934 70 * 71 35 72 - 73 COS 74 5 75 * 76 + 77 RCL 00 78 45037 79 * 80 73 81 + 82 COS 83 RCL 00 84 22518 85 * 86 8 87 - 88 COS |
89 - 90 2 91 SQRT 92 * 93 + 94 3 95 10^X 96 / 97 INT 98 LASTX 99 FRC 100 X<0? 101 DSE Y 102 FRC 103 24 104 ST* Y 105 MOD 106 HMS 107 X<>Y 108 XEQ "DT" 109 END |
( 188 bytes / SIZE 006 )
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 = 10s---
k = 2 for the summer solstice
k = 4 for the winter solstice
Example: Find the times of the equinoxes and solstices of the year 2023
2023 ENTER^
1 XEQ "EQS"
>>>> 2023.0320
X<>Y 21.2404
( 2023 March 20 at 21h24m04s ET
)
2023 ENTER^
2
R/S >>>>
2023.0621 X<>Y 15.0151
( 2023 June 21 at
15h01m51s ET )
2023 ENTER^
3
R/S >>>>
2023.0923 X<>Y 6.5029
( 2023 September 23 at 6h50m29s ET
)
2023 ENTER^
4
R/S >>>>
2023.1222 X<>Y 3.2949
( 2023 December 22 at 3h29m49s ET
)
-We will save 3 bytes if we replace 36525 ( line 44 ) with 40000 ( and modifying lines 47 , 60 , ... )
Data Registers: R00...R05: temp
Flags: /
Subroutine: "DT" ( cf "Julian
and Gregorian Calendar for the HP-41 )
none if you have a Time Module
-Line 109 may be replaced by 1.012
X<>Y DATE+ if you have a Time Module
01 LBL "EQS" 02 DEG 03 STO 05 04 CLX 05 2 06 10^X 07 / 08 20 09 - 10 STO 00 11 36524237 12 STO 03 13 * 14 79310 15 + 16 STO 01 17 RCL 03 18 74 19 - 20 RCL 00 21 * 22 172068 |
23 + 24 STO 02 25 RCL 03 26 35 27 - 28 RCL 00 29 ST- Y 30 * 31 265717 32 + 33 X<> 03 34 37 35 + 36 RCL 00 37 * 38 355560 39 + 40 STO 04 41 RCL IND 05 42 .1 43 % 44 4 E4 |
45 / 46 STO 00 47 190 48 X^2 49 * 50 23 51 - 52 COS 53 RCL 00 54 22 55 * 56 18 57 - 58 COS 59 + 60 RCL 00 61 487630 62 * 63 28 64 + 65 COS 66 + |
67 ST+ X 68 + 69 RCL 00 70 2118 71 * 72 35 73 - 74 COS 75 5 76 * 77 + 78 RCL 00 79 49322 80 * 81 73 82 + 83 COS 84 RCL 00 85 24661 86 * 87 8 88 - |
89 COS 90 - 91 2 92 SQRT 93 * 94 + 95 3 96 10^X 97 / 98 INT 99 LASTX 100 FRC 101 X<0? 102 DSE Y 103 FRC 104 24 105 ST* Y 106 MOD 107 HMS 108 X<>Y 109 XEQ "DT" 110 END |
( 185 bytes / SIZE 006 )
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 = 10s---
k = 2 for the summer solstice
k = 4 for the winter solstice
Example: Find the times of the equinoxes and solstices of the year 2023
2023 ENTER^
1 XEQ "EQS"
>>>> 2023.0320
X<>Y 21.2404
( 2023 March 20 at 21h24m04s ET
)
2023 ENTER^
2
R/S >>>>
2023.0621 X<>Y 15.0151
( 2023 June 21 at
15h01m51s ET )
2023 ENTER^
3
R/S >>>>
2023.0923 X<>Y 6.5029
( 2023 September 23 at 6h50m29s ET
)
2023 ENTER^
4
R/S >>>>
2023.1222 X<>Y 3.2949
( 2023 December 22 at 3h29m49s ET
)
3°) Program#3
-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
-With much more accurate formulae...