===================== Triangle Solution ===================== Copyright (C) 1979-1981 by Steffen Beyer. This program is free software; you can use, modify and redistribute it under the terms of the GNU General Public License (http://www.gnu.org/licenses/gpl.html) or the GNU Lesser General Public License (http://www.gnu.org/licenses/lgpl.html), as published by the Free Software Foundation (http://www.fsf.org/), either version 3 of the License, or (at your option) any later version. It is intended for use e.g. with the TI-58C/59 Calculator Emulator for Android (https://play.google.com/store/apps/details?id=net.obry.ti5x&hl=en). Field: Trigonometry Card: +---------------------------------------+ | Triangle Solution | +-------+-------+-------+-------+-------+ | alpha | beta | gamma | | | +-------+-------+-------+-------+-------+ | a | b | c | INIT | CALC | +-------+-------+-------+-------+-------+ Description: Given any(*) three values describing an arbitrary triangle, such as length of side a, length of side b, length of side c, angle alpha, angle beta or angle gamma, the program will automatically calculate the missing other three values. (*): at least one side Usage: D = initialize / clear all A = enter length of side a B = enter length of side b C = enter length of side c A' = enter angle alpha B' = enter angle beta C' = enter angle gamma E = calculate missing values A = display length of side a B = display length of side b C = display length of side c A' = display angle alpha B' = display angle beta C' = display angle gamma In case there is more than one solution (indicated by a blinking 2 after pressing E), press E again after viewing the first solution in order to display the values of the second solution. Example: D 3 A 4 B 5 C E A' B' C' will display 36.86989765, 53.13010235 and 90, respectively. Good to know: The program does not interfere with ongoing calculations. None of the functions A, B, C, A', B', C', D and E uses CLR or = internally. For example it is possible to enter A' + B' + C' = in order to make a sanity check that the sum of the angles is indeed 180 degrees (if "Deg" is selected). The program of course also works with "Rad" and "Grad". The program checks the number of arguments and displays a blinking 9.9999999 99 if there are more or less than three arguments, but it does no sanity checks on the arguments themselves in order to see whether the values cannot possibly match a real triangle, such as for example a = 3, b = 11 and alpha = 19. In fact the maximum angle alpha which is possible in this example is easily calculated as D 3 A 11 B 90 B' E A' which yields 15.82662013. This example D 3 A 11 B 19 A' E allegedly gives two solutions, the second of which yields negative values - an indication that something is wrong. When the angle alpha is smaller than 15.82662013, then there are indeed always two solutions. For example D 3 A 11 B 15 A' E will yield the following two solutions: a = 3 b = 11 c = 11.57098371 alpha = 15 beta = 71.6230946 gamma = 93.3769054 a = 3 b = 11 c = 9.679384465 alpha = 15 beta = 108.3769054 gamma = 56.6230946 Resources used: This program uses registers 00-13 and t as well as flags 0 and 1. Formulas used: alpha + beta + gamma = 180 or 2 Pi or 200 c^2 = a^2 + b^2 - 2ab cos gamma a / sin alpha = b / sin beta = c / sin gamma Further development: Maybe a sanity check could be added that the sum of the angles which have been entered is less than 180. Maybe a function could be added to calculate the area of the triangle, according to the following formula: A = sqrt( s (s-a) (s-b) (s-c) ) with s = ( a + b + c ) / 2 Original listing: 000 76 LBL 001 11 A 002 87 IFF 003 00 00 004 00 00 005 79 79 006 42 STO 007 01 01 008 92 RTN 009 76 LBL 010 12 B 011 87 IFF 012 00 00 013 00 00 014 82 82 015 42 STO 016 02 02 017 92 RTN 018 76 LBL 019 13 C 020 87 IFF 021 00 00 022 00 00 023 85 85 024 42 STO 025 03 03 026 92 RTN 027 76 LBL 028 16 A' 029 87 IFF 030 00 00 031 00 00 032 88 88 033 42 STO 034 04 04 035 92 RTN 036 76 LBL 037 17 B' 038 87 IFF 039 00 00 040 00 00 041 91 91 042 42 STO 043 05 05 044 92 RTN 045 76 LBL 046 18 C' 047 87 IFF 048 00 00 049 00 00 050 94 94 051 42 STO 052 06 06 053 92 RTN 054 76 LBL 055 14 D 056 22 INV 057 86 STF 058 00 00 059 22 INV 060 86 STF 061 01 01 062 05 5 063 69 OP 064 17 17 065 00 0 066 42 STO 067 01 01 068 42 STO 069 02 02 070 42 STO 071 03 03 072 42 STO 073 04 04 074 42 STO 075 05 05 076 42 STO 077 06 06 078 92 RTN 079 43 RCL 080 01 01 081 92 RTN 082 43 RCL 083 02 02 084 92 RTN 085 43 RCL 086 03 03 087 92 RTN 088 43 RCL 089 04 04 090 92 RTN 091 43 RCL 092 05 05 093 92 RTN 094 43 RCL 095 06 06 096 92 RTN 097 00 0 098 35 1/X 099 92 RTN 100 76 LBL 101 15 E 102 87 IFF 103 01 01 104 05 05 105 22 22 106 00 0 107 42 STO 108 09 09 109 42 STO 110 10 10 111 01 1 112 42 STO 113 07 07 114 01 1 115 01 1 116 42 STO 117 08 08 118 03 3 119 42 STO 120 00 00 121 29 CP 122 73 RC* 123 07 07 124 67 EQ 125 01 01 126 35 35 127 43 RCL 128 07 07 129 44 SUM 130 10 10 131 72 ST* 132 08 08 133 69 OP 134 28 28 135 69 OP 136 27 27 137 97 DSZ 138 00 00 139 01 01 140 22 22 141 03 3 142 42 STO 143 00 00 144 73 RC* 145 07 07 146 67 EQ 147 01 01 148 57 57 149 43 RCL 150 07 07 151 72 ST* 152 08 08 153 69 OP 154 29 29 155 69 OP 156 28 28 157 69 OP 158 27 27 159 97 DSZ 160 00 00 161 01 01 162 44 44 163 03 3 164 32 X#T 165 53 ( 166 43 RCL 167 08 08 168 75 - 169 01 1 170 01 1 171 54 ) 172 22 INV 173 67 EQ 174 00 00 175 97 97 176 43 RCL 177 09 09 178 32 X#T 179 67 EQ 180 00 00 181 97 97 182 09 9 183 48 EXC 184 10 10 185 22 INV 186 44 SUM 187 10 10 188 01 1 189 94 +/- 190 22 INV 191 39 COS 192 52 EE 193 22 INV 194 52 EE 195 42 STO 196 00 00 197 00 0 198 67 EQ 199 03 03 200 02 02 201 02 2 202 67 EQ 203 03 03 204 37 37 205 29 CP 206 73 RC* 207 10 10 208 67 EQ 209 04 04 210 27 27 211 43 RCL 212 11 11 213 42 STO 214 10 10 215 43 RCL 216 12 12 217 42 STO 218 08 08 219 43 RCL 220 13 13 221 42 STO 222 07 07 223 03 3 224 22 INV 225 44 SUM 226 13 13 227 44 SUM 228 10 10 229 44 SUM 230 08 08 231 53 ( 232 73 RC* 233 11 11 234 33 X^2 235 85 + 236 73 RC* 237 12 12 238 33 X^2 239 75 - 240 02 2 241 65 * 242 73 RC* 243 11 11 244 65 * 245 73 RC* 246 12 12 247 65 * 248 73 RC* 249 07 07 250 39 COS 251 54 ) 252 34 SQR 253 72 ST* 254 13 13 255 71 SBR 256 02 02 257 74 74 258 53 ( 259 43 RCL 260 00 00 261 75 - 262 73 RC* 263 10 10 264 75 - 265 73 RC* 266 07 07 267 54 ) 268 72 ST* 269 08 08 270 86 STF 271 00 00 272 00 0 273 92 RTN 274 53 ( 275 53 ( 276 73 RC* 277 12 12 278 33 X^2 279 85 + 280 73 RC* 281 13 13 282 33 X^2 283 75 - 284 73 RC* 285 11 11 286 33 X^2 287 54 ) 288 55 / 289 02 2 290 55 / 291 73 RC* 292 12 12 293 55 / 294 73 RC* 295 13 13 296 54 ) 297 22 INV 298 39 COS 299 72 ST* 300 10 10 301 92 RTN 302 04 4 303 42 STO 304 10 10 305 71 SBR 306 02 02 307 74 74 308 05 5 309 42 STO 310 10 10 311 43 RCL 312 11 11 313 48 EXC 314 13 13 315 48 EXC 316 12 12 317 42 STO 318 11 11 319 71 SBR 320 02 02 321 74 74 322 53 ( 323 43 RCL 324 00 00 325 75 - 326 43 RCL 327 04 04 328 75 - 329 43 RCL 330 05 05 331 54 ) 332 42 STO 333 06 06 334 61 GTO 335 02 02 336 70 70 337 53 ( 338 01 1 339 05 5 340 75 - 341 43 RCL 342 12 12 343 75 - 344 43 RCL 345 13 13 346 54 ) 347 42 STO 348 07 07 349 53 ( 350 43 RCL 351 00 00 352 75 - 353 73 RC* 354 12 12 355 75 - 356 73 RC* 357 13 13 358 54 ) 359 72 ST* 360 07 07 361 53 ( 362 43 RCL 363 11 11 364 42 STO 365 12 12 366 85 + 367 01 1 368 75 - 369 53 ( 370 40 INT 371 55 / 372 04 4 373 54 ) 374 59 INT 375 65 * 376 02 2 377 54 ) 378 42 STO 379 13 13 380 42 STO 381 07 07 382 03 3 383 44 SUM 384 12 12 385 44 SUM 386 07 07 387 71 SBR 388 04 04 389 12 12 390 53 ( 391 06 6 392 75 - 393 43 RCL 394 11 11 395 75 - 396 43 RCL 397 13 13 398 54 ) 399 42 STO 400 13 13 401 42 STO 402 07 07 403 03 3 404 44 SUM 405 07 07 406 71 SBR 407 04 04 408 12 12 409 61 GTO 410 02 02 411 70 70 412 53 ( 413 73 RC* 414 07 07 415 38 SIN 416 55 / 417 73 RC* 418 12 12 419 38 SIN 420 65 * 421 73 RC* 422 11 11 423 54 ) 424 72 ST* 425 13 13 426 92 RTN 427 43 RCL 428 13 13 429 42 STO 430 11 11 431 53 ( 432 01 1 433 05 5 434 75 - 435 43 RCL 436 13 13 437 75 - 438 43 RCL 439 10 10 440 54 ) 441 42 STO 442 12 12 443 42 STO 444 07 07 445 43 RCL 446 10 10 447 42 STO 448 08 08 449 03 3 450 22 INV 451 44 SUM 452 11 11 453 22 INV 454 44 SUM 455 12 12 456 22 INV 457 44 SUM 458 08 08 459 73 RC* 460 11 11 461 32 X#T 462 73 RC* 463 12 12 464 22 INV 465 77 GE 466 04 04 467 70 70 468 86 STF 469 01 01 470 53 ( 471 73 RC* 472 12 12 473 55 / 474 73 RC* 475 11 11 476 65 * 477 73 RC* 478 13 13 479 38 SIN 480 54 ) 481 22 INV 482 38 SIN 483 72 ST* 484 07 07 485 53 ( 486 43 RCL 487 00 00 488 75 - 489 73 RC* 490 13 13 491 75 - 492 73 RC* 493 07 07 494 54 ) 495 72 ST* 496 10 10 497 53 ( 498 73 RC* 499 10 10 500 38 SIN 501 55 / 502 73 RC* 503 13 13 504 38 SIN 505 65 * 506 73 RC* 507 11 11 508 54 ) 509 72 ST* 510 08 08 511 22 INV 512 87 IFF 513 01 01 514 02 02 515 70 70 516 86 STF 517 00 00 518 00 0 519 35 1/X 520 02 2 521 92 RTN 522 22 INV 523 86 STF 524 01 01 525 53 ( 526 43 RCL 527 00 00 528 75 - 529 73 RC* 530 07 07 531 54 ) 532 72 ST* 533 07 07 534 61 GTO 535 04 04 536 85 85