Pfft. It would seem that my vocabulary is computationally slanted :P You are correct, by "unsigned number" I was all along referring to a "semantically absolute value".
Pfft. It would seem that my vocabulary is computationally slanted :P You are correct, by "unsigned number" I was all along referring to a "semantically absolute value".
Every definition of a function I've ever seen implies a single output value, and sqrt is just another function. You're saying a function returning 2 values, I'm saying it returns a single value.
As I said in post #13, technically sqrt returns a set containing a number and another number of the same value but negated (also, a set with 2 numbers is still a single return value, technically all functions have one input and one output). But in practice and application it is much easier to think of it as a single number with an unknown sign.
O_oBut in practice and application it is much easier to think of it as a single number with an unknown sign.
I agree, to a point, with that statement.
Considering a practical application, your entry into the discussion was to offer, in your opinion, a more palatable definition. Your claim of "wrongness" for a different palatable definition was my problem because your definition is also wrong.
If you intend(ed) to speak in the simple for the sake of easy consumption, I'd agree that the result of "square rooting" is unsigned in that one could coerce the signedness of the result for any particular solution.
Soma
Last edited by phantomotap; 09-16-2014 at 09:58 PM.
“Salem Was Wrong!” -- Pedant Necromancer
“Four isn't random!” -- Gibbering Mouther
Only programmers could debate so hard over something so trivial.
Yeah, I'm honestly really surprised this topic grew as much as it did. I was expecting like 3 posts at a maximum.
pow(x,1/2) and pow(x,1/3) in C will both return 1.0, unless x is zero, since 1/2 and 1/3 are both integers equal to zero. pow() only returns a single value.
As to the mathematics of the square root.
1) A square root of a value x is a value that, when multiplied by itself, gives x. If x is a real positive value, it has two square roots - one positive and one negative.
2) Conventionally, the square root sign, as in
denotes what is formally called the "principal square root" of x, which is the positive square root of x. A lot of math teachers, however, incorrectly describe this as "the square root". The negative of the principal square root is also a square root.
3) Negative real values also have two square roots, which are called imaginary (and multiplying one of those by -1 yields the other) and one of them (it doesn't matter which one) is given the mathematical symbol "i" so the other one is denoted by "-i". Imaginary and real values can be added, so 2+3i denotes a "complex value" equal to the "real value 2 plus 3 times i".
If you start talking about the nth root (where n is a positive integer), then then all complex values (including all real values) except 0 have n of them. So any value has three cube roots, four fourth roots, etc etc. At most one of those is real. The rest are complex (i.e. obtained by combining real and imaginary values).
In C, things with the sqrt() function are much more prosaic. If x is positive value of type double, then sqrt(x) yields the principal (non-negative) square root of x. If x is negative, sqrt(), a domain error occurs.
(The 1999 C standard also has functions like csqrt() that work with complex values).
Which is really important in order to understand the formal definition of the square root within the Real number system. The result of a square root, as it is formally defined in mathematics, is a set of two principal square roots. One being negative and the other positive.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
I think you meant "set of two square roots", though it does not seem to account for the case of zero, which is in the set of real numbers.Originally Posted by Mario F.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I did mean a set of two principal square roots.
Meanwhile the square root of zero could be defined the same. The existence of the negative square root of 0 shouldn't be considered an anomaly in elementary algebra (in which 0 is neither positive or negative). The set will still satisfy all elementary algebraic equations.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
But a principal square root is non-negative.Originally Posted by Mario F.
Not an anomaly, but the negative square root of 0 is 0, which as you noted is neither positive nor negative. Since the members of a set are distinct, it thus seems to me that "set of two square roots" does not account for repetition in the square roots of 0.Originally Posted by Mario F.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
It's important to remember that the square root is an operation waiting to be calculated. While we do refer to square roots in the real number line, we do so for convenience. The actual number is the result of that calculation. In other words, the square root symbol is the symbol of an operation, it is not the actual representation of a Real number. So, while the principal square root of 16 returns 4, the negative of the principal square root of 16 returns -4.
The square root of a number returns the principal square root and the negative of the principal square root. I should have been more clear about that in post #25, since I was talking about formal definitions.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
I am not a mathematician, so I would like to check: are you stating this as something that mathematicians generally hold to be true, or is this the way you understand it but (other) mathematicians do not necessarily agree with you? I ask because the Wolfram website starts explaining the concept of square root with "a square root of a number x is a number r such that r**2 = x", rather than "a square root of a number x is an operation to compute r such that r**2 = x" (I use ** to denote exponentiation). I am also cautious about the notions of "the actual number" and "the actual representation of a Real number" since real numbers have multiple representations.Originally Posted by Mario F.
Yes, this is what I meant when I assumed that you meant "two square roots" rather than "two principal square roots". For a positive real number, the negative of its principal square root is not its principal square root, so your statement in post #25 is wrong.Originally Posted by Mario F.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)