Overview
-A conic (C) may be defined by its cartesian equation: A.x2 + B.xy + C.y2 + D.x + E.y + F = 0
-Knowing these 6 coefficients, the following program determines the specifications of the curve, namely:
e = eccentricity,
p = parameter,
a & b = semi-major & semi-minor axis ( ellipse
and hyperbola )
C = center ( except for a parabola )
F & F' = focuses ( only F for a parabola )
(Ax) & (Ax') = Axis of symmetry ( only (Ax)
for a parabola )
(D) & (D') =directrices ( only (D) for a parabola
)
V, V' , V" , V''' = vertices ( only V , V'
for a hyperbola, only V for a parabola )
(As) & (As') = asymptotes ( for a hyperbola
only )
-A rotation by an angle µ is performed to eliminate the term in "xy", and a translation leads to the standard expressions:
x2/a2 + y2/b2
= 1 ( ellipse )
0 <= e < 1
(
e = 0 and a = b if (C) is a circle )
y2 = 2px
( parabola )
e = 1
x2/a2 - y2/b2
= 1 ( hyperbola )
e > 1
(Ax')
(D)
|
(D')
|
*|V'''
|
|
*
|
*
|
|
*
|
* |
-|---V-*--F----------C |-----------F'--*-V'---
|--(Ax)
ELLIPSE
|
*
|
* |
|
*
|
*
|
|
*| V''
|
(D)
*
|
*
|
*
|
*
-|---V*---F------------------------------------
(Ax)
PARABOLA
|
*
|
*
|
*
*
(D) (D')
(As) |(Ax') (As')
* \ | | |
/ *
* \ | | | /
*
* \| | | / *
* |\ | |/ *
-------------F-
*V|-\|/-|V'*---F'-------------------(Ax)
HYPERBOLA
* | /|\ | *
* |/ | |\ *
* / | | | \ *
* / | | | \
*
| |
-We assume the basis is orthonormal.
-The "degenerate" cases ( one point, one or two straight lines ) are
not taken into account ( for example if A = B = C = 0 ).
Data Registers: R00:
µ ( the rotation angle )
• R01 = A • R02 = B • R03 = C
• R04 = D • R05 = E • R06 = F
( these 6 registers are to be initialized before executing "CONIC"
)
-when the program stops, the specifications of the conic are stored in registers R07 to R34 as shown in the examples below.
Flags: F01 is set if (C) is an ellipse
F02 is set if (C) is a parabola
F03 is set if (C) is a hyperbola
Subroutines: /
Program Listing
-If you have an HP-41CX, lines 02-03-04 may be replaced by
CLX X<> F
-Line 43 is a three-byte GTO 03
-Lines 93 to 100 are only useful to produce a DATA ERROR line 96
if the conic is imaginary ( like x2+4y2+9=0 ). Otherwise,
these lines may be deleted.
-Lines 193-225 are three-byte GTO 04
01 LBL "CONIC"
02 CF 01 03 CF 02 04 CF 03 05 RCL 02 06 X^2 07 RCL 01 08 RCL 03 09 * 10 4 11 * 12 - 13 STO 33 14 X#0? 15 SIGN 16 2 17 + 18 SF IND X 19 RCL 01 20 RCL 03 21 + 22 ENTER ^ 23 ENTER^ 24 X^2 25 RCL 33 26 + 27 SQRT 28 ST+ Z 29 - 30 STO 23 31 X<>Y 32 STO 24 33 RCL 02 34 RCL 01 35 RCL 03 36 - 37 R-P 38 CLX 39 2 40 / 41 STO 00 42 FS? 02 43 GTO 03 44 RCL 03 45 RCL 04 46 * 47 ST+ X 48 RCL 02 49 RCL 05 50 * 51 - 52 STO 34 53 RCL 33 54 / 55 STO 11 56 STO 13 57 STO 15 |
58 STO 25
59 STO 27 60 STO 29 61 STO 31 62 RCL 04 63 * 64 RCL 01 65 RCL 05 66 * 67 ST+ X 68 RCL 02 69 RCL 04 70 * 71 - 72 RCL 33 73 / 74 STO 12 75 STO 14 76 STO 16 77 STO 26 78 STO 28 79 STO 30 80 STO 32 81 RCL 05 82 * 83 + 84 RCL 06 85 ST+ X 86 + 87 STO 09 88 RCL 23 89 / 90 RCL 09 91 RCL 24 92 / 93 X>Y? 94 X<>Y 95 CHS 96 LN 97 X<> L 98 CHS 99 X<Y? 100 X<>Y 101 FS? 01 102 X<=Y? 103 CHS 104 X>0? 105 GTO 01 106 1 107 ASIN 108 ST- 00 109 X<> Z 110 LBL 01 111 ABS 112 SQRT 113 STO 09 114 X<>Y |
115 ABS
116 SQRT 117 STO 10 118 RCL 00 119 LASTX 120 RCL 09 121 / 122 STO 08 123 SIGN 124 RCL 10 125 RCL 09 126 / 127 X^2 128 FS? 01 129 CHS 130 + 131 SQRT 132 STO 07 133 RCL 09 134 * 135 STO 24 136 P-R 137 ST+ 13 138 ST- 15 139 RDN 140 ST+ 14 141 ST- 16 142 CLX 143 RCL 09 144 P-R 145 ST+ 25 146 ST- 27 147 RDN 148 ST+ 26 149 ST- 28 150 CLX 151 RCL 10 152 P-R 153 ST+ 30 154 ST- 32 155 X<>Y 156 ST- 29 157 ST+ 31 158 RCL 00 159 1 160 P-R 161 STO 18 162 STO 20 163 RCL 11 164 * 165 X<>Y 166 STO 21 167 CHS 168 STO 17 169 RCL 12 170 * 171 - |
172 STO 22
173 STO 23 174 X<> 24 175 RCL 09 176 X^2 177 X<>Y 178 X#0? 179 / 180 X=0? 181 E99 182 ST+ 23 183 ST- 24 184 RCL 12 185 RCL 20 186 * 187 RCL 11 188 RCL 21 189 * 190 - 191 STO 19 192 FS? 01 193 GTO 04 194 1 195 STO 30 196 RCL 02 197 RCL 02 198 RCL 33 199 SQRT 200 ST+ Z 201 - 202 RCL 03 203 X=0? 204 GTO 02 205 ST+ X 206 ST/ Z 207 / 208 STO 29 200 X<>Y 210 STO 32 211 RCL 05 212 CHS 213 LASTX 214 / 215 STO 31 216 X<> 34 217 LASTX 218 1 219 X<> 33 220 SQRT 221 * 222 / 223 ST- 31 224 ST+ 34 225 GTO 04 226 LBL 02 227 STO 33 228 SIGN |
229 STO 32
230 RCL 01 231 RCL 02 232 / 233 STO 29 234 RCL 01 235 RCL 05 236 * 237 RCL 02 238 RCL 04 239 * 240 - 241 RCL 02 242 X^2 243 / 244 STO 31 245 RCL 05 246 CHS 247 RCL 02 248 / 249 STO 34 250 GTO 04 251 LBL 03 252 RCL 24 253 X=0? 254 GTO 03 255 STO 23 256 1 257 ASIN 258 ST- 00 259 LBL 03 260 RCL 00 261 RCL 05 262 P-R 263 RCL 00 264 RCL 04 265 P-R 266 ST+ T 267 RDN 268 - 269 STO 11 270 X<>Y 271 STO 12 272 CHS 273 STO 08 274 RCL 00 275 RCL 11 276 X^2 277 RCL 23 278 ST/ 11 279 ST+ X 280 ST/ 08 281 / 282 RCL 06 283 - 284 RCL 12 285 / |
286 P-R
287 RCL 00 288 RCL 11 289 P-R 290 ST- T 291 RDN 292 + 293 STO 09 294 STO 11 295 X<>Y 296 STO 10 297 RCL 00 298 RCL 08 299 P-R 300 ST+ 11 301 RDN 302 + 303 STO 12 304 RCL 00 305 1 306 STO 07 307 P-R 308 STO 14 309 STO 16 310 RCL 09 311 * 312 X<>Y 313 STO 17 314 CHS 315 STO 13 316 RCL 10 317 * 318 - 319 RCL 08 320 - 321 STO 18 322 RCL 09 323 RCL 13 324 * 325 RCL 10 326 RCL 14 327 * 328 + 329 STO 15 330 RCL 08 331 ST+ X 332 ABS 333 STO 08 334 LBL 04 335 RCL 08 336 RCL 07 337 END |
( 448 bytes / SIZE 035 )
STACK | INPUTS | OUTPUTS |
Y | / | p |
X | / | e |
-Execution time = 9 seconds
Example1: (C): 29.x2 + 24.xy + 36.y2 - 98.x - 264.y + 305 = 0
-Store 29 24 36 -98 -264 305 into registers R01 R02 R03 R04 R05 R06 respectively
and XEQ "CONIC" >>>> e =
0.7454 = R07 the conic is an ellipse ( F01 is
set )
X<>Y p = 1.3333 = R08 and we have
in registers R09 thru R32
R09 = a = 3 R11 = 0.2
R12 = 3.6 the center
is C(0.2;3.6)
R10 = b = 2 R13 =
1.9889 R14 = 2.2584
focus F(1.9889;2.2584)
R15 = -1.5889 R16 = 4.9416
focus F'(-1.5889;4.9416)
R17 = 0.6
R18 = 0.8
R19 = 3 Axis (Ax): 0.6
x + 0.8 y = 3
R20 = 0.8
R21 = -0.6 R22 = -2
Axis (Ax'): 0.8 x - 0.6 y = -2
(Ax) and (Ax') are always perpendicular.
R23 = 2.0249 directrix
(D): 0.8 x - 0.6 y = 2.0249
R24 = -6.0249 directrix
(D'): 0.8 x - 0.6y = -6.0249
we always have: (Ax') // (D) // (D')
R25 = 2.6 R26
= 1.8 vertex V(2.6;1.8)
R27 = -2.2 R28 = 5.4
vertex V'(-2.2;5.4)
R29 = 1.4 R30 = 5.2
vertex V"(1.4;5.2)
R31 = -1 R32 =
2 vertex V'''(-1;2)
Example2: (C): 17.x2 + 312.xy + 108.y2 - 1130.x - 840.y + 2525 = 0
-Store these 6 coefficients into registers R01 to R06
and R/S >>>>
e = 1.2019 = R07 the conic is a hyperbola ( F03
is set )
X<>Y p = 1.3333 = R08 and we have
in registers R09 thru R34
R09 = a = 3 R11 = 0.2
R12 = 3.6 the center
is C(0.2;3.6)
R10 = b = 2 R13 =
3.0844 R14 = 1.4367
focus F(3.0844;1.4367)
R15 = -2.6844 R16 = 5.7633
focus F'(-2.6844;5.7633)
R17 = 0.6
R18 = 0.8
R19 = 3 Axis (Ax): 0.6
x + 0.8 y = 3
R20 = 0.8
R21 = -0.6 R22 = -2
Axis (Ax'): 0.8 x - 0.6 y = -2
(Ax) and (Ax') are always perpendicular.
R23 = 0.4962 directrix
(D): 0.8 x - 0.6 y = 0.4962
R24 = -4.4962 directrix
(D'): 0.8 x - 0.6y = -4.4962
we always have: (Ax') // (D) // (D')
R25 = 2.6
R26 = 1.8 vertex V(2.6;1.8)
R27 = -2.2
R28 = 5.4 vertex V'(-2.2;5.4)
R29 = 0.0556 R30 = 1
R31 = 3.6111 Asymptote (As): 0.0556.x +
y = 3.6111
R32 = 2.8333 R33 = 1
R34 = 4.1667 Asymptote (As'): 2.8333.x + y =
4.1667
Example3: (C): 9.x2 + 24.xy + 16.y2 - 150.x - 75.y + 75 = 0
-Store these 6 coefficients into registers R01 thru R06
and R/S >>>>
e = 1 = R07 the conic is a parabola
( F02 is set )
X<>Y p = 1.5 = R08 and we
have in registers R09 thru R18
R09 = 0.2
R10 = 3.6 vertex
V(0.2;3.6)
( a parabola has no center )
R11 = 0.8
R12 = 3.15 focus
F(0.8;3.15)
. R13 = 0.6
R14 = 0.8
R15 = 3 Axis (Ax):
0.6 x + 0.8 y = 3
R16 = 0.8
R17 = -0.6 R18 = -2
Directrix (D): 0.8 x - 0.6 y = -2.75
Notes:
-In all these examples, R00 = µ = Arc tan(-3/4) = -36.8699°
-If (C) is a sphere ( e = 0 ) this program yields 4 vertices but in
fact, any point of the circle is a vertex.
Furthermore, in this case, the HP-41 produces y = + E99 and
y = - E99 for the directrices:
(D) & (D') are regarded as "infinitely" far from the circle
even if, strictly speaking, no directrix exists.
-If the conic is a hyperbola and C = 0 ( no term in y2 ),
the asymptotes are given by different formulas - lines 226 to 249 -
because one of them is parallel to the y-axis.
for instance, with 12.x2 - 4.xy + 5.x + y + 3 = 0 we find in registers R29 thru R34
-3
1 2 (As): -3.x
+ y = 2
and 1 0
0.25 (As'): x = 1/4
-I let you add text lines at the end of the routine if you want more
explicit outputs...