Post Reply 
(35S) yet another R<>P Conversion
01-25-2015, 09:12 AM (This post was last modified: 06-15-2017 01:31 PM by Gene.)
Post: #1
(35S) yet another R<>P Conversion
I've posted this for Thomas (previous discussion today) but others especially new to the 35s might be interested: Yet another R<>P conversion routine. I'll put the codes first, and then the explanation of usage thereafter. Like I told Thomas, it makes no claims, is trivial, WORKS, and is just one example. There are scads of these (kinda fun to collect them) which beg the question, "why does the HP35s get such a pounding because it doesn't have any easy decomposition routines for R<>P?" Here is the code:

Code:


     P001  LBL  P
     P002  x<>  F      ; parameter for determining R<>P vs P<>R
     P003  CLx
     P004  -1             ; less than zero (default)   R<>P   X in x, Y in y
     P005  STOP         ; give the operator a chance to change the parm   use [+/-] key
     P006  x>0?         ; branch around R<>P routine
     P007  GTO  P023
     P008  x<>  F
     P009  STO  X       ; Entry Point  for  R<>P routine
     P010  x^2           ;    compute R value to be placed in y Y
     P011  x<>y
     P012  STO  Y
     P013  x^2
     P014  +
     P015  |x               ;     use square root key 
     P016  STO  R        ;    save R to R
     P017  RCL  Y         ;    compute theta ,   R is lifted to y
     P018  RCL  X         ;
     P019  /
     P020  ATAN
     P021  STO  A         ;     save theta in A   (P      y holds R,  x holds theta
     P022  RTN             ; END R<>P routine
     P023  x<>  F         ; Entry Point  P<>R routine
     P024  x<>y           ;                      might have been able to use REGx REGy here...
     P025  STO  R         ;        save R  from y
     P026  x<>y           ;
     P027  STO  A         ;        Save A (theta) from x
     P028  SIN
     P029  *                 ; multiply    compute y
     P030  STO  Y
     P031  RCL  R         ;
     P032  RCL  A         ;
     P033  COS
     P034  *                 ; multiply    compute x
     P035  STO  X
     P036  RTN             ; END P<>R routine   y holds Y,  x holds X


     LN=110     CK=0E3B


-

To use to convert R<>P (default) place Y in y, and place X in x, press [XEQ] [P] [ENTER]

Leave the (-1) default parm for R<>P mode and press [R/S]

y will hold R, x will hold theta (phase angle)


To use to convert P<>R place R in y, place theta (angle) in x, press [XEQ] [P] [ENTER]

Change (-1) to (1) with the [+/-] key and press [R/S]

y will hold Y, x will hold X


Also, after running this routine X, Y, R, and Theta will be in registers respectively: X, Y, R, A


This thing can be optimized and altered by using complex numbers and [ABS] with [ARG].

Also, the hidden codes REGx and REGy might be useful.

This is just one way to solve this problem, is easy, works, and is almost trivial all things considered. So, it eliminates one negative irk of the HP35s for some users. I don't know.

Enjoy
Smile

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
01-25-2015, 12:27 PM
Post: #2
RE: HP35s yet another R<>P Conversion
(01-25-2015 09:12 AM)MarkHaysHarris777 Wrote:  
Code:
     P017  RCL  Y         ;    compute theta ,   R is lifted to y
     P018  RCL  X         ;
     P019  /
     P020  ATAN

This won't work if X = 0.

Quote: This thing can be optimized and altered by using complex numbers and [ABS] with [ARG].

Also, the hidden codes REGx and REGy might be useful.

See: ->P and ->R conversions for the HP-35s in the Original Software Library.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
01-25-2015, 10:07 PM
Post: #3
RE: HP35s yet another R<>P Conversion
(01-25-2015 12:27 PM)Thomas Klemm Wrote:  See: ->P and ->R conversions for the HP-35s in the Original Software Library.

It is still difficult to go past these two community routines for these functions. They just work as expected in everything except last X.


- Pauli
Find all posts by this user
Quote this message in a reply
01-25-2015, 11:34 PM (This post was last modified: 01-25-2015 11:35 PM by MarkHaysHarris777.)
Post: #4
RE: HP35s yet another R<>P Conversion
(01-25-2015 12:27 PM)Thomas Klemm Wrote:  
Code:
     P017  RCL  Y         ;    compute theta ,   R is lifted to y
     P018  RCL  X         ;
     P019  /
     P020  ATAN
-

This won't work if X = 0.

See: ->P and ->R conversions for the HP-35s in the Original Software Library.

Yes, thank you! Well and good, and my bad too on another thing... I noticed that the routine really needs to decompose the complex (which mine does not yet) ... maybe later tonight.

(01-25-2015 10:07 PM)Paul Dale Wrote:  It is still difficult to go past these two community routines for these functions. They just work as expected in everything except last X.

Paul, how do you want LASTx to work with this type of routine; which LASTx should be left in the LASTx register. i know the definition of "value of x just before the last operation" but that definition really depends on the *operations* defined for LASTx. I can think of several ways to make sense of LASTx with a complex decomposition routine. Just wondering what your take was. Thanks.

Smile

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
01-25-2015, 11:39 PM
Post: #5
RE: HP35s yet another R<>P Conversion
(01-25-2015 11:34 PM)MarkHaysHarris777 Wrote:  Paul, how do you want LASTx to work with this type of routine; which LASTx should be left in the LASTx register. i know the definition of "value of x just before the last operation" but that definition really depends on the *operations* defined for LASTx. I can think of several ways to make sense of LASTx with a complex decomposition routine. Just wondering what your take was. Thanks.

I think this nails does the reasoning for not doing it pretty well.


Pauli
Find all posts by this user
Quote this message in a reply
01-26-2015, 12:38 AM
Post: #6
RE: HP35s yet another R<>P Conversion
(01-25-2015 11:39 PM)Paul Dale Wrote:  
(01-25-2015 11:34 PM)MarkHaysHarris777 Wrote:  Paul, how do you want LASTx to work with this type of routine; which LASTx should be left in the LASTx register. i know the definition of "value of x just before the last operation" but that definition really depends on the *operations* defined for LASTx. I can think of several ways to make sense of LASTx with a complex decomposition routine. Just wondering what your take was. Thanks.

I think this nails does the reasoning for not doing it pretty well.

Pauli

hihi LOL... knew that was coming...

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
Post Reply 




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