Swapping Registers on HP calculators
|
03-28-2024, 09:21 AM
(This post was last modified: 03-28-2024 09:35 AM by n1msr.)
Post: #5
|
|||
|
|||
RE: Swapping Registers on HP calculators
Thank you all for taking the time to reply, and apologies for the vagueness of the question.
Also, thank you Marc for indenting the Python! Valentin summarised my question well: "I have a 1 x 9 array A and I need the most efficient sequence of RPN steps to exchange element A(1,i) with element A(1,j). Also, I am [still] curious how to toggle USER mode programatically, if it is possible. Below is the code for the HP-15C SWAP code to exchange two elements i and j in a single 1 x 9 matrix A. USER mode is on, although I am not reliant on this for the SWAP i is stored in R3 j is stored in R4 "temp" store for the SWAP is R5 *please note that I add 1 (one) to the column (i and j) because the algorithm uses 0 (zero) as the index to the first element of the list/matrix, whereas the 15c uses 1 (one). Changing the algorithm to use 1 (one) as the index to the first element would save several steps! Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)