Excel is wrong in calculating -x^2
If you type in for example =-6^2, Excel gives you 36. This is incorrect. Excel is assuming you mean =(-6)^2. But -6^2 is different.
You can see this when you factorise. -6^2 = (-6)*(+6) = -36.
Whereas (-6)^2 = (-6)*(-6)=36.
Now if you type in = 0-6^2, only then does it give you the correct answer of -36.
This error goes against millennia of algebraic convention.
Plot the graph y=-x^2-7x-12 and then plot y=-7x-x^2-12. These two expressions are identical, yet Excel gives very different traces (the latter of the two gives the correct graph).
Another way to correct -x^2 would be to type =-(x^2) but you shouldn't have to. You don't write it out that way if you're plotting quadratics.
Peter McAnena commented
It doesn't really go against algebraic convention. It's confusing though because the "-" symbols in "-6" and "0 - 6" are actually two different operators (even though Excel uses the same character).
The symbol in "-6" is "unary minus", which makes a number negative. It has a higher precedence than exponentiation, so in -6 ^ 2 you're taking -6, and then squaring it, producing 36.
The symbol in "0 - 6" is "binary minus", which calculates the difference between two numbers. This has lower precedence than exponentiation, so in "0 - 6^2" you're squaring 6 (producing 36) and then subtracting that from zero, hence -36.
Similarly, in your quadratic examples, "y=-x^2-7x-12" contains a binary minus before the 7, but "y=-7x-x^2-12" contains a unary minus before the 7, so they are subtly different. It's also only fair to point out that these expressions are not valid Excel formulae, so it's not really a fair example.
Some languages use a separate symbol for unary minus, such as ¬ or ~, but it's too late to introduce that in Excel now. In a professionally printed mathematics textbook you'll notice that unary and binary minus sings are not identical: binary minus is spaced more widely and is usually longer.
Harlan Grove commented
This was argued incessantly in USENET newsgroups decades ago.
Every programming language gets to set its own operator precedence. Excel sets unary minus higher precedence than any other operator. THIS WON'T CHANGE because doing so would break far too many existing spreadsheets, so the ONLY sensible course is to accept that this is just how Excel works. Putting this another way, if you insist on this change, don't hold your breath.
Yes, negation means (-1)* and subtraction means minus. If use two different characters for negation and subtraction everything will be logical.
The thing is that Excel has either - as an operation for subtrac..... and for the negative of a number
It depends on where the "-" is locate on a formula for bein interpreted on way or another...
As an engineer with a lot of Math studied I share your appreciation but Excel apparently has decided to keep both versions of "-"
There is order in which calculate operators and the negative operators is evaluated before the ^ ,
but the ^ is evaluated before the subtract (funny: first - then ^ then -)
=-5^2-4^2 wil evaluate the first - as -5 and the second as an operation for subtract.
Check the different results for:
=-5^2-4^2 =-5^2--4^2 =-5^3-4^3 =-5^3--4^3
[Deleted User] commented
In the given example Excel is doing right.
Consider that a leading minus cannot be convertet to an operator (as it is in 0-6^2) becasue one of the operands is missing, so Excel interprets it as a part of the number. So "-6^2" becomes (-6)^(2) or "--6^2" becomes (-(-6))^(2) in this way no matter how much "-" you use you'll always get 36.
The correct way of getting -36 without using parenthesis is simply to type: -1*6^2
If you type the string "-6" into a cell you are pleased with the behaviour that it is convertet to the integer -6 rather than getting an "incomplete formula error", right?
Actually second link shall be http://mathforum.org/library/drmath/view/69058.html
That's a great question why people who designed Excel more than 30 years ago decided what negation is to be performed before exponentiation. But that's what they did, the order of Excel operations is described here https://support.office.com/en-gb/article/the-order-in-which-excel-performs-operations-in-formulas-28eaf0d7-7058-4eff-a8ea-0a835fafadb8. By the way, exactly the same logic is used for Google Sheets, it also returns +36 if type =-6^2.
That is almost 20-years old but quite interesting discussions about the subject on Math Forum https://support.office.com/en-gb/article/the-order-in-which-excel-performs-operations-in-formulas-28eaf0d7-7058-4eff-a8ea-0a835fafadb8.
I'm very suspicious what that will be ever changed. Same with year 1900 - someone who designed Excel decided what that is the leap year, which is not. That issue is also known for about 30 years, but it never will be corrected due to compatibility. There are only support articles which explain what we have what we have and have to live with that.