The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP Prime: Edit integer in RPN mode
Message #1 Posted by plivesey on 7 Oct 2013, 5:22 p.m.

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.

      
Re: HP Prime: Edit integer in RPN mode
Message #2 Posted by Joe Horn on 7 Oct 2013, 5:27 p.m.,
in response to message #1 by plivesey

> Am I missing something or is this desired behaviour?

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

            
Re: HP Prime: Edit integer in RPN mode
Message #3 Posted by plivesey on 7 Oct 2013, 9:05 p.m.,
in response to message #2 by Joe Horn

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

Paul

                  
Re: HP Prime: Edit integer in RPN mode
Message #4 Posted by Helge Gabert on 7 Oct 2013, 9:21 p.m.,
in response to message #3 by plivesey

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.

                        
Re: HP Prime: Edit integer in RPN mode
Message #5 Posted by kris223 on 7 Oct 2013, 9:39 p.m.,
in response to message #4 by Helge Gabert

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.

                              
Re: HP Prime: Edit integer in RPN mode
Message #6 Posted by plivesey on 8 Oct 2013, 1:32 p.m.,
in response to message #5 by kris223

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

      
Re: HP Prime: Edit integer in RPN mode
Message #7 Posted by mjcohen on 9 Oct 2013, 11:02 p.m.,
in response to message #1 by plivesey

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

      
Re: HP Prime: Edit integer in RPN mode
Message #8 Posted by kris223 on 16 Oct 2013, 5:19 p.m.,
in response to message #1 by plivesey

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.

            
Re: HP Prime: Edit integer in RPN mode
Message #9 Posted by Jonathan Cameron on 17 Oct 2013, 12:00 a.m.,
in response to message #8 by kris223

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.

                  
Re: HP Prime: Edit integer in RPN mode
Message #10 Posted by kris223 on 17 Oct 2013, 1:44 p.m.,
in response to message #9 by Jonathan Cameron

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.

                        
Re: HP Prime: Edit integer in RPN mode
Message #11 Posted by Jonathan Cameron on 17 Oct 2013, 2:19 p.m.,
in response to message #10 by kris223

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

                              
Re: HP Prime: Edit integer in RPN mode
Message #12 Posted by kris223 on 17 Oct 2013, 3:21 p.m.,
in response to message #11 by Jonathan Cameron

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.

                                    
Re: HP Prime: Edit integer in RPN mode
Message #13 Posted by Jonathan Cameron on 17 Oct 2013, 3:31 p.m.,
in response to message #12 by kris223

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.

                                          
Re: HP Prime: Edit integer in RPN mode
Message #14 Posted by kris223 on 17 Oct 2013, 11:15 p.m.,
in response to message #13 by Jonathan Cameron

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.

                                                
Re: HP Prime: Edit integer in RPN mode
Message #15 Posted by Jonathan Cameron on 18 Oct 2013, 4:19 a.m.,
in response to message #14 by kris223

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...

                                                      
Re: HP Prime: Edit integer in RPN mode
Message #16 Posted by kris223 on 18 Oct 2013, 4:34 p.m.,
in response to message #15 by Jonathan Cameron

Great!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall