HP RPN stack permutations graph



#16

Hello happy few,

After reading – very lately, I confess - the excellent French book « Programmer HP-41 » published in the 80’s, I decided to redraw the « Logigraphe » of page 41, very confused to everyone, even to French people (yes, it’s possible).

The « Logigraphe » is the graph of all permutations available in the RPN (4 elements) stack, a very useful tool to anyone who wants to program a calc from HP-65 to 16c model. You can view and read the original document here:

Link to Programmer HP-41's PDF version

Using this strange map is simple : focus on the beginning of the graph, search for the aimed combination, and find the shortest path using Rd, x<->y, etc.

Nevertheless in these ancient times without OpenOffice, drawing a good graph was not easy, and this document appears 30 years later a bit old-fashioned. By thanking the two writers P. Descamps & J.-J. Dhénin for this wonderful book and their precious work, I chose to publish this new graph (a flattened truncated octahedron) which will be perhaps useful to some people, at least in this museum.


Here it is :


HP RPN stack permutations graph PDF version

For any OpenOffice version, please mail me.

Many thanks to Luiz C. Vieira for his HP fonts.

Xavier

Post Scriptum : I didn’t read every documentation about it (!), and perhaps this graph is a very old idea published already in some country… In this case, I do apologize for this wasted time of reading.
If not, maybe that a further step in this direction (in my humble opinion) would be an HP-41 program to inform the shortest path for any permutation combining the 4-elements stack plus the L register : the 120 permutations are by far too many for a simple 2D-graph.


#17

Excellent idea, I'll try to do 35s version adding Lastx and xyzt stack commands.

#18

This reminds me of a command I had in the WP-34s for a while.

    SHFL abcde

Where a, b, c, d & e are all from the set { X, Y, Z, T, L } allowing duplication.

This command shuffled the stack and LastX register in any permutation. For example:

  • SHFL YXZTL was X<>Y
  • SHFL YZTXL was Rv
  • SHFL TXYZL was R^
  • SHFL LXYZL was LastX
  • SHFL XXXXL was FILL

Anyway, these examples ought to give an idea of the kinds of things that were possible.


- Pauli


#19

Now imagine that for an 8-level stack [:-)


#20

We didn't have an eight level stack nor plans for one then :-)

- Pauli

#21

Quote:
Now imagine that for an 8-level stack [:-)

Poor fellow that gets the assignement to draw that graph!

;^)

#22

The nice bit about the stack shuffle is that the graph becomes very simple. Everything is one step away from the initial stack state.

- Pauli


#23

But will such a command fit our op code scheme? I doubt it. And what do you do if the stack depth is set to 4 and you encounter a command that treats all 8 or 9 registers? What about complex mode?

If we could ignore LastX and allow shuffling of ABCD in any mode, things become easier. Then we only need an abbreviated notation so that only registers which are to be affected are named such as SHFL ZXY. This would leave T, A, B, C and D alone. We would still need 3 bits per register in eight positions, totaling 24 bits for every possible combination.

Edited: 19 May 2011, 5:47 a.m.


#24

There were only four stack levels plus last x when I implemented this and 5^5 fitted easily. I even contemplated allowing 0 as well :-)

- Pauli

#25



Interestingly, already in the "HP-45 Applications Book" a Section "Stack Register Operations" describes how to manipulate the stack.

It has not the nice graphical representation but shows the keystrokes to be applied, and also interestingly, what HP considered to be noteworthy:



  • Clear stack
  • Delete x
  • Delete y
  • Reverse the stack
  • Fetch t or roll up
  • Fetch t to Y
  • Fetch z
  • Copy x into Z and T
  • Copy y into Z
  • Copy y into Z and T
  • Copy y and x into Z and T respectively
  • Copy y and x into T and Z respectively
  • Swap x and rk [k: number of storage register]
  • Swap y and z
  • Swap z and t
  • Swap x and t
  • Swap x and z
  • Swap y and t

#26

Hi,

Has anybody seen John Ball's book, "Algorithms for RPN Calculators"? It has a stack-permutations chart in there that is at least 30 pages long for RPN permutations related to machines from the "Classic Series" era.

Jake


#27

I believe I have a copy.

#28

Agree with Jake. Ball was the "Donald Knuth" of HP stack permutations.


#29

Thank you for all your comments. I shall have a look at those books.

Edited: 20 May 2011, 5:38 p.m.

#30

Quote:
Has anybody seen John Ball's book, "Algorithms for RPN Calculators"?

check this out: TAS offer

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP 50g - select characters on the stack, copy/paste Sean Freeman 7 1,130 11-20-2013, 07:11 AM
Last Post: Sean Freeman
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 856 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  emu48 - copy stack doesn't work (as expected) Thomas Radtke 2 830 11-11-2013, 02:19 PM
Last Post: Thomas Radtke
  HP Prime Stack operations from within a program John Colvin 1 580 11-08-2013, 09:45 PM
Last Post: Helge Gabert
  [PRIME] RPN: another attempt at returning more than one value to the RPN stack Marcus von Cube, Germany 5 1,031 11-05-2013, 02:44 AM
Last Post: Marcus von Cube, Germany
  Prime: Anyway to refresh stack? kris223 5 892 10-16-2013, 05:09 PM
Last Post: kris223
  hp prime - sending program results to the stack giancarlo 6 968 10-15-2013, 02:00 AM
Last Post: Giancarlo
  Sending from graph to home or CAS screen Richard Berler 6 1,019 10-06-2013, 03:29 PM
Last Post: Tim Wessman
  HP Prime - RPN stack access from programs? Mike Mander (Canada) 10 1,168 09-30-2013, 11:20 AM
Last Post: steindid
  WP-34S: Stack after divide by 0 Marcel Samek 4 612 08-24-2013, 11:57 PM
Last Post: Paul Dale

Forum Jump: