Surprise graphic program (HP-48G, GX)
|
10-28-2014, 07:21 AM
(This post was last modified: 10-28-2014 07:00 PM by Gerson W. Barbosa.)
Post: #1
|
|||
|
|||
Surprise graphic program (HP-48G, GX)
Here is a simple graphic program for the HP-48G,GX (it should work on the HP-49G and hp 50g also). No fancy program, but in theory it obeys a physical principle, if I haven't made any mistake (I'll explain later). 787 bytes, but it can be easily optimized for size.
Code:
P.S.: Place the calculator in landscape position. P.P.S.: Edited to fix code c NEG 65 + \v/ NEG 8 + 4 * 1 + not c NEG 65 + \v/ NEG 8 + 4 * 1 - in the beginning of the last loop. |
|||
10-28-2014, 08:45 AM
Post: #2
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Cool !
It works fine on 50G |
|||
10-28-2014, 03:16 PM
Post: #3
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Also seems to work on the 48SX.
|
|||
10-28-2014, 05:07 PM
(This post was last modified: 10-28-2014 06:31 PM by Gerson W. Barbosa.)
Post: #4
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 03:16 PM)Dave Britten Wrote: Also seems to work on the 48SX. Thanks! So the revised 48G/GX code should run also on the HP-48S/SX: Code:
That's the exact shape ( y = x^4 ) so that the height of water increases linearly with time. I have yet to prepare the proof. Gerson. P.S.: The above code works also on the HP 49G, but the following is slightly shorter: Code:
|
|||
10-28-2014, 05:16 PM
Post: #5
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 08:45 AM)Gilles Wrote: Cool ! This looks better on the hp 50g: Code:
Almost three times faster on the HP 50g, but the initialization is still somewhat slow. The first two loops might be combined into one, but I haven't tried it yet. I picture hasn't been expanded to occupy the whole screen because I don't want to distort its shape ( y = x^4 ). In a physical object with that format the height of water would increase linearly with time. Gerson. |
|||
10-28-2014, 10:56 PM
(This post was last modified: 10-29-2014 12:13 AM by Gilles.)
Post: #6
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Another way to do, using complex number to avoid B->R, lists conversions and scale transformation...
On 48 change DUPDUP with DUP DUP and screen size ... EDIT : Update for 4 XROOT instead of SQRT Code:
|
|||
10-28-2014, 11:04 PM
(This post was last modified: 10-28-2014 11:36 PM by Gerson W. Barbosa.)
Post: #7
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Minor optimization in size and speed.
HP-48S/SX/G/GX checksum: # 3536d size: 741.5 Usage: HG48 any key to start any key to exit Code:
HP 50g checksum: # 25014d size: 758. Usage: HG50 any key to start any key to exit Code:
Yes, if it is not clear from the listings only, this in an hourglass :-) P.S.: LOOKS LIKE I'VE MADE A MISTAKE IN THE SHAPE OF THE HOURGLASS IN THE PROGRAM. I said y = x^4 ( or x = y^1/4 ) so that the height of water increases linearly with time. That's correct, but in the program I used x = sqrt (y), that is, y = x^2. I think I was somewhat sleepy when I began to write the program last night... This can be fixed, anyway we get the idea. The following picture is correct: |
|||
10-28-2014, 11:52 PM
Post: #8
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Using 0 WAIT DROP might is easier on the batteries and is slightly smaller than DO UNTIL KEY END DROP.
Graph 3D | QPI | SolveSys |
|||
10-29-2014, 12:04 AM
(This post was last modified: 10-29-2014 12:10 AM by Gerson W. Barbosa.)
Post: #9
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 11:52 PM)Han Wrote: Using 0 WAIT DROP might is easier on the batteries and is slightly smaller than DO UNTIL KEY END DROP. Thanks for the tip, Han, much appreciated! It appears the clock should be off when using 0 WAIT, is this correct? For me, that has been a good exercise on using graphics in a program. That was the first time I read about the PICTURE environment in the manual. Gerson. |
|||
10-29-2014, 12:13 AM
(This post was last modified: 10-29-2014 12:19 AM by Gilles.)
Post: #10
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 11:04 PM)Gerson W. Barbosa Wrote: P.S.: LOOKS LIKE I'VE MADE A MISTAKE IN THE SHAPE OF THE HOURGLASS IN THE PROGRAM. I've edited my version upside. I think using complex numbers to plot do the thing far more easy with CONJ and NEG features and PDIM scale. |
|||
10-29-2014, 12:55 AM
Post: #11
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(10-28-2014 10:56 PM)Gilles Wrote: Another way to do, using complex number to avoid B->R, lists conversions and scale transformation... That's more like it, thanks! I have to use my other HP 50g. The one I've been using has about 32K bytes left and give "PDIM Error: Insufficient Memory". I've disable the clock, at is appears on the screen when the lower recipient gets full. Sqrt Sqrt is faster than 4 XROOT. Other improvements might be arbitrary timing in minutes and successive uses of the hourglass. A sensor like those on smartphones for automatic draining might be handy Gerson. |
|||
10-29-2014, 01:18 AM
Post: #12
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX) | |||
10-29-2014, 03:50 AM
Post: #13
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Don't forget that the HP50G program can go even faster if you convert integers into "reals" (such as in the FOR loop) due to overhead from internal conversion.
Graph 3D | QPI | SolveSys |
|||
10-29-2014, 01:38 PM
(This post was last modified: 10-29-2014 01:39 PM by Gilles.)
Post: #14
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Small improvment with the sand flowing ...
For 49G+/50G Code: |
|||
10-29-2014, 06:00 PM
Post: #15
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(10-29-2014 01:38 PM)Gilles Wrote: Small improvment with the sand flowing ... Very nice! A slight modification to allow for user-selected timing: Code:
Usage: - Enter time in mm.ss format; time >= 0.093 (9.3 s). - run program - any key to start - any key to exit Now it can be used for controlling the time to boil an egg, for instance :-) When the hourglass is half way past the selected time it appear to get "choked with sand". This happens in your previous version also. This becomes irrelevant as times get longer, however. Gerson. |
|||
10-31-2014, 01:15 AM
(This post was last modified: 11-02-2014 11:50 PM by Gerson W. Barbosa.)
Post: #16
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Here are my final versions. I've stuck with my first approach, but I'd like to thank Gilles for his compact version and improvements, Han for his suggestion and those of you who were curious enough to give it a try on other calculators.
The shape can be changed at will on both calculators. For y = x^2, just remove one of the srqt characters, or replace them with 3 SQRT for y = x^3. In this case, the time parameters (15.2 and 57.2 in the HP-48GX program) will need to be adjusted properly. HP-48G/GX Code:
HP 50g Code:
Usage: - Enter time in mm.ss format; time >= 0.15 (15 s) on the HP-48GX and >= 0.045 (4.5 s) on the HP 50g - run program - any key to start - any key to exit Not a surprise anymore: ----------- Update: Though the difference ( for y = x^4 ) in relation to the previous version is barely noticeable, here are versions with x and y axes in the same scale. The constant 11.5 is an approximation to 32/60^(1/4). HP-48GX Checksum #46537d Size 694 Code:
HP 50g Checksum #45216d Size 686.5 Code:
Usage same as above. Minimum timings are are about 14 and 5 seconds, respectively. |
|||
11-03-2014, 12:01 AM
Post: #17
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Here's a more classical hourglass shape on the HP 49g+ (ROM Revision #2.15, m48+ emulator on iPhone4S), usage same as above.
I can't keep the menu labels from showing, however. Is this a problem with the #2.15 ROM or am doing something wrong? |
|||
11-03-2014, 07:01 PM
Post: #18
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
Hi Gerson ! This shape looks better
could you post your program in text format ? |
|||
11-03-2014, 11:48 PM
Post: #19
|
|||
|
|||
RE: Surprise graphic program (HP-48G, GX)
(11-03-2014 07:01 PM)Gilles Wrote: Hi Gerson ! This shape looks better I hope the proportions are correct. Anyway, you can vary the width by changing the 9.5 constants. Upper recipient starting entirely full to the brim and no animated flowing sand, however Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)