EXC/ x<>Rn for stack efficiency

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 

« Next Oldest  Next Newest »

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