Info:
SSA2
an add on program for QTS to calculate the 2nd solution of a triangle,
available as a stand alone UserRPL program or already included into the
QTSv21 library.


Hi,
I use QTS from Othniel Rawlins to calculate triangles.

If in a triangle side1, side2 and angle1 (opposite side1) are given
this case is entered (clock or counterclockwise) in QTS:

For example:
Side1=1
Side2=2
Angle1=10

This example would be entered  1 2 10 and SSA pressed/typed in.
QTS lacks the abbility to find a second solution if one exists.
If Side1<Side2 there is a second solution.

To calculate the second solution I wrote SSA2, a little User-RPL program.
Transfer it via kermit to your HP48.

Input is like the input for QTS:

Enter the three values you know clock or counterclockwise and press the
corresponding key (SSS, SSA, SAS, SAA, ASA) and to search for a possible
second solution in the SSA case make the input (I recommend to type for example:
1 2 10 - separated by spaces. That way you can recall the input via the
CMD key) and press/type SSA2.

QTS and SSA2 handle all possible cases correct, but will not error check the
input/output. If that would be done the program would need more memomry. Since the
output is obvious not possible in such cases I have deceided not to check for
this!

If no second solution exists SSA2 will drop the input and a message will appear.
If an error occurs (because of *false* input) the input will also be dropped and
a message is shown.
If you make an invalid input you will just get an obvious wrong answer:

Examples:
1 2 10 SSA2	(S3:1.03  A2:159.68  A3:10.32) Second solution!

2 1 10 SSA2	(input dropped (and message: *no second solution* in the add on version only)
1 2 50 SSA2 	(input is dropped, because there is no solution)
1 2 150 SSA2	(S3: -1.73  A2:90  A3:-60) This is obvious not possible!
5 7 5000 SSA2	(S3:3.18  A2:244.15 A3: -5064.15) Also obvious senseless as input!
1 2 30 SSA2	(S3: 1.73  A2:90  A3:60) This answer is correct, although it's not
		really a second solution. SSA will give the same answer for a
		right triangle.

QTS example:
4 8 12 SSS	(A1=A2=0 A3=180) also senseless...

Just for those who are interested in the formula SSA2 uses:

A3=asin(sin(A1)*S2/S1)-A1

A2=180 (or pi) - A1-A3

S3=sin(A3)/sin(A1)*S1


You can choose to install the original version of QTS2.1 and add the following
program SSA2 to your HOME dir, or you can just use my hacked version
- called QTS21P.lib - which already includes SSA2.
(In this version there are no messages, because as explained above you'll see
when an answer is obvious wrong and I saved the space for this unneccessary messages
to keep the lib as small as possible)

And here the program itself:


%%HP: T(3)A(D)F(.);
\<<
  IFERR
    IF OVER 4 PICK
>
    THEN ROT ROT
OVER / 3 PICK SIN *
ASIN 3 PICK - angl
CONST OVER - 4 PICK
- OVER SIN 5 ROLL
SIN / 4 ROLL * S3
\->TAG SWAP "\<)2" \->TAG
ROT "\<)3" \->TAG
    ELSE
      DO
"NO 2nd SOLUTION" 1
DISP
      UNTIL KEY
      END 4 DROPN
    END
  THEN 5 DROPN
    DO
"NO SOLUTION" 1
DISP
    UNTIL KEY
    END DROP
  END
\>>



Enjoy!

12.01.99
Peter Karp
karpfenteich@gmx.de

P.S.: Do you know the great Frequently Asked Questions?
http://www.engr.uvic.ca/~aschoorl/faq/
and the superb HP48 Software Archive?
http://hp48.ml.org
