Program format from 33s to 35s - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Program format from 33s to 35s (/thread-124840.html) |
Program format from 33s to 35s - romeo_charlie - 09-15-2007 Hello all. I am new to this forum. I've been reading the posts for a ehile, and decided to go ahead and post my question. I am hoping to get some help from some of the experts whose messages I have been reaing recently. I used the program from Dave Coffin for the HP-33s for distance and bearing calculation. Now, I have just bought a 35s, and have found that the polar to rectangular conversion just doesnt work the same way. Unfortunately, I am just an airline pilot, and am no computer or math expert. I was hoping that someone could help me modify this program to make it work in the HP-35s, since replacing the critical lines (D08, D13, D16, D20, D25) by the routines I read about yesterday in this site dont make it work. Here's the Dave Coffin program:
D01 LBL D You enter initial Latitude and Longitude and Final Latitude and Longitude, and it returns the distance in nautical miles and true departure course to fly the great circle trajectory. I hope I am not bothering the audience with my ignorance about HP calculators. Thanks in advance for any help. Rafael.
Edited for grammar. Edited: 15 Sept 2007, 2:39 p.m.
Re: Program format from 33s to 35s - Karl Schneider - 09-15-2007 Welcome, Rafael!
Quote: Certainly no need to be humble about that...
Quote: 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 HP-32S/32SII/33s program to the HP-35s. 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 HP-35s almost always require more. This might cause the program to fail, by causing stack overload. If the program were optimized for the HP-35s, 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) For two-level calculations, an alternative is to store results and inputs to lettered registers, then recall them as necessary:
(magnitude) 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 complex-valued functions, with one extra stack register:
(x-coordinate) To use only two stack registers will require a storage register and a bit more thought...
Quote: Not at all; our pleasure. -- KS
Edited: 15 Sept 2007, 6:50 p.m.
Re: Program format from 33s to 35s - Jeff O. - 09-15-2007 Rafael, Rectangular to Polar
The original program you presented would appear as follows with these routines added as subroutines: D001 LBL D Of course it would be far better if the next version of the 35s looks like this: Edited to replace the original routines with Miguel's improved versions. Edited: 17 Sept 2007, 10:11 a.m. after one or more responses were posted
Re: Program format from 33s to 35s - for Jeff **CORRECTED** - Miguel Toro - 09-15-2007 Hello Jeff and welcome Rafael, Please see at this two versions for P->R and R->P, they are shorter and get the same result (they preserve the stack and LAST x), I think:
Polar to Rectangular Please tell me what you think. Regards, Miguel
Edited: 16 Sept 2007, 9:53 a.m. after one or more responses were posted
Re: Program format from 33s to 35s - for Jeff - Reth - 09-16-2007 Usage of ABS as first line makes both routines give wrong answer where DIST or Y-coord is negative. Also using equations implies taking into consideration status of flag 10.
Edited: 16 Sept 2007, 6:17 a.m.
Re: Program format from 33s to 35s - for Jeff - romeo_charlie - 09-16-2007 Thanks a lot for all for your quick replies to my message. I'll input your routines in the 25s and will perform some sample calculations. I will compare the calc returns to the correct answer and will let you know, since some have pointed out possible errors. Stay well.
Rafael.
Re: Program format from 33s to 35s - for Jeff - Maximilian Hohmann - 09-16-2007 Hello colleague!
Quote: I can tell you right now that you will not get any correct answer by trying to solve a spherical problem (= great circle navigation) by using a flat approach (i.e. using those built-in or homemade P/R conversions). It will work sufficiently well for very short distances only. You need to program the correct formulae instead (look here for example: http://en.wikipedia.org/wiki/Great-circle_distance ) if you want correct results. Anyway: Please don't tell me that you intend to navigate along great circle routes by typing co-ordinates into your pocket calculator (or that your employer allows you to do that!). Otherwise I will prefer to stay on the ground while you are up there ;-)
Happy landings, Re: Program format from 33s to 35s - for Jeff - Miguel Toro - 09-16-2007 Hi Reth, In the P->R procedure that is prevented thanks to the use of LASTx: the original value before the ABS is there. I corrected the R->P procedure to have the same behavior: the use of LASTx to recover the original value. You are right about the flag 10 and that will depend on the use of these routines in Rafael's program. Thanks, Miguel
Edited: 16 Sept 2007, 9:57 a.m.
Re: Program format from 33s to 35s - for Jeff - romeo_charlie - 09-16-2007 Quote: Max! Nah, dont worry! I trust our two good old million-dollar Honeywell FMS's, along with our three laser gyro IRS's on board for actual navigation over the atlantic in the Airbus. If those fail, there is a completely detailed procedure for that. This is just a little hobby I got going, and since I already succeeded solving spherical trigonometry ecuations in the older and bigger HP-48sx for the calculation of the great circle distances and angles, I wanted to approach this problem in the smaller HP-35s. It's spherical triangle ecuations you got me working on "as we speak", but as I said, I'm no computer expert and it's hard. Happy landings to all,
Rafael.
Re: Program format from 33s to 35s - Paul Dale - 09-16-2007 For a long article on rectangular to polar conversions look at this discussion. By the end, the programs for doing the conversion were pretty good. I've submitted the "best" to the museum for inclusion in the software library. I've also included them here:
P001 LBL P Both routines preserve the Z and T registers and return their results in the X and Y registers. The are also independent of the settings on the calculator and honour the current trig mode.
- Pauli
Re: Program format from 33s to 35s - for Jeff **CORRECTED** - Jeff O. - 09-16-2007 Quote:I think I like them better than my versions. Nice work! |