Post Reply 
HP50g small tips and trick
12-13-2016, 11:58 PM (This post was last modified: 12-15-2016 09:39 AM by Vtile.)
Post: #1
HP50g small tips and trick
I thought I'll start this kind of thread where users of 50g can share their small tips and tricks of 50g usage. Created after a few seconds of thought.

Writing this from a phone so I'll post exact program tomorrow.

One grey hair and baldness generator is the SOLVE command. As it tends to change the calc to radians and not revert coordinate system back back after calculation so I created a small program to return to the coordinate system it were before Solve command. (There is more sophisticated method in AUR to preserve flag settings)
Another thing is that the SOLVE doesn't like the aprox values in some cases at all and the outcome is messy in general in some cases I like to use it ( ie. real life stuff with ie. values like 1.25 [it is exact value] before symbols and I just want to turn the equation over) so to same solve2.0 program I entered XQ command (thx Han) that converts it to 5/4. NOTE.. 50g converts every plain number even integers to decimal value while pushing them to stack when it is on aprox. mode with some exceptions... Confused (lost plenty of hairs to this, before I understood the bahaviour. This applies also while editing programs :O ).
Third.. One more thing the solve does is that it returns empty list if it do not find any zeros for given equation, doesn't say anything just empty list. Well I added lim(it) command inside a two IFs so now in case it doesn't find zeros it returns a limit of it with tag "limes0:" or proper error message "rational not form found" or similar. This is a sanity check to see what is going on with the solve command.
Lastly it preserves the equation on stack and takes OBJ-> command from the result.

Here is the listing, it is Quick & Dirty, no optimization at all.
Code:

<< 
-105 FS? @Check the flag status to see if the approx mode set?, really can't remember why this... well I leave it there since it do not make any harm @
-17 FS? @Check the flag status to see if the rad mode set?@
-> X Y  @Saves approx flag status to localvariable X and Y is for rad status@
  << 
IF 'X==1' THEN -105 CF END @TURNS CALCULATOR TO APPROX.@
DUP2 @PRESERVE THE EQUATION@
DROP @DROPS THE VARIABLE TO SOLVED AGAINST.@
EVAL @IIRC EVAL MADE SOLVE BEHAVE LIKE IT SHOULD IN SOME RARE CASES@
XQ @MAKE EVERYTHING INTEGER BASED .. IF NOT IN SOME DISPLAY MODES RESULT IS TOTAL MESS (TOO MANY DECIMALS SHOWN ETC..)@
SWAP @GET THE VARIABLE BACK TO THE RIGHT PLACE.@
SOLVE 
DUP
TYPE 5 == IF  @SEE IF RESULT IS LIST (type number for list is 5)@
 THEN 
DUP
SIZE 0 == IF @SEE IF THE RESULT OF SOLVE WERE EMPTY LIST@
THEN DROP 0 lim "Limes0" ->TAG  @Search limit of the equation when variable reaches to zero.@
 ELSE OBJ-> @The result weren't empty so there is something interesting there, broke down the list to separate object to the stack for further processing and better display.
END
ELSE END @first layer of these two last IFs.@
-17 FS? Y ≠ IF @Checks the radians status versus Y acts accordingly@
THEN -17 CF END
>>

This is mine small QoL tip, what is yours.
Find all posts by this user
Quote this message in a reply
12-15-2016, 10:48 AM
Post: #2
RE: HP50g small tips and trick
This software and this discussion can be very helpful Wink :
Find all posts by this user
Quote this message in a reply
12-19-2016, 11:27 AM
Post: #3
RE: HP50g small tips and trick
This discussion is very interesting, i think many others will have other tips and tricks. Will follow the thread.
Find all posts by this user
Quote this message in a reply
12-19-2016, 07:38 PM
Post: #4
RE: HP50g small tips and trick
Because the HP50 does not handle lists with zero or one element correctly, I had to come up with the following (unless I wanted to code separately for lists of size zero or one or two or more).

Sum List becomes << { 0 0 } Sum List} >> and Prod List becomes << {1 1} Prod List >>.

This works but it seems silly to have the built functions do some tests to produce incorrect behavior then I program tests to satisfy their tests.

In other cases, I needed (for a Monte Carlo choice from a list with varying weights) the running sum of an array. << OVER + >> STREAM. It probably doesn't work on empty lists.
Find all posts by this user
Quote this message in a reply
01-02-2017, 05:21 AM
Post: #5
RE: HP50g small tips and trick
Hello all!

I have owned the HP 50g for a little less than 3 months and I have run into a pretty cool tip that I have run into on accident during Physics class. It makes unit converting even faster (even though it is already really fast)!

When converting units in RPN mode with soft menus on, type in the number and then attach its current unit. Then convert the number by simply pressing [Left Shift] and then press the key that has the desired unit you want to convert it to!

Example: There is a car going 30 meters/second. Convert it to miles per hour. The keystrokes would be... (Assuming the stack is blank, the TOOL menu is displayed, and the HP 50g is in RPN mode with soft menus on)

30 [RIGHT SHIFT] UNITS F6(Speed) F1(m/s) [LEFT SHIFT] F5(mph)

Did not find this in the HP 50g User's Guide and I LOVE how much faster unit converting gets! I hope someone finds this useful!
Find all posts by this user
Quote this message in a reply
01-03-2017, 08:55 AM (This post was last modified: 01-17-2017 01:24 PM by Vtile.)
Post: #6
RE: HP50g small tips and trick
Didn't remember that one at all.. thx!

There is documented "shortcuts" (Advanced User Reference as far as know all of the shortcuts., here is a few more.

(Press and hold)
[Left shift] & MODE = "System" softmenu
[Left shift] & TOOL = Toggle Complex / Real mode
[Left shift] & VAR = Home
[Right shift] & DownArrow = Show variables with details

EDIT. Look at Joes post down below.
Find all posts by this user
Quote this message in a reply
01-11-2017, 01:29 PM
Post: #7
RE: HP50g small tips and trick
(01-03-2017 08:55 AM)Vtile Wrote:  [Left shift] & VAR = Home
Nice one!

I'd been looking for HOME in various menus and had come to the conclusion that I needed to type it manually or fish it out of the catalogue. Much faster this way!
G. Stewart.
Find all posts by this user
Quote this message in a reply
01-11-2017, 06:05 PM
Post: #8
RE: HP50g small tips and trick
My pleasure..

Here is also a small quality of life aka QoL improvement I now usually tend to use.

I have created a directory called Temp and it stays on Home directory. It is like the name suggest a temporary directory, where I now do all tasks that do create variable litter and I do not need my subject specific programs.

The key feature on that temp directory is a program called DELT (from old MS-DOS Deltree, while I haven't found a simple enough way to clear non empty directories in userRPL ). The program works in a way that while you run it, the first thing it do is to recal itself to stack, then creating list of all objects in the temp directory, then purging that list and finally storagin itself back to program named DELT. It is a bit dangerous for a bigger work though.

Easy cleanup.
Find all posts by this user
Quote this message in a reply
01-11-2017, 06:32 PM
Post: #9
RE: HP50g small tips and trick
(01-03-2017 08:55 AM)Vtile Wrote:  There is a lots of these poorly documented "shortcuts" (Advanced User Reference have many, but not all of them), here is a few more.

(Press and hold)
[Left shift] & MODE = "System" softmenu
[Left shift] & TOOL = Toggle Complex / Real mode
[Left shift] & VAR = Home
[Right shift] & DownArrow = Show variables with details

There is more.

FYI, all of those are on page G-2 (near the top) in the AUR. If Appendix G really is missing any keyboard shortcuts, I'd love to know, since I wrote the first draft of that appendix and I thought it was complete.

(01-11-2017 01:29 PM)grsbanks Wrote:  
(01-03-2017 08:55 AM)Vtile Wrote:  [Left shift] & VAR = Home
Nice one!

I'd been looking for HOME in various menus and had come to the conclusion that I needed to type it manually or fish it out of the catalogue. Much faster this way!
G. Stewart.

That's also on page G-2. The unit conversion shortcut mentioned above is also in Appendix G. Please do check out Appendix G in the AUR. It's loaded with nifty non-obvious keyboard shortcuts.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
01-11-2017, 06:56 PM
Post: #10
RE: HP50g small tips and trick
(01-11-2017 06:05 PM)Vtile Wrote:  The key feature on that temp directory is a program called DELT (from old MS-DOS Deltree, while I haven't found a simple enough way to clear non empty directories in userRPL ).

The PGDIR userRPL command will delete a non-empty directory.

G. Stewart
Find all posts by this user
Quote this message in a reply
01-11-2017, 09:07 PM
Post: #11
RE: HP50g small tips and trick
(01-11-2017 06:05 PM)Vtile Wrote:  ...while I haven't found a simple enough way to clear non empty directories in userRPL ).

Is there something about the PGDIR command that doesn't do what you need for this?
Find all posts by this user
Quote this message in a reply
01-11-2017, 11:41 PM (This post was last modified: 01-12-2017 12:01 AM by Vtile.)
Post: #12
RE: HP50g small tips and trick
@ David and Steward.

Yes, I think I did try PGDIR out, but if I recall it on the other hand didn't like other objects than directories, so I would have had to create some sort of identifying routine and frankly ... too much work for so small amount of gain. Maybe some day when I'm bored (extremely) and my million and one other hobbies aren't more interesting I write such a thing somehow (I have not looked out at how much there is needed pieces, basicly though toggling purge and pgdir might do the trick inside a iferr errortrap as they have needed identification pieces in their error checks). Big Grin

Still thanks for both of you for helping hand.

PS. While re-reading my previous post I see that I were a bit unclear, I need to modify the statement closer to the truth (= based on my knowledge). I would needed to state something like purge non-empty directories in same lists as other objects .. or something on those lines.

PPS. Here is the program listing of snippet that clears all objects from the current directory as long there is no non-empty directories on that directory. Where the 'DELT' were the name of the program itself stored also in current directory.
Code:
<< 'DELT' DUP RCL VARS PURGE SWAP STO>>

@Joe
Sorry you are absolutely correct. I feel silly now, I did look the AUR again and they are there, I don't know how I did manage to skip that information and only parroted the internet legend. I modify my post in a becoming week after you have seen this post.
Find all posts by this user
Quote this message in a reply
01-12-2017, 09:19 AM (This post was last modified: 01-12-2017 09:20 AM by grsbanks.)
Post: #13
RE: HP50g small tips and trick
(01-11-2017 11:41 PM)Vtile Wrote:  PS. While re-reading my previous post I see that I were a bit unclear, I need to modify the statement closer to the truth (= based on my knowledge). I would needed to state something like purge non-empty directories in same lists as other objects .. or something on those lines.

Yep. You'd need to iterate through all of the elements in the list thrown up by VARS, run VTYPE on each and use PGDIR if you get 15. or PURGE otherwise, skipping 'DELT' if BYTES returns the same data as on your program (there might be a different DELT somewhere else that you don't mind nuking!)

(01-11-2017 11:41 PM)Vtile Wrote:  PPS. Here is the program listing of snippet that clears all objects from the current directory as long there is no non-empty directories on that directory. Where the 'DELT' were the name of the program itself stored also in current directory.
Code:
<< 'DELT' DUP RCL VARS PURGE SWAP STO>>

This code assumes, of course, that DELT is in the directory that you want to remove. The RCL will bomb out if not.

Another option is to create a library attached to your HOME and have your DELT in there. That way it's no longer a variable so you can PURGE/PGDIR to your heart's content without having to worry about deleting it...

G. Stewart
Find all posts by this user
Quote this message in a reply
01-17-2017, 01:30 PM
Post: #14
RE: HP50g small tips and trick
(01-12-2017 09:19 AM)grsbanks Wrote:  
(01-11-2017 11:41 PM)Vtile Wrote:  PS. While re-reading my previous post I see that I were a bit unclear, I need to modify the statement closer to the truth (= based on my knowledge). I would needed to state something like purge non-empty directories in same lists as other objects .. or something on those lines.

Yep. You'd need to iterate through all of the elements in the list thrown up by VARS, run VTYPE on each and use PGDIR if you get 15. or PURGE otherwise, skipping 'DELT' if BYTES returns the same data as on your program (there might be a different DELT somewhere else that you don't mind nuking!)

(01-11-2017 11:41 PM)Vtile Wrote:  PPS. Here is the program listing of snippet that clears all objects from the current directory as long there is no non-empty directories on that directory. Where the 'DELT' were the name of the program itself stored also in current directory.
Code:
<< 'DELT' DUP RCL VARS PURGE SWAP STO>>

This code assumes, of course, that DELT is in the directory that you want to remove. The RCL will bomb out if not.

Another option is to create a library attached to your HOME and have your DELT in there. That way it's no longer a variable so you can PURGE/PGDIR to your heart's content without having to worry about deleting it...

G. Stewart
Yep, something like that should be done to allow real deltree equivalent, it is a dangerous command in calculator though. So I wouldn't make it as a library to be a global or if I would make it a library command I definedly would rename it to long Deltree and make yes/no check to it. As a local program that preserves itself in some dedicated temp directory it is more controllable. More so since we do not have undelete. Smile

I did reset my calculator because my exploration of the serial port communication and did find out that the solve2.0 program do have some sort of Flag issue. Sad The latest change to include LIM check, did broke something on it, while it were "bomb proof" before.. I need to analyse it and update the code here. Something on the flag settings is cousing a hick-up. Sorry for inconvenience.
Find all posts by this user
Quote this message in a reply
02-06-2017, 07:47 PM
Post: #15
RE: HP50g small tips and trick
One thing I found (probably in a manual somewhere) rather useful was in setting lots of variables to zero (or another constant) to start a program. Instead of: 0 'A' STO 0 'B' STO 0 'C' STO, etc. I found that 0 {A B C} STO works too. It's easier to update too.

Thanks to Carsen and others for the comments on unit conversion. I find the 50g hard to use as a unit converter.
Find all posts by this user
Quote this message in a reply
02-20-2017, 09:21 PM
Post: #16
RE: HP50g small tips and trick
I needed an algorithm to get the digits of an integer in any base. This was as fast as I could do easily.

Input: N, P (the number and base respectively)

<< -> N P <<
{} WHILE N REPEAT
N P MOD +
N P / FLOOR
'N STO
END >>

I did try using STO+ to generate the list and some playing around with LASTX but none were faster.

I can be a little faster by just leaving the remainders on the stack then using DEPTH and ->LIST to pick up the result, but that requires (I think) an empty stack at the beginning which makes it less easy to use the routine in other programs.
Find all posts by this user
Quote this message in a reply
06-13-2018, 08:12 AM
Post: #17
RE: HP50g small tips and trick
I have a new tip/trick for the 50g.

To plot an equation from Level 1 of the stack, use the PLOT command. This will open the Plot Setup menu, where you can immediately press the ERASE and DRAW to produce the graph. And the PLOT command is easy to access. Just press SYMB GRAPH PLOT.

Then you can even add more functions to the graph with PLOTADD. And it sits right next to PLOT. Tinker around with these functions. This function blew my mind! I can now create equations on the stack and quickly plot them.

Of course, some situations may need more settings changed before drawing the graph (such as Zoom parameters, selecting the type of graph, etc.).

Example: Graph -1/2*X^2+6. Press the following keys when in RPN mode on the home screen.

2 INV CHS [ ' ] X ENTER [ White Shift ] SQ * 6 + SYMB GRAPH PLOT (choose the FUNCTION graphing type if it is not selected) ERASE DRAW (then edit the zoom as needed.)
Find all posts by this user
Quote this message in a reply
06-13-2018, 10:55 AM
Post: #18
RE: HP50g small tips and trick
(12-19-2016 11:27 AM)tdh79 Wrote:  This discussion is very interesting, i think many others will have other tips and tricks. Will follow the thread.

idem

Hardware: Hp48S - Hp50g (5x black + 1 blue) - HP39gII - Hp27s - Casio fx-CG50
Find all posts by this user
Quote this message in a reply
06-13-2018, 08:33 PM (This post was last modified: 06-13-2018 08:39 PM by Vtile.)
Post: #19
RE: HP50g small tips and trick
Oh, this one. ..and it still contains the not so good "solver" thing of mine. Sad

Another tip or a trick. If you do not use UserKeys for anything (yet) assign a OBJ->, ->TAG and ->ARRY to F4, F5 and F6 keys on user layer. Also assign Unrot to down arrow in user layer.

Make a backup as usual.

From memory:
Code:
<<UNROT>>
KeyNumber
ASN
Advanced user manual did have a note how to get the right keynumber. You can extract it with this simple UserRPL program: <<DO UNTIL KEY END>>
Find all posts by this user
Quote this message in a reply
06-13-2018, 09:34 PM
Post: #20
RE: HP50g small tips and trick
(06-13-2018 08:33 PM)Vtile Wrote:  Another tip or a trick. If you do not use UserKeys for anything (yet) assign a OBJ->, ->TAG and ->ARRY to F4, F5 and F6 keys on user layer.

How is the ->TAG a useful command to assign to a user key? I only see ->TAG being useful for programming and the 50g will not let me use the USER mode when programming. Not to mention that I don't use ->TAG enough to assign it to a key.

I can see the ->OBJ and ->ARRY commands being useful enough to assign to keys.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)