Post Reply 
(HP-67/97) Planetary Ephemeris
09-13-2015, 11:10 AM
Post: #1
(HP-67/97) Planetary Ephemeris
From Programming Handheld Calculators by Paul Lutus.

[Image: pos1.jpg]
[Image: pos2.jpg]
[Image: pos3.jpg]
[Image: pos4.jpg]
Find all posts by this user
Quote this message in a reply
09-20-2015, 08:53 PM (This post was last modified: 09-20-2015 08:58 PM by Dieter.)
Post: #2
RE: (HP-67/97) Planetary Ephemeris
(09-13-2015 11:10 AM)Thomas Klemm Wrote:  From Programming Handheld Calculators by Paul Lutus.

Could you take a look at line 101? The code there is...

Code:
 97 1
 98 RCL (i)
 99 FRAC
100 STO 3
101 -
102 1
103 RCL 3
104 -
105 /

This calculates (1–R3)/(1–R3) which is always 1. ;-)
I think line 101 should read "+".

I also assume that "lbl A", "lbl B", "lbl C" and "lbl D" in the user instructions (table 3) are supposed to mean simply "A", "B", "C" and "D".
Typing a label instruction in run mode does not do anything. ;-)

Finally there are some "TF" commands. This was a HP65 instruction. On the HP67/97 testing flags is done with the "F?" command. I hope the program considers the 67/97's special behaviour of Flag 2 tests. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
09-20-2015, 09:47 PM
Post: #3
RE: (HP-67/97) Planetary Ephemeris
(09-20-2015 08:53 PM)Dieter Wrote:  Could you take a look at line 101? The code there is...

Code:
 97 1
 98 RCL (i)
 99 FRAC
100 STO 3
101 -
102 1
103 RCL 3
104 -
105 /

This calculates (1–R3)/(1–R3) which is always 1. ;-)
I think line 101 should read "+".

It appears that these lines calculate \(\frac{1+e}{1-e}\) of the formula in the mentioned article.

Quote:I also assume that "lbl A", "lbl B", "lbl C" and "lbl D" in the user instructions (table 3) are supposed to mean simply "A", "B", "C" and "D".
Typing a label instruction in run mode does not do anything. ;-)

Finally there are some "TF" commands. This was a HP65 instruction. On the HP67/97 testing flags is done with the "F?" command. I hope the program considers the 67/97's special behaviour of Flag 2 tests. ;-)

I haven't tested this program. But Paul Lutus mentioned that there were errors both in the listing and the data:
Quote:As with the solar position program, the article's publication created a lot of correspondence, including inquiries from JPL and its consultants asking about mathematical details and correcting some errors in the original published data tables (example).

It would be cool if we could make this program run correctly.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
09-20-2015, 10:00 PM
Post: #4
RE: (HP-67/97) Planetary Ephemeris
(09-20-2015 09:47 PM)Thomas Klemm Wrote:  It appears that these lines calculate \(\frac{1+e}{1-e}\) of the formula in the mentioned article.

Yes, that's why I think there must be a "+" instead of a "–" in line 101.

(09-20-2015 09:47 PM)Thomas Klemm Wrote:  I haven't tested this program. But Paul Lutus mentioned that there were errors both in the listing and the data:
...
It would be cool if we could make this program run correctly.

This should be no problem with a simple image editor. ;-)
Or maybe a HP97 user provides a (corrected) printed listing.

I do not know anything about astronomy, so maybe someone who is more into this could check the program as well as its data set, and post some results it returns. Or those it should return. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
08-03-2023, 10:07 PM (This post was last modified: 08-04-2023 08:40 AM by Josef.)
Post: #5
RE: (HP-67/97) Planetary Ephemeris
I tested the program and found that it contains multiple bugs. Some of the errors are due to bad copy, and some are due to using incorrectly marked functions. The algorithm is quite simple and quite inaccurate. I also analyzed the program's data which contains the major planet semi-axis, orbital period and longitude of perihelion in the order of Earth, Mercury, Venus, Mars, Jupiter and Saturn. Subsequently, we can replace them with Uranus, Neptune and Pluto. I've modified the program, and at least it works reasonably. The printed version doesn't even calculate Century Day correctly, which is a prerequisite for correct calculations. There are reasonably good astronomy programs for HP 50g, and I have been able to modify some of them to work.

Here is a listing of the modified program for the HP-67.

Code:
001:  31 25 11     LBL A
002:     33 00     STO 0
003:  33 51 00     STO-0
004:     33 01     STO 1
005:     31 83       INT
006:  33 51 01     STO-1
007:        01         1
008:        51         -
009:        02         2
010:     32 71      XLEY
011:  33 51 00     STO-0
012:     32 71      XLEY
013:  35 51 02      SF 2
014:     35 53      R DN
015:        03         3
016:        00         0
017:        83         .
018:        05         5
019:        08         8
020:        71         x
021:     23 02     DSP 2
022:     31 24       RND
023:  33 61 00     STO+0
024:     34 01     RCL 1
025:        43       EEX
026:        02         2
027:        71         x
028:        41     ENTER
029:     31 83       INT
030:  33 61 00     STO+0
031:        51         -
032:        03         3
033:        06         6
034:        05         5
035:        02         2
036:        05         5
037:        71         x
038:        41     ENTER
039:     31 83       INT
040:  33 61 00     STO+0
041:        51         -
042:  35 71 02      F? 2
043:     22 00     GTO 0
044:     31 61      XNE0
045:     22 00     GTO 0
046:        01         1
047:  33 51 00     STO-0
048:  31 25 00     LBL 0
049:     34 00     RCL 0
050:     23 02     DSP 2
051:     35 22       RTN
052:  31 25 12     LBL B
053:        00         0
054:     33 01     STO 1
055:     33 02     STO 2
056:        04         4
057:  35 51 02      SF 2
058:     22 01     GTO 1
059:  31 25 14     LBL D
060:        01         1
061:        07         7
062:     22 01     GTO 1
063:  31 25 15     LBL E
064:        02         2
065:        02         2
066:     22 01     GTO 1
067:  32 25 11    LBL fa
068:        08         8
069:     22 01     GTO 1
070:  32 25 12    LBL fb
071:        01         1
072:        01         1
073:     22 01     GTO 1
074:  32 25 13    LBL fc
075:        01         1
076:        04         4
077:  31 25 01     LBL 1
078:     35 33      ST I
079:     34 00     RCL 0
080:     34 24   RCL (i)
081:     32 83      FRAC
082:        43       EEX
083:        05         5
084:        71         x
085:        51         -
086:     31 34       ISZ
087:     34 24   RCL (i)
088:  31 22 08     GSB 8
089:        41     ENTER
090:     31 34       ISZ
091:     34 24   RCL (i)
092:     31 83       INT
093:        51         -
094:        02         2
095:        81         /
096:     31 64       TAN
097:        01         1
098:     34 24   RCL (i)
099:     32 83      FRAC
100:     33 03     STO 3
101:        61         +
102:        01         1
103:     34 03     RCL 3
104:        51         -
105:        81         /
106:        71         x
107:     32 64     TAN-1
108:        02         2
109:        71         x
110:        41     ENTER
111:     31 63       COS
112:     34 03     RCL 3
113:        71         x
114:        01         1
115:        51         -
116:        01         1
117:     34 03     RCL 3
118:     32 54       x^2
119:        51         -
120:     35 52      X<>Y
121:        81         /
122:     35 52      X<>Y
123:     34 24   RCL (i)
124:     31 83       INT
125:        51         -
126:     35 52      X<>Y
127:     31 33       DSZ
128:     31 33       DSZ
129:     34 24   RCL (i)
130:     31 83       INT
131:        43       EEX
132:        04         4
133:        81         /
134:        71         x
135:     31 72       R<P
136:  35 71 02      F? 2
137:     22 02     GTO 2
138:     33 01     STO 1
139:     35 52      X<>Y
140:     33 02     STO 2
141:        04         4
142:  35 51 02      SF 2
143:     22 01     GTO 1
144:  31 25 02     LBL 2
145:  33 51 01     STO-1
146:     35 52      X<>Y
147:  33 51 02     STO-2
148:     34 02     RCL 2
149:     34 01     RCL 1
150:     32 72       R>P
151:     35 52      X<>Y
152:     31 71      XLT0
153:  31 22 07     GSB 7
154:        41     ENTER
155:     33 03     STO 3
156:        02         2
157:        71         x
158:     31 62       SIN
159:        02         2
160:        83         .
161:        04         4
162:        71         x
163:        51         -
164:  35 71 00      F? 0
165:  31 22 09     GSB 9
166:     32 74    H>H.MS
167:        84       R/S
168:     34 03     RCL 3
169:     31 62       SIN
170:        02         2
171:        03         3
172:        83         .
173:        05         5
174:        71         x
175:     32 74    H>H.MS
176:        84       R/S
177:     35 54      R UP
178:     35 22       RTN
179:  31 25 07     LBL 7
180:        03         3
181:        06         6
182:        00         0
183:        61         +
184:     35 22       RTN
185:  31 25 08     LBL 8
186:        81         /
187:     32 83      FRAC
188:        03         3
189:        06         6
190:        00         0
191:        71         x
192:     35 22       RTN
193:  31 25 13     LBL C
194:     34 00     RCL 0
195:        02         2
196:        00         0
197:        83         .
198:        06         6
199:        61         +
200:     34 07     RCL 7
201:  31 22 08     GSB 8
202:  35 71 00      F? 0
203:  31 22 09     GSB 9
204:     32 74    H>H.MS
205:     35 22       RTN
206:  31 25 09     LBL 9
207:        01         1
208:        05         5
209:        81         /
210:     35 22       RTN
211:  32 25 15    LBL fe
212:        00         0
213:  35 71 00      F? 0
214:     22 00     GTO 0
215:  35 51 00      SF 0
216:  31 22 07     GSB 7
217:     22 09     GTO 9
218:  31 25 00     LBL 0
219:  35 61 00      CF 0
220:     22 07     GTO 7
Find all posts by this user
Quote this message in a reply
08-06-2023, 01:06 PM
Post: #6
RE: (HP-67/97) Planetary Ephemeris
That's great!
From what I can see you additionally changed the following lines:

Code:
021:     23 02     DSP 2
115:        51         -

I took your program, added the data in the registers and pasted it in this HP-67 emulator:
Code:
PROG
224
001: 31 25 11
002: 33 00
003: 33 51 00
004: 33 01
005: 31 83
006: 33 51 01
007: 01
008: 51
009: 02
010: 32 71
011: 33 51 00
012: 32 71
013: 35 51 02
014: 35 53
015: 03
016: 00
017: 83
018: 05
019: 08
020: 71
021: 23 02
022: 31 24
023: 33 61 00
024: 34 01
025: 43
026: 02
027: 71
028: 41
029: 31 83
030: 33 61 00
031: 51
032: 03
033: 06
034: 05
035: 02
036: 05
037: 71
038: 41
039: 31 83
040: 33 61 00
041: 51
042: 35 71 02
043: 22 00
044: 31 61
045: 22 00
046: 01
047: 33 51 00
048: 31 25 00
049: 34 00
050: 23 02
051: 35 22
052: 31 25 12
053: 00
054: 33 01
055: 33 02
056: 04
057: 35 51 02
058: 22 01
059: 31 25 14
060: 01
061: 07
062: 22 01
063: 31 25 15
064: 02
065: 02
066: 22 01
067: 32 25 11
068: 08
069: 22 01
070: 32 25 12
071: 01
072: 01
073: 22 01
074: 32 25 13
075: 01
076: 04
077: 31 25 01
078: 35 33
079: 34 00
080: 34 24
081: 32 83
082: 43
083: 05
084: 71
085: 51
086: 31 34
087: 34 24
088: 31 22 08
089: 41
090: 31 34
091: 34 24
092: 31 83
093: 51
094: 02
095: 81
096: 31 64
097: 01
098: 34 24
099: 32 83
100: 33 03
101: 61
102: 01
103: 34 03
104: 51
105: 81
106: 71
107: 32 64
108: 02
109: 71
110: 41
111: 31 63
112: 34 03
113: 71
114: 01
115: 51
116: 01
117: 34 03
118: 32 54
119: 51
120: 35 52
121: 81
122: 35 52
123: 34 24
124: 31 83
125: 51
126: 35 52
127: 31 33
128: 31 33
129: 34 24
130: 31 83
131: 43
132: 04
133: 81
134: 71
135: 31 72
136: 35 71 02
137: 22 02
138: 33 01
139: 35 52
140: 33 02
141: 04
142: 35 51 02
143: 22 01
144: 31 25 02
145: 33 51 01
146: 35 52
147: 33 51 02
148: 34 02
149: 34 01
150: 32 72
151: 35 52
152: 31 71
153: 31 22 07
154: 41
155: 33 03
156: 02
157: 71
158: 31 62
159: 02
160: 83
161: 04
162: 71
163: 51
164: 35 71 00
165: 31 22 09
166: 32 74
167: 84
168: 34 03
169: 31 62
170: 02
171: 03
172: 83
173: 05
174: 71
175: 32 74
176: 84
177: 35 54
178: 35 22
179: 31 25 07
180: 03
181: 06
182: 00
183: 61
184: 35 22
185: 31 25 08
186: 81
187: 32 83
188: 03
189: 06
190: 00
191: 71
192: 35 22
193: 31 25 13
194: 34 00
195: 02
196: 00
197: 83
198: 06
199: 61
200: 34 07
201: 31 22 08
202: 35 71 00
203: 31 22 09
204: 32 74
205: 35 22
206: 31 25 09
207: 01
208: 05
209: 81
210: 35 22
211: 32 25 15
212: 00
213: 35 71 00
214: 22 00
215: 35 51 00
216: 31 22 07
217: 22 09
218: 31 25 00
219: 35 61 00
220: 22 07
221: 84
222: 84
223: 84
224: 84
DATA
26
00: 0
01: 0
02: 0
03: 0
04: 10000.00102
05: 365.2564
06: 102.0167
07: 27.321661
08: 3871.000434
09: 87.9693
10: 77.20563
11: 7233.002141
12: 224.7009
13: 131.006784
14: 15237.01249
15: 686.9796
16: 335.093384
17: 52022.02874
18: 4332.0446
19: 14.04795
20: 0
21: 0
22: 95691.08041
23: 10775.056
24: 93.05741
25: 4
STATE
7
DEG
FIX
2
1
0
0
1
HELP
1

CARD
11
Title: Planetary Ephemeris
A: Date
B: Sun
C: Moon
D: Jupiter
E:
a:
b:
c:
d:
e: 24/360
END

Example

I just followed the example in table 3:

10.1277 A
28409.22

B
22.37

C
13.26

D
6.45

R/S
23.06

R/S
4.72

This looks quite good already.
But the result for the Sun is totally off.

In a comment it says that "10.1277 is the date of a solar eclipse".
Therefore I assume that the Sun's and Moon's position should agree.

Do you have any idea what's going wrong?
Find all posts by this user
Quote this message in a reply
08-07-2023, 10:24 AM
Post: #7
RE: (HP-67/97) Planetary Ephemeris
Yes, you have a right. I am now preparing a much better version of the calculation of the Sun's position that is significantly more accurate. Unfortunately, fitting the positions of the planets and Sun into one program in 224 steps with reasonable accuracy is impossible. The author did not give the exact algorithm for calculating the positions, it could be reverse decoded, but it is better to write the program again and better.
Find all posts by this user
Quote this message in a reply
09-01-2023, 01:02 PM
Post: #8
RE: (HP-67/97) Planetary Ephemeris
I also tested the calculations for Mercury and Venus, they are completely off, they just don't work. I have prepared new calculations of planetary positions according to other algorithms and allow calculations for years higher than 1999, which the above program does not allow.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)