Re: Program format from 33s to 35s Message #2 Posted by Karl Schneider on 15 Sept 2007, 6:31 p.m., in response to message #1 by romeo_charlie
Welcome, Rafael!
Quote:
Unfortunately, I am just an airline pilot, and am no computer or math expert.
Certainly no need to be humble about that...
Quote:
Now, I have just bought a 35s, and have found that the polar to rectangular conversion just doesnt work the same way (as it did in the HP33s).
Yes, this has been source of considerable consternation in this group. I belive that it was a horrible idea.
I've also had to deal with that same issue while porting my HP32S/32SII/33s program to the HP35s. The basic problem is that while "Th,r>y,x" and "y,x>Th,r" utilize only two stack registers, the conversion procedures that would be employed on the HP35s almost always require more. This might cause the program to fail, by causing stack overload.
If the program were optimized for the HP35s, many of the conversions could be eliminated, with calculations done using complex numbers in polar mode. But that would take some effort.
Polar to rectangular:
I replaced "Th,r>y,x" with code that used all four stack registers.
(magnitude)
ENTER
ENTER
(angle value)
ENTER
SIN
x<>y
COS
Roll_up
* (result is xcoordinate)
Roll_down
* (result is ycoordinate)
For twolevel calculations, an alternative is to store results and inputs to lettered registers, then recall them as necessary:
(magnitude)
STO M
(angle value)
STO A
SIN
* (result is ycoordinate)
x<> M
RCL A
COS
* (result is xcoordinate)
RCL M (result is ycoordinate)
Rectangular to polar:
The difficulty is that ARG (or conversion to polar representation of a complex number) is the only way to access the "atan2" function, which gives the proper quadrant of the angle  very important in navigation.
Using complexvalued functions, with one extra stack register:
(xcoordinate)
(ycoordinate)
i
*
+
ENTER
ABS (result is magnitude)
x<>y
ARG (result is angle value)
To use only two stack registers will require a storage register and a bit more thought...
Quote:
I hope I am not bothering the audience with my ignorance about HP calculators.
Thanks in advance for any help.
Not at all; our pleasure.
 KS
Edited: 15 Sept 2007, 6:50 p.m.
