EXC/ x<>Rn for stack efficiency

06152017, 09:01 AM
(This post was last modified: 06152017 10:36 AM by Dieter.)
Post: #21




RE: EXC/ x<>Rn for stack efficiency
(06142017 11:31 PM)Matt Agajanian Wrote: Great Circle Navigation This is a classic example for what I said earlier. Try to understand how the program works and recode it. This will for instance show that the complete routine in the first steps (which is called several times as SBR 00) is obsolete since it does a simple d.ms to decimal degrees conversion (e.g. it turns 42°50' into 42,8333°). The 25 and 33 have a dedicated function for this. Regarding the EXC instruction: that's obsolete as well. Take a look at the code. In line 84/85 an inverse cosine is calculated and stored in R2 while the previous content oF R2 is recalled and checked whether its sine is > 0. If not, 360 minus the previous result is returned. You could replace the EXC instruction with the code in my first post, so a literal translation would look this way: Code: ... But this is not required. In RPN this can be done more elegantly since the previous result is still on the stack: Code: ... The complete program can be turned into a more compact HP25/33 version. But I am sure that HP25 great circle programs already exist. ;) Edit: a direct translation of the 100step SR56 program is hard to do in 49 steps. However, if the final 360–x procedure is omitted it will fit. Otherwise a few more steps are required. Edit2: I see the SR56 program calculates the great circle distance in nautical miles which is diplayed in step 62. But what is the angle that is calculated afterwards and returned as the second result? Matt, can you post the instructions and an example for this program? Dieter 

06152017, 09:09 AM
Post: #22




RE: EXC/ x<>Rn for stack efficiency  
06152017, 10:29 AM
Post: #23




RE: EXC/ x<>Rn for stack efficiency
It ought to be possible to calculate the distance using the modified Vincenty formula on the 25:
>P will calculate the square root of the sum of squares in the numerator and >R will calculate the arctangent of the ratio.  Pauli 

06152017, 11:05 AM
(This post was last modified: 06172017 07:23 PM by Dieter.)
Post: #24




RE: EXC/ x<>Rn for stack efficiency
(06142017 11:31 PM)Matt Agajanian Wrote: General Aircraft Weight and Balance A strange program – I'm not sure at all what it does. But there are lots of EXC instructions between line 10 and 27. There are even consecutive EXC commands that neutralize each other. #) If you take a closer look at this you will realize that the sequence with all these obscured EXC commands simply does this: Store an entry in R4, then check if R0 is zero. If yes, add the previous entry to R2, otherwise add R3*entry to R2. At the end R0 is left unchanged. Of course this can be coded much more effectively and simpler: Code: ... That's shorter and less obscure. BTW, the STO 4 is not required, neither in the SR56 program nor in the translation above: R4 is not used elsewhere in the program. Edit: the instructions for this program say that the previous entry may be recalled by RCL 4, e.g. for correcting the last entry, so this is the reason why the input is stored in R4 although this register is not recalled in the program itself. While I am still not sure what the program is supposed to do (what are these 3, 4 and 5 prompts for?) I think it can be done in 30 steps on an HP25 or 33. Or three more if the program initially resets R1 and R2 to zero, which I think it should do. Here is an experimental, completely untested first attempt at this: Code: 01 STO 0 And finally in the original SR56 program all these obscure EXCsequences could be avoided like this: Code: ... That's even four steps shorter. Dieter 

06152017, 05:28 PM
(This post was last modified: 06152017 05:29 PM by Matt Agajanian.)
Post: #25




RE: EXC/ x<>Rn for stack efficiency
Dieter,
Thanks for the extra effort. Although I started challenging myself to translate my SR56 programs into RPN since I got an HP34C and TI58C in '78, (already had an SR56 in 77) yes it was more of a part of my hobby to translate these just for the challenge and to engulf myself in my hobby. I would opt for the opportunity to test myself and translate rather than make it easier to find an identical/similar program in an HP solution book/application library instead. Creature of old habits in Pasadena. 

06162017, 02:57 AM
Post: #26




RE: EXC/ x<>Rn for stack efficiency
Dieter, here are the App Library pages to complete the documentation.
Great Circle Navigation (Intro page) Great Circle Navigation (User Instructions) Great Circle Navigation (example) 

06162017, 12:39 PM
Post: #27




RE: EXC/ x<>Rn for stack efficiency
(06152017 09:01 AM)Dieter Wrote: ... post the instructions and an example... The source can also be viewed at V. Toth's TI site under the subheading SR56 Applications at pages; T to π & π to T Transformations (142147) Great Circle Navigation (159162) General Aviation Weight & Balance (176179) BEST! SlideRule 

06162017, 05:25 PM
Post: #28




RE: EXC/ x<>Rn for stack efficiency
Yes, I know. Rather than have members scroll through 100+ pages in the PDF there, I took a snapshot of the pages directly from my Dropbox folder.


06162017, 06:32 PM
Post: #29




RE: EXC/ x<>Rn for stack efficiency
(06152017 10:29 AM)Paul Dale Wrote: It ought to be possible to calculate the distance using the modified Vincenty formula on the 25: So, Pauli, If I were to use this formula correctly, what are the inputs for the >P and >R operations? It seems obvious, but to avoid mistakes, how should I interpret the X and Y registers for both >P and >R operations? Thanks. 

06162017, 06:59 PM
Post: #30




RE: EXC/ x<>Rn for stack efficiency
(06162017 12:39 PM)SlideRule Wrote: The source can also be viewed at V. Toth's TI site under the subheading Ah, great – thank you very much. It's a real flashback to the early times of programmable calculators. A program for solving linear equations with two unknowns that flashes "SOS" (i.e. 505) when the determinant is zero, a quadratic solver where the program works slightly different from what the instructions say, prompting for input data by displaying "1", "2" and "3", the choice of simplified algorithms that fit into merely 100 unmerged steps... those were the days. ;) Dieter 

06162017, 09:12 PM
Post: #31




RE: EXC/ x<>Rn for stack efficiency
(06162017 06:59 PM)Dieter Wrote: It's a real flashback to the early times of programmable calculators. A program for solving linear equations with two unknowns that flashes "SOS" (i.e. 505) when the determinant is zero, a quadratic solver where the program works slightly different from what the instructions say, prompting for input data by displaying "1", "2" and "3", the choice of simplified algorithms that fit into merely 100 unmerged steps... those were the days. ;) The thing about nostalgia is we always remember things better or worse than they really were. It's just hard to tell which applies here... Bob Prosperi 

06172017, 06:03 AM
Post: #32




RE: EXC/ x<>Rn for stack efficiency
(06162017 06:32 PM)Matt Agajanian Wrote: So, Pauli, If I were to use this formula correctly, what are the inputs for the >P and >R operations? It seems obvious, but to avoid mistakes, how should I interpret the X and Y registers for both >P and >R operations? Thanks. I'd recommend reading the manual for a RPN calculator Pauli 

06172017, 11:46 AM
(This post was last modified: 06172017 11:47 AM by Dieter.)
Post: #33




RE: EXC/ x<>Rn for stack efficiency
(06172017 06:03 AM)Paul Dale Wrote: I'd recommend reading the manual for a RPN calculator That's always a good advice. ;) (06152017 10:29 AM)Paul Dale Wrote: >P will calculate the square root of the sum of squares in the numerator and >R will calculate the arctangent of the ratio. I'd say that >P calculates both the sqrt of the sum of squares and the arctan of the ratio. Dieter 

06172017, 12:49 PM
Post: #34




RE: EXC/ x<>Rn for stack efficiency
(06162017 06:32 PM)Matt Agajanian Wrote: So, Pauli, If I were to use this formula correctly, what are the inputs for the >P and >R operations? It seems obvious, but to avoid mistakes, how should I interpret the X and Y registers for both >P and >R operations? Thanks. This is a basic info which you will find in any manual of you RPN calculators. However, in this case the >R function is not required, instead >P does both calculations. The >P function takes two rectangular coordinates in X and Y and converts them to polar coordinates, i.e. a distance and an angle: Code: input output Now take a look at the nominator of the posted formula. There are two terms that are squared and then the sqrt of the sum is calculated. That's exactly what the >P function returns in X. Try 3 ENTER 4 and a simple >P returns 5, which is shorter and faster than 3 x² 4 x² + √. Then take a look at the whole fraction. The arctangent of a quotient has to be calculated. That's what the >P function returns in Y. Actually the result may be slightly different from a simple arctan(y/x) as there is a certain sign convention for the angle, but let's neglect this here. So you may calculate the two terms under the square root in the nominator first (without squaring them), then >P returns the result of the complete nominator. Then calculate the denominator (with the previous result still in y) and another >P returns the arctan of the quotient in Y. Since >P x<>y is not shorter than a division and arctan (two steps in both cases) the only advantage of the >P method may be that if the denominator is negative the returned angle is positive: arctan(1/–1) returns –45° while 1 ENTER –1 >P yields +135°. Dieter 

06172017, 05:38 PM
Post: #35




RE: EXC/ x<>Rn for stack efficiency
I'm sorry. It seems my earler post was quite unclear.
Yes, I've rather aware that R>P operations return both numerator and denominator for the revised GCN formula. But, I intended to ask about the four latitude, longitude, and delta values. 

06172017, 06:10 PM
(This post was last modified: 06172017 06:11 PM by Dieter.)
Post: #36




RE: EXC/ x<>Rn for stack efficiency
(06172017 05:38 PM)Matt Agajanian Wrote: I'm sorry. It seems my earler post was quite unclear. Not quite. While R–>P can be used to calculate the nominator it does not help with the denominator. OTOH it can be used to determine the arctan of the quotient. (06172017 05:38 PM)Matt Agajanian Wrote: But, I intended to ask about the four latitude, longitude, and delta values. OK – sorry if I have to ask again, English is not my native language, but... what do you want to ask about these values? Phi1 and 2 are the two latitudes and Lambda1 and 2 are the longitudes, resp. ΔLambda their difference. Dieter 

06172017, 07:17 PM
(This post was last modified: 06172017 09:07 PM by Dieter.)
Post: #37




RE: EXC/ x<>Rn for stack efficiency
(06162017 09:12 PM)rprosperi Wrote: The thing about nostalgia is we always remember things better or worse than they really were. It's just hard to tell which applies here... While we're at it: Quote:"Herman the moonshiner makes a weekly delivery to the Hogs Haven Pub. Normally it takes 1 hour, 27 minutes, and 52 seconds to go from his still to Possum Flats and 2 hours, 3 minutes, and 17 seconds from there to Hogs Haven. How long does the trip take?" Ah, this sounds familiar. A short story that introduces a problem which is then solved by means of your new calculator. May this be a quote from the HP25 manual? Or from the 67's? You won't believe it, but this is the introduction to the hour, minute, second arithmetics program for the TI SR–56 (!). Obviously TI liked the HP style so much that they decided to do something similar in their own Applications Library manual. ;) Dieter 

06172017, 08:00 PM
Post: #38




RE: EXC/ x<>Rn for stack efficiency
(06172017 06:10 PM)Dieter Wrote:(06172017 05:38 PM)Matt Agajanian Wrote: I'm sorry. It seems my earler post was quite unclear. Thank you. Dieter, your language skills are excellent. It's my misunderstanding of the equation that caused confusion. Now I understand the variables. 

06182017, 12:59 AM
Post: #39




RE: EXC/ x<>Rn for stack efficiency
(06172017 12:49 PM)Dieter Wrote: However, in this case the >R function is not required, instead >P does both calculations. Oops Quote:Since >P x<>y is not shorter than a division and arctan (two steps in both cases) the only advantage of the >P method may be that if the denominator is negative the returned angle is positive: arctan(1/–1) returns –45° while 1 ENTER –1 >P yields +135°. There is also an advantage when the denominator is zero. This alone makes it worthwhile I think. Pauli 

06192017, 05:44 PM
Post: #40




RE: EXC/ x<>Rn for stack efficiency
Quote:Herman the moonshiner But HP had better names, whose sly humor made them memorable, at least to native English speakers. Radio Engineer Ann Tenor Arctic explorer JeanClaude Coulaire Logistics specialist Justin Tyme (I confess I made up that last one, but it's exactly in the HP style.) 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)