Post Reply 
DB48X: HP48-like RPL implementation for DM42
07-31-2023, 02:46 PM
Post: #61
RE: DB48X: HP48-like RPL implementation for DM42
Thank you!

(07-29-2023 06:30 PM)c3d Wrote:  
(07-28-2023 11:41 AM)TomC Wrote:  Is the complex number functionality complete?

Thank you,
TomC
To a large extent, yes, including symbolic complex numbers. See https://youtu.be/I5jgLzw_0-o?t=1780.
Find all posts by this user
Quote this message in a reply
07-31-2023, 04:18 PM
Post: #62
RE: DB48X: HP48-like RPL implementation for DM42
(07-31-2023 02:46 PM)TomC Wrote:  Thank you!

(07-29-2023 06:30 PM)c3d Wrote:  To a large extent, yes, including symbolic complex numbers. See https://youtu.be/I5jgLzw_0-o?t=1780.

Well, I noticed during the demo recording a number of weird behaviours, like `conj` giving me bogus results. The bottom line is that I completely broke the polar representation when I added support for angles modes in it.

Below are the details, since you care about complex numbers.

DB48X has two representation for complex numbers, polar and rectangular. Initially, polar had the angles in radians, but this causes rounding errors. So I switched to fractions of pi, which are exact. In other words, 3i in polar form is now represented as (3, 1), where "3" is the modulus and 1 is means an argument of 1xpi. I correctly implemented the parsing and rendering of that, but I failed to realize that many places, notably the implementation of re() and im() for the polar form, relied on the arg() function returning radians and not the current angle mode or fractions of pi or whatever.

There are some subtleties to this. For example, exp(a+ib) is computed using the polar form as mod = exp(a), arg = b... except that in that case, b really has to be "real" radians, not fractions of pi or degrees. When I tried to fix these cases, I noticed that I would often get approximate results on fairly simple cases, e.g. the real part of a polar on the imaginary axis would not be exactly zero, because the cos of 90 degrees after radian conversion was inexact. So a lot of tiny details to adjust to make it work better.

I did most of these fixes yesterday late (and early this morning, as in about 1AM). But I still need to post a release with these fixes in. That will be 0.4.1. Maybe tonight, if my testing of this problem does not expose more rabbit holes to follow.

There were many other glitches that I noticed in the demo video. Most of them are much simpler fixes than this semi-pervasive angle unit problem, and do not impact complex numbers. Like the month is displayed off-by-one...
Find all posts by this user
Quote this message in a reply
07-31-2023, 10:29 PM
Post: #63
RE: DB48X: HP48-like RPL implementation for DM42
(07-30-2023 04:15 PM)c3d Wrote:  Video posted here: https://youtu.be/ehiX6mhlgAY. But YouTube has not processed the HD variant yet.

I enjoyed the video, except for the boring advertising every 3 minutes. I don’t know if it’s a new "feature" of Youtube.

{ 1 2 3 0 } 3 * should give { 3 6 9 0 } instead of { 1 2 3 0 1 2 3 0 1 2 3 0 }
I would be very disappointed if this behavior is kept, because I use routinely operations on lists.

A small detail: the variable menu could use only one row in my opinion. Only the black row can be displayed, with the appropriate triangle after a shift press. This would give more space for the stack.
Unless there is a good reason for the three rows?

Will the keyboard be re-definable, at list for some keys or shifted keys?

The base conversion is a marvel, and I like the fact that it can go beyond 64 bits!

Jean-Charles
Find all posts by this user
Quote this message in a reply
08-01-2023, 01:11 AM
Post: #64
RE: DB48X: HP48-like RPL implementation for DM42
(07-31-2023 10:29 PM)Helix Wrote:  
(07-30-2023 04:15 PM)c3d Wrote:  Video posted here: https://youtu.be/ehiX6mhlgAY. But YouTube has not processed the HD variant yet.

I enjoyed the video, except for the boring advertising every 3 minutes. I don’t know if it’s a new "feature" of Youtube.

Annoying, isn't it? Well, it means the video is "successful".

Remember the humble beginnings of YouTube, where one of the leading differentiators with TV was "no ads"?

Quote:{ 1 2 3 0 } 3 * should give { 3 6 9 0 } instead of { 1 2 3 0 1 2 3 0 1 2 3 0 }
I would be very disappointed if this behavior is kept, because I use routinely operations on lists.

This is the behaviour you get with vectors. For lists, HP has unfortunately implemented a behaviour that is inconsistent, where { 1 2 } 3 + gives { 1 2 3 } but { 1 2 } 3 * gets { 3 6 }. I decided to have a per-type consistent behaviour, i.e. always process component-wise for vectors and always consider that lists are created to manipulate data items that are not necessarily numeric.

In programs, the 'map' function always works on individual elements. So a way that always work is { 1 2 } « 3 + » MAP. It's not ambiguous, more powerful, and more efficient if you do complex operations because it does not have to deconstruct / reassemble the list many many times, i.e. { 1 2 } « 3 + 5 * SIN » MAP will extract the list content once, do operations on the stack, and rebuild the list once, whereas the same thing as {P 1 2 } 3 + 5 * SIN would rebuild the list three times.

Interactively, there is a reserved primary key on the keyboard at the moment, EEX. It does nothing while not editing. The intent is to have that key, where the yellow label is "DISP", cycle between various visible representations of the first level of the stack. For complex, it would switch between rectangular and polar, between fractions and decimal, and between vectors and lists. So if you want to run a bunch of operations on a list interactively, you hit EEX, turn it to a vector, do your operations, and then turn it back to a list. At least that's how I see things at the moment.

For many of these subtle per-RPL variations in behaviour, I believe that if memory permits, at some point I will have flags controlling what happens, with high-level commands like "HP28", "HP48", "HP50" or "newRPL" giving different default behaviours. I will be doing that last, though, because it's unclear that there is enough space in the DM42 to get more important stuff in. If the options don't fit, I will probably make them compile-time switches so that you can build the firmware with your preferences baked in. But again, relatively low priority. In any case, my philosophy is that this is a matter of taste, so if you don't like it as it works today but I do like it, we'll try to make it a user preference.

Note newRPL took a different approach, with "add" and "+" doing different things. Just to point out that I'm not the only one trying to figure out the correct approach ;-)

Quote:A small detail: the variable menu could use only one row in my opinion. Only the black row can be displayed, with the appropriate triangle after a shift press. This would give more space for the stack.

I like the three rows as a very visible indication of what operation happens (because the row is highlighted). But here too, I could certainly make it a preference.

Quote:Unless there is a good reason for the three rows?

The good reason is that on real HP48, I keep mixing store and recall and overwriting variables in the VAR menu. For whatever reason, my brain is wired backwards with that specific functionality.

Quote:Will the keyboard be re-definable, at list for some keys or shifted keys?

Yes. The infrastructure is actually already there, but the ASN function is not implemented yet.

Quote:The base conversion is a marvel, and I like the fact that it can go beyond 64 bits!

Thanks. I wonder if I should spend any time on stuff like 1-complement, which the HP16 supported. I've never had any use for it.
Find all posts by this user
Quote this message in a reply
08-01-2023, 02:20 AM
Post: #65
RE: DB48X: HP48-like RPL implementation for DM42
(07-31-2023 04:18 PM)c3d Wrote:  
(07-31-2023 02:46 PM)TomC Wrote:  Thank you!

Well, I noticed during the demo recording a number of weird behaviours, like `conj` giving me bogus results. The bottom line is that I completely broke the polar representation when I added support for angles modes in it.

You are likely already aware, but I noticed in the video (and I think you did, too, since you went back and toggled it a second time) is that the Display Seconds toggle in Settings-Status Bar didn't appear to be removing the X in the toggle box. I tried it and if you go through the motions to scroll down to that item, and then press enter, the state does actually change. I can get seconds to show up and not show up...it just takes me two tries most of the time!
Find all posts by this user
Quote this message in a reply
08-01-2023, 09:32 PM (This post was last modified: 08-01-2023 09:47 PM by Helix.)
Post: #66
RE: DB48X: HP48-like RPL implementation for DM42
(08-01-2023 01:11 AM)c3d Wrote:  Annoying, isn't it? Well, it means the video is "successful".

"Successful" ? With only 200 views? The threshold is very low! Big Grin
This is the first time I see so much ads in a video. I wonder if this is due to some settings when you posted it on Youtube.

(08-01-2023 01:11 AM)c3d Wrote:  For lists, HP has unfortunately implemented a behaviour that is inconsistent, where { 1 2 } 3 + gives { 1 2 3 } but { 1 2 } 3 * gets { 3 6 }.

+ is the unique operation that doesn’t work on lists. I replace it by +/- – automatically. It’s just a habit now.

(08-01-2023 01:11 AM)c3d Wrote:  Interactively, there is a reserved primary key on the keyboard at the moment, EEX. It does nothing while not editing. The intent is to have that key, where the yellow label is "DISP", cycle between various visible representations of the first level of the stack. For complex, it would switch between rectangular and polar, between fractions and decimal, and between vectors and lists. So if you want to run a bunch of operations on a list interactively, you hit EEX, turn it to a vector, do your operations, and then turn it back to a list. At least that's how I see things at the moment.

Interesting. I would be perfectly happy with this solution. Smile
But, if operations on lists are replaced by operations on vectors, does that mean that
[ 1 2 ] [ 3 4 ] * gives [ 3 8 ] ?


(08-01-2023 01:11 AM)c3d Wrote:  The good reason is that on real HP48, I keep mixing store and recall and overwriting variables in the VAR menu. For whatever reason, my brain is wired backwards with that specific functionality.

I can understand. On my side I’ve never got used to the 3 rows menu of newRPL, because I regularly hit the wrong key. I can only use newRPL with the single row menu option.

So, this is typically a user preference. Here a flag for controlling the variable menu could be interesting.

(08-01-2023 01:11 AM)c3d Wrote:  I wonder if I should spend any time on stuff like 1-complement, which the HP16 supported. I've never had any use for it.

I think that « #0 1 - XOR » gives the 1-complement. So, if a user needs this functionality, he can easily write this program.

Jean-Charles
Find all posts by this user
Quote this message in a reply
08-04-2023, 03:23 AM
Post: #67
RE: DB48X: HP48-like RPL implementation for DM42
Is it possible to create "directories" in DB48x like you could on the other 48 series calcs?

The 48G had an interactive method to do so with a tick to say you were creating a directory, but I think there is a command (CRDIR or MKDIR) that let you do it too I think...
Find all posts by this user
Quote this message in a reply
08-05-2023, 01:10 AM
Post: #68
RE: DB48X: HP48-like RPL implementation for DM42
(08-04-2023 03:23 AM)spiff72 Wrote:  Is it possible to create "directories" in DB48x like you could on the other 48 series calcs?

The 48G had an interactive method to do so with a tick to say you were creating a directory, but I think there is a command (CRDIR or MKDIR) that let you do it too I think...

I looked it up. You could create a directory called TESTDIR by entering

Code:
'TESTDIR'
CRDIR

I tried it on DB48x and when you hit enter after the CRDIR command it just ends up with the stack showing:

Code:
'TESTDIR'
'CRDIR'
Find all posts by this user
Quote this message in a reply
08-05-2023, 05:10 AM
Post: #69
RE: DB48X: HP48-like RPL implementation for DM42
(08-05-2023 01:10 AM)spiff72 Wrote:  
(08-04-2023 03:23 AM)spiff72 Wrote:  Is it possible to create "directories" in DB48x like you could on the other 48 series calcs?

The 48G had an interactive method to do so with a tick to say you were creating a directory, but I think there is a command (CRDIR or MKDIR) that let you do it too I think...

I looked it up. You could create a directory called TESTDIR by entering

Code:
'TESTDIR'
CRDIR

I tried it on DB48x and when you hit enter after the CRDIR command it just ends up with the stack showing:

Code:
'TESTDIR'
'CRDIR'

I worked on this, it's almost completely working. There are still a couple of tests that give me funny results I need to investigate. But this will be in 0.4.1.
Find all posts by this user
Quote this message in a reply
08-05-2023, 05:30 PM
Post: #70
RE: DB48X: HP48-like RPL implementation for DM42
(08-05-2023 05:10 AM)c3d Wrote:  
(08-05-2023 01:10 AM)spiff72 Wrote:  I looked it up. You could create a directory called TESTDIR by entering

Code:
'TESTDIR'
CRDIR

I tried it on DB48x and when you hit enter after the CRDIR command it just ends up with the stack showing:

Code:
'TESTDIR'
'CRDIR'

I worked on this, it's almost completely working. There are still a couple of tests that give me funny results I need to investigate. But this will be in 0.4.1.
Awesome! Thanks...
Find all posts by this user
Quote this message in a reply
08-07-2023, 10:24 PM
Post: #71
RE: DB48X: HP48-like RPL implementation for DM42
(08-05-2023 05:30 PM)spiff72 Wrote:  
(08-05-2023 05:10 AM)c3d Wrote:  I worked on this, it's almost completely working. There are still a couple of tests that give me funny results I need to investigate. But this will be in 0.4.1.
Awesome! Thanks...

Please give it a try, it should be working now.
https://github.com/c3d/DB48X-on-DM42/rel...tag/v0.4.1
Find all posts by this user
Quote this message in a reply
08-07-2023, 10:34 PM
Post: #72
RE: DB48X: HP48-like RPL implementation for DM42
(08-01-2023 09:32 PM)Helix Wrote:  
(08-01-2023 01:11 AM)c3d Wrote:  Annoying, isn't it? Well, it means the video is "successful".

"Successful" ? With only 200 views? The threshold is very low! Big Grin
This is the first time I see so much ads in a video. I wonder if this is due to some settings when you posted it on Youtube.

I strongly suspect the "setting" is just the length of the video.

Quote:
(08-01-2023 01:11 AM)c3d Wrote:  For lists, HP has unfortunately implemented a behaviour that is inconsistent, where { 1 2 } 3 + gives { 1 2 3 } but { 1 2 } 3 * gets { 3 6 }.

+ is the unique operation that doesn’t work on lists. I replace it by +/- – automatically. It’s just a habit now.

I've been thinking a bit more about this. I share the general frustration about the ambiguity on "+". That being said, I think that + to add items to a list is also extremely useful, so I don't want to change that.

Quote:
(08-01-2023 01:11 AM)c3d Wrote:  Interactively, there is a reserved primary key on the keyboard at the moment, EEX. It does nothing while not editing. The intent is to have that key, where the yellow label is "DISP", cycle between various visible representations of the first level of the stack. For complex, it would switch between rectangular and polar, between fractions and decimal, and between vectors and lists. So if you want to run a bunch of operations on a list interactively, you hit EEX, turn it to a vector, do your operations, and then turn it back to a list. At least that's how I see things at the moment.

Interesting. I would be perfectly happy with this solution. Smile
But, if operations on lists are replaced by operations on vectors, does that mean that
[ 1 2 ] [ 3 4 ] * gives [ 3 8 ] ?

Yes. This gives an invalid dimension on HP48.

Quote:
(08-01-2023 01:11 AM)c3d Wrote:  The good reason is that on real HP48, I keep mixing store and recall and overwriting variables in the VAR menu. For whatever reason, my brain is wired backwards with that specific functionality.

I can understand. On my side I’ve never got used to the 3 rows menu of newRPL, because I regularly hit the wrong key. I can only use newRPL with the single row menu option.

Maybe the row highlighting of DB48X will help in that respect.

In a single-menu option, would you prefer:

a) still 18 functions for the 6 keys, with the menu changing as you hit shift

b) only 6 functions for the 6 keys, even if that means hitting the "overflow" key more (meaning the right arrow that appears on F6 when there are more entries than can fit, replacing the NXT key on the HP48)

c) something else

Quote:So, this is typically a user preference. Here a flag for controlling the variable menu could be interesting.

(08-01-2023 01:11 AM)c3d Wrote:  I wonder if I should spend any time on stuff like 1-complement, which the HP16 supported. I've never had any use for it.

I think that « #0 1 - XOR » gives the 1-complement. So, if a user needs this functionality, he can easily write this program.
Find all posts by this user
Quote this message in a reply
08-07-2023, 11:01 PM
Post: #73
RE: DB48X: HP48-like RPL implementation for DM42
(08-07-2023 10:24 PM)c3d Wrote:  
(08-05-2023 05:30 PM)spiff72 Wrote:  Awesome! Thanks...

Please give it a try, it should be working now.
https://github.com/c3d/DB48X-on-DM42/rel...tag/v0.4.1

Great! I will check it out later tonight.
Find all posts by this user
Quote this message in a reply
08-08-2023, 08:41 AM
Post: #74
RE: DB48X: HP48-like RPL implementation for DM42
a) still 18 functions for the 6 keys, with the menu changing as you hit shift
Find all posts by this user
Quote this message in a reply
08-08-2023, 12:51 PM
Post: #75
RE: DB48X: HP48-like RPL implementation for DM42
(08-08-2023 08:41 AM)Chr Yoko Wrote:  a) still 18 functions for the 6 keys, with the menu changing as you hit shift

I prefer a) as well!
Find all posts by this user
Quote this message in a reply
08-09-2023, 02:47 PM (This post was last modified: 08-09-2023 02:48 PM by Helix.)
Post: #76
RE: DB48X: HP48-like RPL implementation for DM42
(08-07-2023 10:34 PM)c3d Wrote:  
(08-01-2023 09:32 PM)Helix Wrote:  + is the unique operation that doesn’t work on lists. I replace it by +/- – automatically. It’s just a habit now.

I've been thinking a bit more about this. I share the general frustration about the ambiguity on "+". That being said, I think that + to add items to a list is also extremely useful, so I don't want to change that.

ADD or + to add an element to a list is not a concern for me, as long as there is a simple way to do additions of individual elements of lists (or vectors).

(08-07-2023 10:34 PM)c3d Wrote:  
(08-01-2023 09:32 PM)Helix Wrote:  Interesting. I would be perfectly happy with this solution. Smile
But, if operations on lists are replaced by operations on vectors, does that mean that
[ 1 2 ] [ 3 4 ] * gives [ 3 8 ] ?

Yes. This gives an invalid dimension on HP48.

Great! It is true that mathematical calculations make more sense or vectors than on lists.

(08-07-2023 10:34 PM)c3d Wrote:  
(08-01-2023 09:32 PM)Helix Wrote:  I can understand. On my side I’ve never got used to the 3 rows menu of newRPL, because I regularly hit the wrong key. I can only use newRPL with the single row menu option.

Maybe the row highlighting of DB48X will help in that respect.

In a single-menu option, would you prefer:

a) still 18 functions for the 6 keys, with the menu changing as you hit shift

b) only 6 functions for the 6 keys, even if that means hitting the "overflow" key more (meaning the right arrow that appears on F6 when there are more entries than can fit, replacing the NXT key on the HP48)

c) something else

Here I must emphasize that it’s a minor issue for me. But I will try to answer your question.

a) It seems that the single-menu option that you suggest would apply to every menu.
In this case, this would require that if the user doesn’t memorize the functions of the shifted keys, he must press the shift key, inspect the menu, press a second time the shift key if the desired function doesn’t appear, if it still doesn’t appear and there are more than 18 items in the menu, press the F6 key, and so on… I’m not sure that it would be better than solution b)

b) of course requires more frequent F6 key presses, but after all this is how the 48 series works, except that there are 6 items available in each page instead of 5 in this solution.

c) I think the current solution with the 3-row menu is the best one in general. I thought that for the variables menu, and only for it, it was unnecessary to display 3 rows, but obviously it’s useful for you.
Maybe making an option just for this menu is not worth the effort, or is too complicated?

My concern is that I like viewing as many stack levels as possible, or as many program lines as possible. The HP 50g is a big improvement in this respect compared to the 48 series.
But there are probably workarounds for that.
I’ve seen in the video that hitting the ON key cancels the menu. In combination with the last menu function, this could be a solution.

But this can’t work in edit mode. Maybe the workaround is to display an arbitrary single menu to view more lines, and then use the last menu function to return to the previous menu?
I should probably buy a DM42, and experiment...

Jean-Charles
Find all posts by this user
Quote this message in a reply
08-09-2023, 10:00 PM
Post: #77
RE: DB48X: HP48-like RPL implementation for DM42
(08-09-2023 02:47 PM)Helix Wrote:  
(08-07-2023 10:34 PM)c3d Wrote:  Maybe the row highlighting of DB48X will help in that respect.

In a single-menu option, would you prefer:

a) still 18 functions for the 6 keys, with the menu changing as you hit shift

b) only 6 functions for the 6 keys, even if that means hitting the "overflow" key more (meaning the right arrow that appears on F6 when there are more entries than can fit, replacing the NXT key on the HP48)

c) something else

Here I must emphasize that it’s a minor issue for me. But I will try to answer your question.

I ended up implementing both modes.
   

There is also an option for changing the appearance of menus
       

Quote:a) It seems that the single-menu option that you suggest would apply to every menu.
In this case, this would require that if the user doesn’t memorize the functions of the shifted keys, he must press the shift key, inspect the menu, press a second time the shift key if the desired function doesn’t appear, if it still doesn’t appear and there are more than 18 items in the menu, press the F6 key, and so on… I’m not sure that it would be better than solution b)

b) of course requires more frequent F6 key presses, but after all this is how the 48 series works, except that there are 6 items available in each page instead of 5 in this solution.

c) I think the current solution with the 3-row menu is the best one in general. I thought that for the variables menu, and only for it, it was unnecessary to display 3 rows, but obviously it’s useful for you.

FWIW, I started with 2-row menus, except on the VAR menu where I had 3. My initial rationale was that third-row items needed two prefix keys, which was not beneficial over F6 or F6-Shift (also two prefix keys worst case).

BUT practice and experience showed a few things:

1) It's much easier to cycle with shift. You don't have to think whether something is behind shift or behind F6. Also, you never know how many times to press F6 before returning to the first menu, whereas for shift, it's always three shifts to cycle.

2) Many menus have less than 18 items, and fit in three rows, so no F6. To the point where I'm thinking that the standard menus might in the end all be less than 18 items. The number of menus that naturally have less than 12 items is much smaller.

3) There is a lot of value, at least initially, in having the functions shown on screen. This makes it easier to predict a shift-based key sequence than to predict an F6-based key sequence.

Quote:Maybe making an option just for this menu is not worth the effort, or is too complicated?

As explained above, it's not difficult at all, the code supports it very well, but it did not really work well in practice.

Quote:My concern is that I like viewing as many stack levels as possible, or as many program lines as possible. The HP 50g is a big improvement in this respect compared to the 48 series.

This has a lot of value. This is a reason for the font selection options.

Quote:But there are probably workarounds for that.
I’ve seen in the video that hitting the ON key cancels the menu. In combination with the last menu function, this could be a solution.

But this can’t work in edit mode. Maybe the workaround is to display an arbitrary single menu to view more lines, and then use the last menu function to return to the previous menu?
I should probably buy a DM42, and experiment...

You sure should. Or you can use the simulator.
Find all posts by this user
Quote this message in a reply
08-09-2023, 11:14 PM
Post: #78
RE: DB48X: HP48-like RPL implementation for DM42
Thank you for your answers.
The simulator requires that I compile the source, which is not in my capabilities.
But now I wonder if I could simply load the new firmware on a DM42, or if mastering Linux and compilation subtleties is also required here. I see nothing in the repository...

Jean-Charles
Find all posts by this user
Quote this message in a reply
08-09-2023, 11:33 PM
Post: #79
RE: DB48X: HP48-like RPL implementation for DM42
(08-09-2023 11:14 PM)Helix Wrote:  Thank you for your answers.
The simulator requires that I compile the source, which is not in my capabilities.
But now I wonder if I could simply load the new firmware on a DM42, or if mastering Linux and compilation subtleties is also required here. I see nothing in the repository...

Loading the firmware on a DM42 is pretty straightforward. There are simple instructions available for some of the other alternative firmware options (like C47 and WP43).

It's basically a matter of copying two files to the calculator (it shows up as a removeable drive when plugged in via USB cable and the menu options on the calc are selected to activate the USB drive). Drag the two files to the root of the calc, eject the removeable drive on the computer, execute a few commands on the calc, and you are done.
Find all posts by this user
Quote this message in a reply
08-10-2023, 12:12 AM
Post: #80
RE: DB48X: HP48-like RPL implementation for DM42
I was looking for these two files, and they are in the page linked in post #71. Big Grin I’m still not familiar with Github!

Jean-Charles
Find all posts by this user
Quote this message in a reply
Post Reply 




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