# Thread: My grandpa told me a good way to get the absolute value of a number was to...

1. 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". 2. 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. 3. Originally Posted by phantomotap That is not coincidence.

That is fact.

This fact arises because the very definition of roots and multiplication.
[/Edit]

Soma
If pow(x, 1/2) returns 2 values, then does pow(x, 1/3) also return 2 values? It would seem not, since the negative would not work for both cases. That is why I said it was coincidental. 4. Originally Posted by MacNilly 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. 5. But in practice and application it is much easier to think of it as a single number with an unknown sign.
O_o

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 6. Only programmers could debate so hard over something so trivial.  7. Yeah, I'm honestly really surprised this topic grew as much as it did. I was expecting like 3 posts at a maximum. 8. My --pedantic switch was on. 9. Originally Posted by MacNilly If pow(x, 1/2) returns 2 values, then does pow(x, 1/3) also return 2 values?
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). 10. Originally Posted by grumpy 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
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. 11. Originally Posted by Mario F.
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.
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. 12. 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. 13. Originally Posted by Mario F.
I did mean a set of two principal square roots.
But a principal square root is non-negative. Originally Posted by Mario F.
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.
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. 14. Originally Posted by laserlight But a principal square root is non-negative.
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. 15. Originally Posted by Mario F.
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.
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.
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.
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. Popular pages Recent additions 