HP50g small tips and trick
|
06-23-2018, 05:02 PM
Post: #41
|
|||
|
|||
RE: HP50g small tips and trick
Got it - 'N' STO fixed it.
Also, the list is reversed, sol REVLIST at the end of the code is required. TC |
|||
06-23-2018, 05:35 PM
Post: #42
|
|||
|
|||
RE: HP50g small tips and trick
(06-23-2018 05:02 PM)TomC Wrote: ...Also, the list is reversed, sol REVLIST at the end of the code is required. For models that don't have REVLIST, you can also add a SWAP before the "+": Code: « On the 49G or later RPL systems, the ListExt library has a single command that also does this: I→BL. |
|||
06-23-2018, 05:43 PM
(This post was last modified: 06-23-2018 05:44 PM by pier4r.)
Post: #43
|
|||
|
|||
RE: HP50g small tips and trick
(06-23-2018 04:26 PM)rprosperi Wrote: When you have no idea at all how long a program may run, it's usually best to include a counter to track the number of iterations and when it exceeds some threshold, exit with a diagnostic message, e.g. "Exceeded 10,000 iterations". Yes that is true. Though I tend to deviate from theory if the task is not critical. (i.e: I am interested in the results but I can wait) I learned (also through pain) to do sort of canary deployments (principle that is valid mostly everywhere). Small tests first. Passed? Good. Then a bit larger. In the meanwhile I collect timings and I see if the predicted runtimes hold varying the input. Then I let the program crunch large input values. In my particular case I could predict the next execution time practically with 100% accuracy (and also the number of loops to execute). Only one loop was related to a random pick that in a very remote case could have ended in "sorry no result is there for what you are searching" and then this would have ended in an infinite loop. I though "well do I make a fail check condition for this? Nah. It won't happen until the input values are really large. By then I will have fixed it". Instead it happened earlier than expected. Sometimes I have to be remembered of some programming/planning techniques through slightly bitter experiences, to then be motivated to implement them. Wikis are great, Contribute :) |
|||
06-30-2018, 01:00 PM
Post: #44
|
|||
|
|||
RE: HP50g small tips and trick
(06-23-2018 04:50 PM)TomC Wrote: Not clear to me why this snippet does not work on an HP48. I think you just need another single quote around the local variable: (02-20-2017 09:21 PM)ttw Wrote: << -> N P << HTH Thomas |
|||
07-04-2018, 02:55 PM
Post: #45
|
|||
|
|||
RE: HP50g small tips and trick
Given two integers, the command IDIV2 returns the quotient and the reminder.
|
|||
07-04-2018, 04:52 PM
Post: #46
|
|||
|
|||
RE: HP50g small tips and trick
(07-04-2018 02:55 PM)Juan14 Wrote: Given two integers, the command IDIV2 returns the quotient and the reminder. Astoundingly, IQUOT internally performs IDIV2 DROP, and IREMAINDER internally performs IDIV2 NIP. So getting both the quotient and remainder is actually faster than getting only one or the other. <0|ɸ|0> -Joe- |
|||
07-04-2018, 05:39 PM
Post: #47
|
|||
|
|||
RE: HP50g small tips and trick
(07-04-2018 04:52 PM)Joe Horn Wrote:(07-04-2018 02:55 PM)Juan14 Wrote: Given two integers, the command IDIV2 returns the quotient and the reminder. Just make sure you don't have system flag -100 set (Step-by-step) before using IDIV2. I was once trying to help someone with a problem and it took a while to figure that one out. |
|||
07-04-2018, 05:56 PM
Post: #48
|
|||
|
|||
RE: HP50g small tips and trick
(07-04-2018 04:52 PM)Joe Horn Wrote: Astoundingly, IQUOT internally performs IDIV2 DROP, and IREMAINDER internally performs IDIV2 NIP. So getting both the quotient and remainder is actually faster than getting only one or the other. Not very fast though. IDIV2 would be much more useful if it wasn't so slow. |
|||
08-08-2018, 08:44 AM
Post: #49
|
|||
|
|||
RE: HP50g small tips and trick
I don't know if this has made it to anywhere I've seen yet, so I thought I'd share it for the newer users among us. Here's an explanation of the code snippet I came up with:
Code:
Now, onto how I used it. A while ago, Gilles59 provided me with some useful programs that I used: (09-15-2017 08:51 PM)Gilles59 Wrote: To create, calculate or update automatically the TOTAL for a month, here is an idea : I added the above snippet to my program so it grabs its own folder name, now I simply call the program from the folder with the totals in, so there's no more changing folders within the program. Here's how I used it. The TL;DR goes like this; I created a series of folders (JAN..DECEM), with totals for each grocery run inside, some examples are: Code:
The requirement I had was that each varname had to have the month name embedded in it somewhere, or it'd simply get ignored by later code. Most of the code below was pulled from the previous post I made. Code: @name: 'GRCMonthTotal' Quote:Warning : flag -86 must be set or type once [i]256 ATTACH (Post 266) Regards, BrickViking HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a) |
|||
08-08-2018, 09:25 AM
Post: #50
|
|||
|
|||
RE: HP50g small tips and trick
Hi Brickviking, thanks for your contribution!
May I ask why you convert the sublist in an array? (If I understood the operations of your code) If I understood correctly you go through the list of variables in a subdirectory. If a variable has an acceptable name, then it should be a list in the form: { 274.74 38.00 14.00 8.00 } then you convert it to a vector with AXL and that is where I am puzzled. Couldn't you just sum the elements in a list? With \GSLIST or sigmaList (left shift, SYMB [the MTH menu], list, sigmaList) Wikis are great, Contribute :) |
|||
08-08-2018, 10:08 AM
Post: #51
|
|||
|
|||
RE: HP50g small tips and trick
(06-16-2018 08:40 AM)Carsen Wrote:(06-15-2018 03:20 PM)Joe Horn Wrote: Full-Screen Edit Without Losing Your Preferred Header Size I programmed it into my calculator, but I did something really weird that killed everything in main memory on my calculator. I wasn't a happy camper, as you can imagine, as I'd lost the lot. However ... I had remembered—I have no idea why—to save the grocery folder to the SD card about five days ago, so I only had to put in my most recent rewrites from my last post in this thread, and add Tuesday's grocery haul to bring my data up to date. The rest, alas, is history until I restore it from other places (SDCard, online, etc). So, remember your backups, people. (Post 267) Regards, BrickViking HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a) |
|||
08-08-2018, 10:21 AM
Post: #52
|
|||
|
|||
RE: HP50g small tips and trick
(08-08-2018 09:25 AM)pier4r Wrote: Hi Brickviking, thanks for your contribution! I stumbled across one "bug" in \GSLIST. I have had on occasion lists that purely have one value, such as {216.30} 'AUG07' STO. \(\sum\)LIST barfs on lists that only have one entry and complains "Invalid Dimension", AXL CNRM steps around this problem nicely. (Post 268) Regards, BrickViking HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a) |
|||
08-08-2018, 11:18 AM
(This post was last modified: 08-08-2018 11:19 AM by pier4r.)
Post: #53
|
|||
|
|||
RE: HP50g small tips and trick
(08-08-2018 10:08 AM)brickviking Wrote: So, remember your backups, people. Absolutely! The 50g as serious computing device also for collecting data deserves a bit of housekeeping utilities. Several users every now and them post some backup solutions but unfortunately those gets scattered (if you have one, please post it here: http://www.hpmuseum.org/forum/thread-10271.html ). I have a backup utility for some folders but thanks to the size of the SDcard and the size of the port0 memory, it wouldn't be bed, as first approach, to backup everything to the SD card. Either through ARCHIVE or simply mass copy and paste (to then order properly on the SD card using the SDFiler). I strongly suggest a mass copy and paste every now and then. Even better when automated. Then the SDcard content can be recovered even if the 50g doesn't work thanks to the emulators. Whatever is in the internal memory can be lost for good. (08-08-2018 10:21 AM)brickviking Wrote: I stumbled across one "bug" in \GSLIST. I have had on occasion lists that purely have one value, such as {216.30} 'AUG07' STO. \(\sum\)LIST barfs on lists that only have one entry and complains "Invalid Dimension", AXL CNRM steps around this problem nicely. Yes that bug is a bit annoying. Some suggestions: - since we are talking about summing of list, one could do: (a) inputList 0 + \GSLIST where 0 + ensures there is an additional neutral element to go around the \GSLIST bug. Assuming that the list contains at least one element. (b) Install listExt http://www.hpmuseum.org/forum/thread-8555.html and use LSUM (oh I love that some good work gets visibility also thanks to small commands that were sometimes deemed unneeded). I strongly suggest ListExt if you are dealing often with lists (and I think it is the case). Plus goferlist if you want to get fancy. How to install a library on the 50g http://www.hpmuseum.org/forum/archive/in...d-971.html (I didn't find a better discussion) Wikis are great, Contribute :) |
|||
06-16-2022, 08:43 PM
Post: #54
|
|||
|
|||
RE: HP50g small tips and trick
(01-11-2017 06:32 PM)Joe Horn Wrote:(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. It's in appendix G of the user guide. |
|||
03-13-2024, 02:34 AM
Post: #55
|
|||
|
|||
RE: HP50g small tips and trick
It wasn't obvious to me at first, but CONVERT, REWRITE, NEXT, ->Q (or ->Qpi) will convert a decimal back into an exact rational.
It's really helpful if you are trying to do exact equations but some of your inputs are given as decimals. Most people who ask how to do this on-line are given incorrect answers so if you try to google this, or ask one of those new fancy AI's you won't find the correct function. Now if I could figure out how to get it to leave radicals into my denominators unless I ask it to rationalize my denominator specifically. Sometimes I want it to remain unrationalized. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)