Post Reply 
50G RPL Question
07-20-2021, 12:54 PM
Post: #1
50G RPL Question
I thought, at one point, I ran across a 50G RPL command to convert an algebraic equation to an RPL program. I spend some time looking through the AUR, and couldn't find the command. Does this command exist, or was I dreaming?
Find all posts by this user
Quote this message in a reply
07-20-2021, 02:07 PM
Post: #2
RE: 50G RPL Question
Hello David,

you aren't dreaming, have a look to AUR: RPL Programming Examples 2-27; Headline:
"Converting Procedures from Algebraic to RPN". There you get what you want! TYGWYW.

Sincerely peacecalc
Find all posts by this user
Quote this message in a reply
07-20-2021, 05:36 PM
Post: #3
RE: 50G RPL Question
Great, that was exactly what I was looking for. Thanks!
Find all posts by this user
Quote this message in a reply
07-20-2021, 06:50 PM
Post: #4
RE: 50G RPL Question
There is also a built-in command which converts algebraic objects into RPN form as a list, and another which converts them into RPN form as a program. They are in Library 256, so unless you keep that library attached, you'll have to do 256 ATTACH before using these commands, or type 256 MENU and access these functions via their softkeys. Examples:

'1+2*3' →LST --> { 1 2 3 * + }
'1+2*3' →PRG --> 1 2 3 * + (the program delimiters are invisible)

The function →ALG turns both of the above outputs back into an algebraic object. Warning: The →ALG command does not check to see if its input produces a valid algebraic object. Use with caution, and if the result looks like 'Invalid Expression' then beware that executing it can crash or cause memory corruption.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
07-20-2021, 07:03 PM (This post was last modified: 07-20-2021 07:08 PM by Han.)
Post: #5
RE: 50G RPL Question
For those looking for a solution on the HP48G series, if you type in TEACH it loads some sample programs (among other things). In the EXAMPLES PRGS subdirectory is a program called →RPN which does exactly what the name suggests. (You enter an algebraic object and it converts it to an RPN list)

Code:
« OBJ→
  IF OVER
  THEN → n f
    « 1 n
      FOR i
        IF DUP TYPE 9 SAME
        THEN →RPN
        END n ROLLD
      NEXT
      IF DUP TYPE 5 ≠
      THEN 1 →LIST
      END
      IF n 1 >
      THEN 2 n
        START +
        NEXT
      END f +
    »
  ELSE 1 →LIST SWAP DROP
  END
»

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
07-21-2021, 02:52 AM
Post: #6
RE: 50G RPL Question
This is really great, thanks for this information! And thanks to OP for making the thread. I wanted to do this for a while but never managed to make my way through the AUR.
Find all posts by this user
Quote this message in a reply
07-21-2021, 02:59 AM
Post: #7
RE: 50G RPL Question
Joe-I think that's the solution that I had in mind, it was a single command. The ->RPN program will also work, without those libraries attached.
Thanks!
Find all posts by this user
Quote this message in a reply
07-25-2021, 03:20 PM
Post: #8
RE: 50G RPL Question
If you wish to have the program delimiters included, the following adds those to the beginning and end of the program:
Code:
\<<
   \->LST
   \<< \>> \->LST LIST\-> DROP
   ROT SWAP
   + +
   \->PRG
\>>

Likewise, the following converts a program object with the program delimiters back into an algebraic:
Code:
\<<
   \->LST
   DUP SIZE 1. -
   2. SWAP SUB
   \->ALG
\>>

Joe's warning still applies -- watch out for 'Invalid Expression'.
Find all posts by this user
Quote this message in a reply
Post Reply 




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