-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCFPER3.TXT
306 lines (306 loc) · 5.41 KB
/
SCFPER3.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
LBL "SCFPER3" ;scanning b for drwg ellipse isoperim 4 in S steps
;b is the parameter in interpolation conic (ellipse)
;X^2 +bXY +cY^2 +dX +eY +F =0 for an isoperimeter curve
;THIS b IS NOT THE ELLIPSE HALF PARAMETER
;This program search all possible
; values of b for the interval X Y 0..2n/pi Based on the results,
; it will be possible to curve fit a function
; for a true (approximate) calculation of perimeter of value 4
;
;Inputs
; S ENTER XEQ SCFPER3
; Step S 2..100000 in area 0..2/pi
;
;Outputs
; X
; Y
; Radius
; Angle .. all above for ideal isoperimeter
; b .. for the ideal ellipse fitting curve
; 1/b
; X/Y .. as additional output (X and Y same as above)
; etc. see output example below
;
;THEN put these outputs into desmos.com for visualization
;
;typical output
;
;--START-----
;ELLIPSE CALC
;ISOPERIME OF
; 4.000000000 ***
; IN
; 500.0000000 ***
; STEPS
;------------
;X-Y & R-ANG >
; 0.636619771 ***
; 0.636619774 ***
; 0.900316316 ***
; 0.785398162 ***
; b
; 1.115384618 ***
; 1/b
; 0.896551722 ***
; X/Y
; 0.999999996 ***
; 1-(X/Y)^2
; 0.000000008 ***
; SQRT(1-(X/Y)^2
; 0.000091652 ***
; 1-(X/Y)^4
; 0.000000017 ***
; SQRT(1-(X/Y)^4
; 0.000129615 ***
; 1-/+X/Y**2
; 0.000000004 ***
; SQRT1-/+X/Y**2
; 0.000064807 ***
; (Y-X)/(Y+X)
; 0.000000002 ***
;------------
;X-Y & R-ANG >
; .....
;
;use R22-28
; R 20-21 in BPEREL
; R 00-19 are used in PERELS and 3 and 4 and 6
;
;require a printer or a terminal emulator ideally pyilper for log
;
;create raw files with "hp41uc.exe /t=SCFPER3.TXT /r /k"
; then upload in PC emulator / virtual drive / HP41 hardware
;
;under CC BY SA CreativeCommons 4.0 pascaldagornet at yahoo dot de
;
;change log
;2021 10 27 Creation
;2021 10 29 Release
;2021 11 03 X/Y output added
;2021 11 04 SQRT(1+(X/Y)**2) output added
;2021 11 08 (1+(X/Y)**2)**-1/2 and SQRT(1-(X/Y)**2) output added
; SQRT(1-(X/Y)**2)/SQRT(1+(X/Y)**2) output added
;2021 11 17 (Y-X)/(Y+X) output added
;
RAD
CF 00
ADV ;printer or a terminal emulator ideally pyilper recommended
"--START-----"
PRA
"ELLIPSE CALC"
PRA
"ISOPERIME OF"
PRA
4 ;fix the perimeter of 4 here
STO 20 ;P in R 20 (for later); same R 20 like in BPEREL
PRX
" IN "
PRA
X<>Y
PRX
" STEPS "
PRA
0.636619771 ;2 / PI
X<>Y
/
STO 22 ;Step decrement in 22
0.636619771
RCL 20
*
4
/
STO 23 ;(2 / PI)*P/4 start of calculation
LBL 01
"------------"
PRA
"X-Y & R-ANG >"
PRA
PRX ;output x (a) this area will be scanned
RCL 20
XEQ "BPEREL"
PRX ;output y (b)
STO 24
RCL 23
R-P
PRX
X<>Y
PI
2
/
X<>Y
-
PRX
1. ;will search the b between 1 and 3.99999
;0.5 is a parabel, so it must be > 0.5
3. ;4 is a degenerated ellipse, so it must be <4.
;3 Works
"BCON"
ASTO 06 ;if using SOL of MATH instead of SOLVE from Advantage
XEQ "SOLVE" ;finding the b of the conic for passing through the isoperimeter
" b"
PRA
PRX
" 1/b"
PRA
1/X
PRX
;
" X/Y"
PRA
RCL 23
RCL 24
/
PRX
;
" 1-(X/Y)^2"
PRA
X^2
CHS
1
+
PRX
;
" SQRT(1-(X/Y)^2"
PRA
SQRT
PRX
;
X^2
RCL 23
RCL 24
/
X^2
1
+
*
" 1-(X/Y)^4"
PRA
PRX
;
SQRT
" SQRT(1-(X/Y)^4"
PRA
PRX
;
RCL 23
RCL 24
/
X^2
CHS
1
+
RCL 23
RCL 24
/
X^2
1
+
/
" 1-/+X/Y**2"
PRA
PRX
;
SQRT
" SQRT1-/+X/Y**2"
PRA
PRX
" (Y-X)/(Y+X)"
PRA
RCL 24
RCL 23
-
LASTX
RCL 24
+
/
PRX
;
RCL 22
ST- 23
RCL 23
X>0?
GOTO 01
DEG
"---ENDE-----"
PRA
RTN
LBL "BCON"
STO 25 ; for later use of b (from conic equation) as parameter
2
PI
-
X^2
*
12
+
PI
4
*
-
2
PI
-
X^2
/
STO 26 ; for later use of c (not dependent of n) see conic equation
CHS
1
+
4
*
PI
/
RCL 25
-
STO 27 ; for later use: this is e/n
RCL 26
+
CHS
STO 28 ; f/n**2
;
; lets solve equation of second degree
; first create the C
RCL 24 ;Y of ellipse RCL xx
X^2
ST* 26
RCL 25
RCL 24
*
RCL 23 ;X of ellipse RCL xx
*
ST+ 26
RCL 23
X^2
ST+ 26 ; R26 is now C
; create the B
-1
ST* 25
RCL 23
ST* 25
RCL 24
RCL 27
*
ST+ 25
; A is R28
; Mitternacht Formel
RCL 26
RCL 28
*
4
*
CHS
RCL 25
X^2
+
SQRT
RCL 25
+
CHS
RCL 28
/
2
*
RCL 20
-
RTN
END