WP43 News

This area is for discussion about these families of custom high-end Scientific Calculator applications for SwissMicros devices.
H2X
Posts: 885
Joined: Tue Apr 25, 2017 8:00 am
Location: Norðvegr
Contact:

Re: 43S News

Post by H2X »

dlachieze wrote:
Fri Nov 26, 2021 10:54 am
I just verified the following on Plus42:
  • It’s possible to create a variable named "PI÷4", "÷" being the division operator.
  • In an equation "PI÷4" is interpreted as PI divided by 4 and not as the variable "PI÷4"
So it seems that in equations the operator symbols are just considered as operators.
That's regardless of any spaces before/after the operator symbols - or not? Just making sure I understand...
What is the metric tensor in imperial units?
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

I tested without any space before or after the operator symbol, exactly as written above.

And to provide some more details: as a user the context matters.
In a program I may want to have a variable named "PI÷4" to store the numerical value if it’s used many times in my program, but in an equation I expect "PI÷4" to be interpreted as PI divided by 4.
DM42: 00425 - DM41X: β00066 - WP43: 00042
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

While Thomas' Plus42 is certainly a high quality software by his outstanding experience, I tend to disagree about the handling of your examplary variable "PI÷4". IMHO, if I'm allowed to define a user variable "PI÷4" in whatever system then I expect this variable to hold system wide (let's forget local variables for the time being to keep things easy). So if I employ something like "PI÷4" on the same system in an equation thereafter, then this shall be interpreted as said user defined variable, nothing else. Any other interpretation looks a bit far from the mathematics they taught me long ago.
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
H2X
Posts: 885
Joined: Tue Apr 25, 2017 8:00 am
Location: Norðvegr
Contact:

Re: 43S News

Post by H2X »

dlachieze wrote:
Fri Nov 26, 2021 11:36 am
In a program I may want to have a variable named "PI÷4" to store the numerical value if it’s used many times in my program,
I wouldn't. Firstly, it is not a valid name in the programming languages I use, so maybe it's just my conditioning. Secondly, I wouldn't want a name which I could misunderstand later on.

Just saying, I'm not trying to sell anything to anybody, and Walter does what he wants anyway.
dlachieze wrote:
Fri Nov 26, 2021 11:36 am
but in an equation I expect "PI÷4" to be interpreted as PI divided by 4.
I totally agree.
What is the metric tensor in imperial units?
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

I'll be certainly not easily convinced by inconsistencies. Why should we adopt them?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: 43S News

Post by Thomas Okken »

Indeed. That particular inconsistency stems from the fact that the HP-42S allows absolutely everything in its variable names; there's no reason for it not to, since there is never any ambiguity between names and operators there. But then bolting an HP-17B-like equation system onto it, there are bound to be a few places where things don't quite mesh. That's life when backward compatibility is a central requirement.
H2X
Posts: 885
Joined: Tue Apr 25, 2017 8:00 am
Location: Norðvegr
Contact:

Re: 43S News

Post by H2X »

Walter wrote:
Fri Nov 26, 2021 1:19 pm
I'll be certainly not easily convinced by inconsistencies. Why should we adopt them?
If this question is to me, I am not voting for inconsistencies. AFAIC, operators should be consistently treated as operators, and not allowed in variable names which would introduce ambiguity.

That's all, and I'll (learn to) live with whatever Walter chooses to give us.
What is the metric tensor in imperial units?
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: 43S News

Post by Walter »

There are a couple of nice examples on pp. 228ff of the OM making use of "/" in variable names. There, naming of variables to be used in programs is seen to be most easy and suiting the respective formulas.

For variables to be used in equations, names of such kind will occur less frequently. With only equations in mind, we would probably not have started this discussion. But here we are, and we shall watch the system as a whole.

It boils down to this, IMO: If we allow for slashes in names then we shall separate a name and a slash by a blank; if we don't want to do this, we can't allow slashes in names. What do you think?
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
dlachieze
Posts: 613
Joined: Thu May 04, 2017 12:20 pm
Location: France

Re: 43S News

Post by dlachieze »

If a blank is required to separate a name and a slash, then for coherence and consistency this rule should apply to all operators used in equations. The blank should be automatically added when entering the operator, in a similar way as what is done on the HP-48 when entering several commands on the command line.

So it may be much simpler to just not allow slashes in names if you want to keep variable names consistency between programming and equation modes.

Otherwise the Plus42 way is perfect for me.

PS: in the mathematics I was taught also long ago, "PI÷4" in an equation has only one interpretation: PI divided by 4.
DM42: 00425 - DM41X: β00066 - WP43: 00042
H2X
Posts: 885
Joined: Tue Apr 25, 2017 8:00 am
Location: Norðvegr
Contact:

Re: 43S News

Post by H2X »

Walter wrote:
Fri Nov 26, 2021 3:31 pm
It boils down to this, IMO: If we allow for slashes in names then we shall separate a name and a slash by a blank; if we don't want to do this, we can't allow slashes in names. What do you think?
I can think of only one alternative, which may not be good at all but here it is:

Some way to indicate that a variable name is exactly that, which in this case probably means some delimiter in both ends (since an operator might occur at both ends). That is the same job as spaces do now, so this doesn't add much value - other than perhaps relieving spaces of this duty, and also allowing space to be part of the variable name.

Bottom line is that the current way is probably good enough, since there is the need to deal with operator symbols as part of variable names.
What is the metric tensor in imperial units?
Post Reply