Post Reply 
Unary minus precedence preference
07-23-2014, 07:59 PM
Post: #17
RE: Unary minus precedence preference
(07-23-2014 01:45 PM)Claudio L. Wrote:  Finally, a well funded response. So one good reason to choose -2^2=-4 is to avoid unnecessary parenthesis and the ambiguity of:
x-x^2 producing a different result from -x^2+x.
Notice the first minus is a subtraction, while the second minus becomes a unary minus just by commutativity, so they are two different operators but the expressions are mathematically equivalent and should give the same result.
This alone is reason enough to discard the other option as "incorrect", as a CAS cannot give 2 different results just for swapping terms in the expression.

I completely agree with you, but let me play devil's advocate here. One could argue that if -2^2=4, it would avoid the unnecessary parentheses in (-2)^2. Similarly, one could argue that -x^2 + x turned around is actually x + -x^2 which doesn't avoid the ambiguity.

My point is simply that it really boils down to convention. Never-the-less, I'm going to use your example in class next time as a way of convincing students that the standard convention makes sense. :-)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Unary minus precedence preference - Wes Loewer - 07-23-2014 07:59 PM



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