HP Prime: Edit integer in RPN mode



#2

My apologies if this has been asked and answered before, I've had a search but couldn't find anything.

I've been playing with the Prime emulator, prior to buying one, and have a question concerning integer arithmetic.

I spend far too much of my time at work bit twiddling and as I can't afford an HP-16C I thought the prime might be helpful in this regard.

In textbook or algebraic mode I can press shift-minus to bring up the 'Edit Integer' dialog and I can view the binary representation of a number, shift it about and change its size. However in RPN mode all shift-minus does is bring up the # symbol. Am I missing something or is this desired behaviour?

Any advice would be much appreciated.

Paul.


#3

> Am I missing something or is this desired behaviour?

Unfortunately the Edit Integer environment is not available in RPN mode. (Not yet, anyhow).


#4

That's a shame as I find it really useful but hate having to shift out of RPN mode to use it.

Paul


#5

You might find it easier (if you like the Prime) to just ditch RPN - - that way, everything integrates nicely, from Home view to CAS view to programming - -albeit in algebraic mode.

I like RPN myself, and use it exclusively on the 50G, but on this machine, I now prefer algebraic mode.


#6

Even if one were to ditch RPN, bit twiddling on this calculator is cumbersome. The edit integer mode isn't good for rapidly seeing how many 1's are in decimal numbers one after the other for example. Or continually checking hex or binary numbers to see if your answers are correct or any other thing of the sort in my opinion. To ditch RPN would be to ditch the original reason I like HP calculators though. RPN does feel like an afterthought on this thing.


#7

I struggle to use a non-RPN calculator these days, so ditching it isn't really an option.

Currently have a 15C, 49G and WP 34S on my desk. Each used for specific tasks. Was looking for the one calculator to rule them all and hoped the prime was it.

Paul

#8

There are good emulators for the 16C (and many other HP calculators) available for iOS (iPhone and iTab) and Android phones and tablets.

#9

Please try this:

KEY K_SIN()
BEGIN
CHOOSE(B, "Base", "Bin", "Oct", "Dec", "Hex");
Base:=B-1;
STARTVIEW(6, 1);
STARTVIEW(-1, 1);
END;

For anyone reading this that may need more explicit directions:

Put the program in the calc via SHIFT->Program and it will assign a user program to the SIN key.

1)Enter the numbers with the default base: ALPHA->#->myNumber
2)Press SHIFT->User->SIN to change the base
This will change the "#"'s to the default base in much the same manner as the HP48G did.

Hope this helps.

Edited: 16 Oct 2013, 5:20 p.m.


#10

Thanks Kris,

I had trouble getting this to work until I figured out that it only works when you have the Edit-Integer dialog up. I associated it with the [-] key since it is the one that has the SHIFT-ed value of Base.

EDIT: I found it odd that the minus key [-] did not do anything (apparently) when the Edit-Integer dialog was not up. If you pressed [User] then [-] elsewhere it just performed the normal Minus operation. But in the Edit-Integer dialog it worked perfectly!

-Jonathan


Edited: 17 Oct 2013, 12:18 a.m.


#11

Thanks,

This will work in RPN mode right off the stack. That's how I'm using it. As a random example, say I need to know the binary values of the follow min terms so I can do a Kmap:

f(A,B,C,D)= sum of min terms(3,9,11,13)

I'll use the program (SIN key in my case) to go into decimal mode:

Note: "->" means next step ... or then
Note: I like to start with a Shift->Clear so I have a clean slate between problems.
Note: one can lock into User Mode by pressing Shift->User and then
Shift->User again which will make life easier in some cases,
but I'm not using that option in the example.

1)Shift->User->SIN
The "Choose Base" selection dialog presents itself
2) Press the number 3 key (or arrow to it and Enter)

Now the calculator has the decimal base as the default.

I enter my min terms:

ALPHA->#->3->Enter
ALPHA->#->9->Enter
ALPHA->#->11->Enter
ALPHA->#->13->Enter

Now we convert them all to binary:

1)Shift->User->SIN
The "Choose Base" selection dialog presents itself
2) Press the number 1 key (or arrow and Enter)

The stack will go from all "#" tagged numbers in decimal:

#3d
#9d
#11d
#13d

To all in binary:

#11b
#1001b
#1011b
#1101b

Now I can plug A'B'CD + AB'C'D + AB'CD + ABC'D into my Kmap and find the result of B'CD + AC'D as the simplest gate configuration to implement the circuit.

This helps me out a lot with homework and tests as I can quickly swap to/from any base with a large or small number of values to convert.

Hope this helps and please let me know if I'm not being clear on something. This is very similar to the way I would operate on the HP 48G. The main difference is the HP 48G would do this type of operation in a smaller number of key strokes. I hope they implement this in a Prime update as going to the Settings Menu is very cumbersome in my opinion and the Edit Integer screen makes mass conversions painful. My program still uses too many key strokes, but I'll take it over the alternatives.


Edited: 17 Oct 2013, 2:15 p.m.


#12

Kris,

Okay now my "base" key does something in RPN mode. It eats the number and updates the display mode.

But I do not get a pop-up dialog asking which base to use.

Are you assuming something is in B? If so, what? And what does the Base:=B-1; statement do?

Thanks

-Jonathan


#13

The Base:=B-1 is setting the calcs base variable.

The "choose" dialog sets the variable B to the number chosen. It's indexed at one and increments from there based on how many choices there are. So we have four choices so it will return a 1 if Bin is selected, 2 if Oct is selected and so on. The "Base" variable goes from 0 to 3 so we subtract one from the variable B to get the right base. Hope that made sense ... please see the help dialog for the Base variable.

Now, I'm guessing you are invoking the program without finishing entering the number. Enter the numbers on the stack and then call the program. I hope that's it and let me know how it goes. There shouldn't be any eating of the number :)

Edited: 17 Oct 2013, 3:22 p.m.


#14

Thanks for the explanation. Makes sense. We should probably convert B to a LOCAL to avoid overwriting the user B variable.

It was "eating" the number because it was actually performing subtraction (I have it set to the Minus key). So it was not doing the user-key function at all.

When I put the numbers on the stack, press [User] then [Minus] I do not get the K_Minus function executing at all.

I did create it using the "Create User Key", etc. So I think that is is in there correctly.

Here is what I have in my USERKEYS program:

  KEY K_Minus()
BEGIN
CHOOSE(B,"Base","Oct","Dec","Hex");
Base:=B-1;
STARTVIEW(6,1);
STARTVIEW(-1,1);
END;
It looks the same to me as what you listed earlier. Could you double-check with your calculator to see if I've got a typo in the code?

Yes, I'm running it in RPN mode.

-Jonathan

Edited: 17 Oct 2013, 3:32 p.m.


#15

Your advice on changing the variable to local is a good one.

I think you should try assigning it to a different key than minus and see what happens. I was originally trying to use the "a b/c" key but it didn't want to play so I went with the "SIN" key.

Edited: 17 Oct 2013, 11:54 p.m.


#16

Okay! I got it working! I had to assign it to the [Sin] key as you suggested. I also used a LOCAL 'nb' instead of B and it worked great in RPN mode (after I added the missing "Bin" choice). Thanks for your help.

Not sure why the [Minus] key did not work...


#17

Great!


Possibly Related Threads...
Thread Author Replies Views Last Post
  Integration question and "RPN" mode comment Craig Thomas 16 749 12-05-2013, 02:32 AM
Last Post: Nick_S
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 295 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  HP-Prime : Extracting elements from a list in RPN Miguel Toro 0 200 11-15-2013, 06:44 PM
Last Post: Miguel Toro
  HP Prime: Recommendation for future RPN Program Mode BruceTTT 3 242 11-13-2013, 10:03 PM
Last Post: BruceTTT
  HP PRIME: Hide return value from program and swap Edit with Run vrrr 2 203 11-09-2013, 04:04 PM
Last Post: vrrr
  [PRIME] RPN: another attempt at returning more than one value to the RPN stack Marcus von Cube, Germany 5 352 11-05-2013, 02:44 AM
Last Post: Marcus von Cube, Germany
  Program to change entry mode on Prime Michael de Estrada 3 252 10-28-2013, 10:13 AM
Last Post: Han
  PRIME Spreadsheet RPN Problem Dougggg 5 314 10-24-2013, 11:46 PM
Last Post: Han
  Prime: Exam mode (possible duplicate after funny response first time) Paul Townsend (UK) 1 170 10-24-2013, 03:09 PM
Last Post: Tim Wessman
  Does RPN entry mode cause the Prime keyboard to lock up ? Michael de Estrada 14 643 10-22-2013, 06:27 PM
Last Post: John Colvin

Forum Jump: