HP Forums
(-) precedence - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not remotely HP Calculators (/forum-9.html)
+--- Thread: (-) precedence (/thread-19269.html)

Pages: 1 2 3 4 5


RE: (-) precedence - ijabbott - 12-13-2022 07:37 PM

(This applies to modern algebraic calculators that let you enter a whole expression on the input line.)

I think there would be less confusion by getting rid of the '(-)' key and providing some mechanism to for the user to indicate whether they are chaining the from the previous answer or not. The only ambiguous operator is '-' (and possibly '+' for symmetry). There are a few options:

(1). Always chain from the previous answer, automatically inserting 'Ans' (or equivalent) before the operator. Provide some way to suppress the automatic insertion of 'Ans' before an initial '-'. That could be done via a 'Shift', '-' sequence with the shifted function marked as '(-)'. So the '(-)' hasn't really gone away, but is only being used to suppress automatic insertion of 'Ans'.

(2). Only chain from the previous answer (automatically inserting 'Ans') for unambiguous binary operators, but not for an initial '-' which would require 'Ans' to be entered manually before the operator. Make it an unshifted key to reduce keystrokes. This eliminates the need for any keys (or shifted key functions) labelled '(-)'.

(3). Never chain from the previous answer automatically, requiring the user to press an 'Ans' key manually in order to chain from the previous answer. This may be seen as defying tradition and increasing the number of keystrokes, but is more operator-agnostic than (2). Again, there is no need for any keys (or shifted key functions) to be labelled '(-)'.

For all three options, the same thing could be done to '+' for symmetry with '-'.


RE: (-) precedence - Albert Chan - 12-18-2022 03:47 PM

(12-13-2022 03:59 PM)David Hayden Wrote:  If only we used a different symbol to signify that a number is negative, all this confusion would disappear.

This reminds me of Professor W.W. Sawyer's article: Things and Un-things.
The goal is to help children to understand negative numbers. (Does it really work?)

-2 apples = un-2 apples = 2 un-apples

Quote:If an un-thing and a thing meet, they wipe each other out.



RE: (-) precedence - KeithB - 12-19-2022 06:28 PM

(12-13-2022 03:59 PM)David Hayden Wrote:  If only we used a different symbol to signify that a number is negative, all this confusion would disappear. Unfortunately, we're stuck with the notation that we have.

You mean like the Prime as I mentioned above?


RE: (-) precedence - Matt Agajanian - 12-19-2022 08:56 PM

(12-13-2022 06:12 PM)Thomas Okken Wrote:  
(12-13-2022 03:59 PM)David Hayden Wrote:  we have an understandable aversion to saying that to square the number -2.3, you must put parentheses around it (-2.3)2)

That "we" does not include just about every single math textbook I have ever laid eyes on. See my example in the second post of this thread for a very typical example...

Definitely, there needs to be either yet another mathematical symbol or a noticeable indicator. I’m thinking that, for now, parentheses are the best option. Other than that, a new Unicode symbol needs to be concocted.


RE: (-) precedence - jhallen - 12-20-2022 04:09 AM

Check out Florian Cajori's book on the history of mathematical symbols:

https://monoskop.org/images/2/21/Cajori_Florian_A_History_of_Mathematical_Notations_2_Vols.pdf

See page 246 (pdf page 262). The idea of using different symbols for negative numbers was debated throughout the 19th and early 20th century. There were proposals for different signs for negative numbers. I would quote it, but the typography is difficult.

Also this is interesting (page 274): "Order of operations in terms containing both ÷ and X . If an arithmetical or algebraical term contains ÷ and X, there is at present no agreement as to which sign shall be used first. "It is best to avoid such expression." For instance, if in 24÷4X2 the signs are used as they occur in the order from left to right, the answer is 12: if the sign X is used first, the answer is 3. Some authors follow the rule that the multiplications and divisions shall be taken in the order in which they occur. Other textbook writers direct that multiplications in any order be performed first, then divisions as they occur from left to right. The term a÷bXb is interpreted by Fisher and Schwatt as (a÷b) Xb. An English committee recommends the use of brackets to avoid ambiguity in such cases"


RE: (-) precedence - Matt Agajanian - 12-20-2022 05:48 AM

This begs the question: Where and when did this discrepancy and ambiguity come from in the first place?


RE: (-) precedence - Matt Agajanian - 12-20-2022 06:07 AM

Just tried 6/2x3 on a TI-36X Pro, TI-30X Pro MathPrint, Sharp EL-W516X, and Casio fx-991ES Plus. All give 9 as the answer. Since school boards approve these, then multiply & divide in the order they occur must be the correct rule. If that's the case, add & subtract in the order they occur should also follow suit.


RE: (-) precedence - David Hayden - 12-21-2022 12:08 AM

(12-13-2022 06:12 PM)Thomas Okken Wrote:  
(12-13-2022 03:59 PM)David Hayden Wrote:  we have an understandable aversion to saying that to square the number -2.3, you must put parentheses around it (-2.3)2)

That "we" does not include just about every single math textbook I have ever laid eyes on. See my example in the second post of this thread for a very typical example...
Math textbooks use the convention we have, which is a very good thing. My point is that the convention is less than ideal because it very easily leads to the problem that's the subject of this thread.


RE: (-) precedence - Dan C - 12-21-2022 06:29 PM

(12-20-2022 06:07 AM)Matt Agajanian Wrote:  Just tried 6/2x3 on a TI-36X Pro, TI-30X Pro MathPrint, Sharp EL-W516X, and Casio fx-991ES Plus. All give 9 as the answer. Since school boards approve these, then multiply & divide in the order they occur must be the correct rule. If that's the case, add & subtract in the order they occur should also follow suit.

I tried this on my fx-4000P, and the answer is 9 also.
Is there a calculator that NOT give 9 as a result?


RE: (-) precedence - Matt Agajanian - 12-21-2022 10:28 PM

(12-21-2022 06:29 PM)Dan C Wrote:  
(12-20-2022 06:07 AM)Matt Agajanian Wrote:  Just tried 6/2x3 on a TI-36X Pro, TI-30X Pro MathPrint, Sharp EL-W516X, and Casio fx-991ES Plus. All give 9 as the answer. Since school boards approve these, then multiply & divide in the order they occur must be the correct rule. If that's the case, add & subtract in the order they occur should also follow suit.

I tried this on my fx-4000P, and the answer is 9 also.
Is there a calculator that NOT give 9 as a result?

Not one of mine. I do remember from years ago, on FB, of course, I saw a post demonstrating how different Sharps & Casios would give 6 or 9.


RE: (-) precedence - Joe Horn - 12-22-2022 03:03 AM

(12-21-2022 06:29 PM)Dan C Wrote:  
(12-20-2022 06:07 AM)Matt Agajanian Wrote:  Just tried 6/2x3 on a TI-36X Pro, TI-30X Pro MathPrint, Sharp EL-W516X, and Casio fx-991ES Plus. All give 9 as the answer. Since school boards approve these, then multiply & divide in the order they occur must be the correct rule. If that's the case, add & subtract in the order they occur should also follow suit.

I tried this on my fx-4000P, and the answer is 9 also.
Is there a calculator that NOT give 9 as a result?

The HP Prime, when it's in Textbook Entry mode, returns 1, because keying 6÷2×3 gets entered as \(\dfrac{6}{2\ast 3}\)


RE: (-) precedence - Sukiari - 12-22-2022 03:31 AM

Negative two squared is four. That’s just how it is. Don’t bother me or each other about it, Newton and Euler, both natural philosophers covered this hundreds of years ago. There is no ambiguity and planes are falling out of the sky because of crazy stuff like this.


RE: (-) precedence - Thomas Okken - 12-22-2022 05:43 AM

(12-22-2022 03:31 AM)Sukiari Wrote:  Negative two squared is four. That’s just how it is. Don’t bother me or each other about it, Newton and Euler, both natural philosophers covered this hundreds of years ago. There is no ambiguity and planes are falling out of the sky because of crazy stuff like this.

That's contributing nothing to the conversation. The laws of mathematics are not being denied, we're talking about mathematical notation, and that is something that can be codified any way at all.

I personally find it a bit mystifying that there are people who have such a problem accepting that the standard notation gives lower precedence to minus (both unary and binary) than to exponentiation, but here we are. How the standard notation works is not up for debate, but how it should work can, of course, be debated endlessly.


RE: (-) precedence - Matt Agajanian - 12-22-2022 07:47 AM

(12-22-2022 03:03 AM)Joe Horn Wrote:  
(12-21-2022 06:29 PM)Dan C Wrote:  I tried this on my fx-4000P, and the answer is 9 also.
Is there a calculator that NOT give 9 as a result?

The HP Prime, when it's in Textbook Entry mode, returns 1, because keying 6÷2×3 gets entered as

I’ve got the iOS version of the Prime and I get that same \(\dfrac{6}{2\ast 3}\) thing.


RE: (-) precedence - Joe Horn - 12-22-2022 01:25 PM

Lest the HP Prime be mocked for 6/2*3 turning into \(\dfrac{6}{2\ast 3}\) in Textbook Entry mode (but not in Algebraic Entry mode), please note that the same occurs on the RPL models HP 48/49/50 in the EquationWriter but not on the command line between single quotes:

EQW, 6/2*3 ENTER EVAL --> 1
'6/2*3' ENTER EVAL --> 9


RE: (-) precedence - Sukiari - 12-22-2022 03:16 PM

(12-22-2022 05:43 AM)Thomas Okken Wrote:  
(12-22-2022 03:31 AM)Sukiari Wrote:  Negative two squared is four. That’s just how it is. Don’t bother me or each other about it, Newton and Euler, both natural philosophers covered this hundreds of years ago. There is no ambiguity and planes are falling out of the sky because of crazy stuff like this.

That's contributing nothing to the conversation. The laws of mathematics are not being denied, we're talking about mathematical notation, and that is something that can be codified any way at all.

I personally find it a bit mystifying that there are people who have such a problem accepting that the standard notation gives lower precedence to minus (both unary and binary) than to exponentiation, but here we are. How the standard notation works is not up for debate, but how it should work can, of course, be debated endlessly.

Negative two is negative two, you don’t expand that to negative one times two. They might work out to be the same but -2 is not -1*2.

Glad I could clear this up. Sadly planes are falling out of the sky because not enough people get the message.


RE: (-) precedence - Maximilian Hohmann - 12-22-2022 05:46 PM

Hello!

(12-22-2022 03:16 PM)Sukiari Wrote:  Glad I could clear this up. Sadly planes are falling out of the sky because not enough people get the message.

No, they don't, because those who make them are not too lazy to use parentheses :-) Which was already written three pages up in this thread.

Regards
Max


RE: (-) precedence - Albert Chan - 12-22-2022 06:05 PM

(12-22-2022 03:16 PM)Sukiari Wrote:  Negative two is negative two, you don’t expand that to negative one times two.
They might work out to be the same but -2 is not -1*2.

BTW, treating -x ≡ (-1)*x placed unary minus operator precedence below POW, but above MUL/DIV/MOD.

This might clear the confusion. (unary minus is an operator, not part of number)

Order of Operations: Common Misunderstandings
Where do negatives fit in? Wrote:If you approach the idea starting with numerical expressions like -3^2, you are thinking of -3 as a number and assuming that the expression says to square it. If you approach it first using variables, having first discovered that "-" in a negative number is actually an operator, then it is easier to see why -x^2 should be taken as the negative of the square. So I'll start with the latter, and then it becomes natural to treat numbers the same way we treat variables.

The point here is that in arithmetic, we see the negative sign as part of the number (“the number I’m attached to is negative”); in algebra, we see it primarily as an operator (“negate the thing that follows”). And the convention arises in the latter context. It isn’t primarily meant for use with numbers, but with variables.

We wanted precedence order match convention, so that we can enter math expressions, WYSIWYG.
Otherwise, why bother with precedence rules, and the codes to make it happen?


RE: (-) precedence - ijabbott - 12-22-2022 09:17 PM

As operators, unary + and - are unusual because they can undergo precedence inversion when required for an expression to make sense. Let's assume unary + and - have precedence between multiplication and exponentiation. Then in 2^-2^2, the - has lower precedence than the ^ to the right, but higher precedence than the ^ to the left (otherwise the expression wouldn't make sense), producing 2^(-(2^2)).


RE: (-) precedence - Albert Chan - 12-23-2022 12:02 AM

Hi, ijabbott

If we pickup tokens in reversed order, "precedence inversion" / "not making sense" does not happen.

How to distinguish subtraction from negation
Quote:If you can subtract, do it; if you can’t, then take it as a negation. Subtraction has priority.

Scanning backward, it will handle (op +/-) without issue.

2^-3^4
2^-(3^4)
2^(-(3^4))

2*-3/4
(2*-3)/4
(2*(-3))/4