Hey mathematicians, why is (odd integer) root of a negative number undefined behaviour?
_____
³?-27 = -3 ?
-3 · -3 = 9
9 · -3 = -27
Hey mathematicians, why is (odd integer) root of a negative number undefined behaviour?
_____
³?-27 = -3 ?
-3 · -3 = 9
9 · -3 = -27
Why do you say it's undefined? My desktop calculator works fine with odd roots of negative numbers.
EDIT: FYI, you posted in the Math & Physics forum. Do you perhaps have a programming question, instead?
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.
You don't forget how to play when you grow old; you grow old when you forget how to play.
What is the context of the undefined behavior? Particular program or language? Calculator?
"I can't believe I'm defending logic to a turing machine." - Kent Woolworth [Other Space]
If you're using a software to compute it and it answers undefined, maybe it has a bug. Check this post: http://math.stackexchange.com/questions/25528/cubic-root-of-negative-numbers
Even Wolfram Alpha had a bug because of other possible answers (complex numbers), but it looks like now it shows you the real one and there's an option to check the complex ones too.
Hey mathematicians, why is (odd integer) root of a negative number undefined behaviour?
_____ ³?-27 = -3 ? -3 · -3 = 9 9 · -3 = -27
Is this becoming a hobby of yours? You ask why something is not the way it should be, but it actually IS the way it should be. You can initialize multi-dimensional arrays in C or C++ to zero by specifying only the first element, and the odd-integer root of a negative number is perfectly well defined.
Good old Windows calculator:
It is a problem of the Windows Vista Calculator then. In Windows 7 it works perfectly.
Just out of curiosity, try: (-27)^(1/3) in the calculator to see if you get an answer.
“We should forget about small efficiencies, say about 97% of the time; premature optimization is the root of all evil” - Donald E. Knuth, Structured Programming with go to Statements
"First you learn the value of abstraction, then you learn the cost of abstraction, then you're ready to engineer" - Ken Beck, Twitter
Good old Windows calculator:
It is a problem of the Windows Vista Calculator then. In Windows 7 it works perfectly.
Just out of curiosity, try: (-27)^(1/3) in the calculator to see if you get an answer.
I get the same "invalid value" message. I used 0,333333333333333333333333333333 instead of 1/3 (since otherwise it would raise it to the first and then divide by three)
(or the new "y root x" button if you have a new enough version)
If you check the gif I linked to, there is no "y root of x" option.