ebw said:
Ironically, a major stumbling block for beginners in computer science is that they have a muddled mental model of variable assignment. When they see an assignment statement like "x=2", a part of them confuses this with the equals sign in math. In mathematical writing, "x=2" is not a variable declaration but merely states that the two sides are equal (one declares a variable by using words like "let", "define", or sparingly, the shorthand ":=" symbol). So the sentence "x=2" holds no more or less information than "2=x". [One exception to this claim: in my own area of math, we often (ab)use the = sign in a way that is not symmetric when describing error estimates. We would write "x = O(n)" to mean that x is bounded by a multiple of n, when formally it would be more appropriate to use element inclusion. Consequently, even if one has "x = O(n)" and "y = O(n)" one cannot deduce that "x=y".] By contrast, in (declarative) programming languages it makes perfect sense to write "x=2" followed later by "x=3", which is mindboggling to a certain number of beginning students. And of course in most languages "2=x" would be an illegal assignment. |
That's why the notation x=O(n) is not so efficient and shouldn't be used. You should say that x= n h(n) with h(n) tending to a constant when n is getting large.
@dsgrue3: I have a good example for you, maybe it will be a good clue to understand why you cannot consider -2 as a solution even if it solves your equation x²=4.
We start from the equation x=2. Then we notice that if x is actually equal to 2, then x>0. But 3 is also greater than 0. Does it imply that 3 is equal to 0?
Of course not, because in the second step we have "weakened" the hypothesis by switching to an inequality, but we obviously didn't change the fact that x is the solution to the equation x=2. In your own case, you also "weakened" your first equation by taking another equation x²=4 which doesn't exactly replace you equation x=2.
This is just an example that you cannot "easily" replace a mathematical object by another, even if they look similar. Just like you cannot replace the function f(x)=x by the function f(x)=x²/x which is not defined for x=0.







