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
Post Reply 


Messages In This Thread
(35S) yet another R<>P Conversion - MarkHaysHarris777 - 01-25-2015 09:12 AM



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