4-level stack manipulation on 12c
|
03-02-2015, 03:18 AM
Post: #1
|
|||
|
|||
4-level stack manipulation on 12c
If my 4-level stack on my 12c contains:
t - don't care z - don't care y - 17 x - 5 and I want it to contain: t - 17 z - 5 y - 17 x - 5 is there an elegant way to achieve that using only ENTER, roll down, and x<->y? |
|||
03-02-2015, 03:40 AM
(This post was last modified: 03-02-2015 03:40 AM by Mark Hardman.)
Post: #2
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 03:18 AM)Don Shepherd Wrote: If my 4-level stack on my 12c contains: If you also allow Rup it can be done in six steps: Code:
The Rup can be replaced with three Rdn for a total of eight steps: Code:
I'm sure someone can do better. Ceci n'est pas une signature. |
|||
03-02-2015, 03:40 AM
Post: #3
|
|||
|
|||
RE: 4-level stack manipulation on 12c
I'm sure someone will find an 'elegant' way in fewer steps, but:
--- --- 17 5 Enter ^ --- 17 5 5 Enter ^ 17 5 5 5 R v 5 17 5 5 R v 5 5 17 5 R v 5 5 5 17 Enter ^ 5 5 17 17 R v 17 5 5 17 x <> y 17 5 17 5 Task complete Total 8 operations. Yep, somebody will definitely find a shorter one. But at least this is straightforward. ;-) Dale |
|||
03-02-2015, 03:50 AM
Post: #4
|
|||
|
|||
RE: 4-level stack manipulation on 12c
Mark,
I guess us old HP-25 users think similarly... and simultaneously! It may chew up 8 steps, but at least it's easy to remember. Repeat after me: "Enter - Enter - Down Down Down - Enter - Down - Exchange" |
|||
03-02-2015, 03:57 AM
(This post was last modified: 03-02-2015 04:02 AM by PANAMATIK.)
Post: #5
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 03:18 AM)Don Shepherd Wrote: If my 4-level stack on my 12c contains: Code: t z x x y x z z x y y Bernhard |
|||
03-02-2015, 03:59 AM
(This post was last modified: 03-02-2015 04:05 AM by Mark Hardman.)
Post: #6
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 03:50 AM)Dale Reed Wrote: Mark, I would say that great minds think alike. ;-) Ceci n'est pas une signature. |
|||
03-02-2015, 08:14 AM
Post: #7
|
|||
|
|||
RE: 4-level stack manipulation on 12c
In fewer keystrokes but not sticking to the operations available:
Assuming that: 17 ENTER 5 has already occurred. Then: Code: 1 7 ENTER 5 Pauli |
|||
03-02-2015, 08:19 AM
Post: #8
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 03:18 AM)Don Shepherd Wrote: If my 4-level stack on my 12c contains: Sigma+ RCL 2 RCL 4 RCL 2 But it does not count (...too many preconditions). |
|||
03-02-2015, 10:48 AM
Post: #9
|
|||
|
|||
RE: 4-level stack manipulation on 12c | |||
03-02-2015, 11:40 AM
Post: #10
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 10:48 AM)PANAMATIK Wrote:(03-02-2015 08:19 AM)Csaba Tizedes Wrote: But it does not count (...too many preconditions). Stretching the preconditions a bith further and assuming 17 and 5 are on the stack: 2dup ... hp71b in forth mode. Best regards -Ray |
|||
03-02-2015, 12:28 PM
Post: #11
|
|||
|
|||
RE: 4-level stack manipulation on 12c
6 steps:
Code: ENTER Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
03-02-2015, 12:31 PM
Post: #12
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 03:18 AM)Don Shepherd Wrote: is there an elegant way to achieve that using only ENTER, roll down, and x<->y? The attached file contains all the possible stack manipulation. From the french book "Programmer HP-41" |
|||
03-02-2015, 12:45 PM
Post: #13
|
|||
|
|||
RE: 4-level stack manipulation on 12c | |||
03-02-2015, 01:49 PM
Post: #14
|
|||
|
|||
RE: 4-level stack manipulation on 12c | |||
03-02-2015, 03:30 PM
(This post was last modified: 03-02-2015 03:33 PM by Gene.)
Post: #15
|
|||
|
|||
RE: 4-level stack manipulation on 12c
Tony Hutchins gave this 7-step solution without using LASTX.
ENTER ENTER CLx - Roll Down X<>Y Roll Down But more importantly, the PDF where this and a large number of such ideas is found here: Stack Rearrangements You can find this solution by searching for ABAB, which represents XYXY as the contents of the four level RPN stack. |
|||
03-02-2015, 03:53 PM
(This post was last modified: 03-02-2015 05:41 PM by Don Shepherd.)
Post: #16
|
|||
|
|||
RE: 4-level stack manipulation on 12c
Thanks Gene. A fascinating book.
I just realized I have the book upon which Tony's book is based, "Algorithms for RPN Calculators," in my bookcase! But I wouldn't have known about Werner's 6-step solution from that book, I suppose. Don |
|||
03-03-2015, 10:54 PM
(This post was last modified: 03-03-2015 10:57 PM by Marcus von Cube.)
Post: #17
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-02-2015 03:30 PM)Gene Wrote: Stack Rearrangements That's why we have included the shuffle command ⇄ in the 34S. It allows to shuffle the lower four stack levels in an arbitrary fashion with a single command. The main purpose of this command is readability in a program but it works interactively as well. To accomplish the requested task the command would be: Code: ⇄ XYXY Self explanatory, isn't it? A solution that works for all calculators which can directly recall the stack: Code: RCL Y Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
03-03-2015, 11:25 PM
Post: #18
|
|||
|
|||
RE: 4-level stack manipulation on 12c
When I saw the discussion of management of operational scale I remembered a paper from Tony Hutching where the author presents a series of tables to relocate data (see attached). Perhaps it would be useful to analyze this issue
I take this opportunity to ask for a brief management explanation of Tony job and if it is useful today for programming the HP 35s calculator. Thank you very much for your attention, Pedro |
|||
03-04-2015, 06:52 AM
Post: #19
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-03-2015 11:25 PM)PedroLeiva Wrote: When I saw the discussion of management of operational scale I remembered a paper from Tony Hutching where the author presents a series of tables to relocate data (see attached). Perhaps it would be useful to analyze this issue Same as Gene's. :) Greetings, Massimo -+×÷ ↔ left is right and right is wrong |
|||
03-04-2015, 09:50 AM
Post: #20
|
|||
|
|||
RE: 4-level stack manipulation on 12c
(03-04-2015 06:52 AM)Massimo Gnerucci Wrote:(03-03-2015 11:25 PM)PedroLeiva Wrote: When I saw the discussion of management of operational scale I remembered a paper from Tony Hutching where the author presents a series of tables to relocate data (see attached). Perhaps it would be useful to analyze this issue My apologies. I read over what Gene had written, and did not open the file. Sorry. But I still wonder if Tony tables are useful today, and what is the reason of saving so much programming steps. Pedro |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)