EXC/ x<>Rn for stack efficiency
06-17-2017, 12:49 PM
Post: #34
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: EXC/ x<>Rn for stack efficiency
(06-16-2017 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 ----------------------   y        arctan(y/x)   x        √(x² + y²)

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 »

 Messages In This Thread EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-11-2017, 08:58 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-11-2017, 10:07 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-11-2017, 10:23 PM RE: EXC/ x<>Rn for stack efficiency - Paul Dale - 06-11-2017, 11:08 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-11-2017, 11:57 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-12-2017, 12:08 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-12-2017, 07:48 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-12-2017, 08:51 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-11-2017, 11:54 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-12-2017, 03:50 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-13-2017, 07:26 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-14-2017, 10:19 AM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-14-2017, 06:39 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-14-2017, 07:38 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-14-2017, 08:46 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-14-2017, 09:40 PM RE: EXC/ x<>Rn for stack efficiency - Paul Dale - 06-14-2017, 10:36 AM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-14-2017, 03:04 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-14-2017, 06:23 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-14-2017, 11:31 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-15-2017, 09:01 AM RE: EXC/ x<>Rn for stack efficiency - Paul Dale - 06-15-2017, 09:09 AM RE: EXC/ x<>Rn for stack efficiency - SlideRule - 06-16-2017, 12:39 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-16-2017, 06:59 PM RE: EXC/ x<>Rn for stack efficiency - rprosperi - 06-16-2017, 09:12 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-17-2017, 07:17 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-15-2017, 11:05 AM RE: EXC/ x<>Rn for stack efficiency - Paul Dale - 06-15-2017, 10:29 AM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-16-2017, 06:32 PM RE: EXC/ x<>Rn for stack efficiency - Paul Dale - 06-17-2017, 06:03 AM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-17-2017, 11:46 AM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-17-2017 12:49 PM RE: EXC/ x<>Rn for stack efficiency - Paul Dale - 06-18-2017, 12:59 AM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-15-2017, 05:28 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-16-2017, 02:57 AM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-16-2017, 05:25 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-17-2017, 05:38 PM RE: EXC/ x<>Rn for stack efficiency - Dieter - 06-17-2017, 06:10 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-17-2017, 08:00 PM RE: EXC/ x<>Rn for stack efficiency - GrampaDave - 06-19-2017, 05:44 PM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-27-2017, 09:42 PM RE: EXC/ x<>Rn for stack efficiency - Thomas Okken - 06-28-2017, 12:42 AM RE: EXC/ x<>Rn for stack efficiency - Matt Agajanian - 06-28-2017, 01:37 AM RE: EXC/ x<>Rn for stack efficiency - Thomas Klemm - 07-20-2022, 07:03 PM

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