29
$\begingroup$
 a = (Sqrt[2] + 1) (Sqrt[2] - 1) - 1; 
 {a/a, Simplify[a]/a, b/b == Simplify[b]/b}
{1, 0, True}

This one line "proof" that one equals zero is disturbing (and could possibly lead to wrong results in real computations). Mathematica 9, unlike the versions 8 and 10, recognized that a is zero and issued a warning a/a Indeterminate!

$\endgroup$
  • 3
    $\begingroup$ Welcome to Mathematica.SE! This is a questions/answers site, and a bit different from forums you may be used to. Posts are expected to be practical and answerable questions. Please also realize that this site is independent of Wolfram Research and the people here are just users like you. It is not the place for bug reports, you'll need to contact WRI for that. That said, I believe that the behaviour you see is reasonable and won't be any different for other computer algebra systems. I'll elaborate in an answer. $\endgroup$ – Szabolcs Nov 13 '14 at 19:15
  • 1
    $\begingroup$ What are the specifics of the version 9 that showed an Indeterminate? I am not able to replicate that result on any version 9 I have tried. $\endgroup$ – Daniel Lichtblau Nov 13 '14 at 19:58
  • 1
    $\begingroup$ @DanielLichtblau Simplify::infd: Expression ((-2 (-1+Sqrt[17])^2+(-3+Sqrt[17]) (5+3 Sqrt[17])) (2 (-1+Sqrt[17])^2 (4+Sqrt[17])-(5+Sqrt[17]) (5+3 Sqrt[17])))/(-1-8 (4+Sqrt[17])+(4+Sqrt[17])^2)^2 simplified to Indeterminate. >> $\endgroup$ – Grégoire Nicollier Nov 13 '14 at 20:16
  • 5
    $\begingroup$ Okay, I see now that they are different. I am fairly certain I know what change gave rise to the more correct behavior, and what subsequently reverted it. That latter was due to some extreme slowdown in symbolic manipulation internals that were not so uncommon. We occasionally revisit this, and will do so again, but when improvements come into conflict with considerable speed degradation, they often have to be resolved in favor of the latter. $\endgroup$ – Daniel Lichtblau Nov 13 '14 at 20:28
  • $\begingroup$ I'm looking at this apparently well liked question and puzzling over whats b? $\endgroup$ – george2079 Feb 5 '17 at 15:36
40
$\begingroup$

The behaviour you see is quite reasonable, given what we can expect from computer algebra systems. It will be very similar in other systems too (and exactly the same in all of Mathematica versions 8, 9 and 10 -- I do not see a difference in v9). Here's Maple's output for example:

Mathematica graphics

Here's MuPad:

Mathematica graphics

Here's Sage:

Mathematica graphics

I assume that you would expect a/a to return Indeterminate or a warning. There are reasons why doing this is not practical in a computer algebra system. To implement this behaviour, the / operation would need to check its operands every time, making sure that they are not zero. It turns out that such a test can be quite slow, and in general it is undecidable. (See PossibleZeroQ under Details.)

The implementor of a computer algebra system now faces a decision: should all edge cases be at least attempted to be handled (knowing that a perfect solution strictly isn't possible), possibly at a singificant cost to performance and practical usability? Given that most of them chose not to indicates that doing otherwise would involve significant compromises.

To sum up: A computer algebra system (CAS) doesn't replace a mathematician. All CAS have limitations due to practical reasons. Understanding these limitations is part of (learning to) working with them.

$\endgroup$
  • $\begingroup$ Good exposition of the issues. $\endgroup$ – Daniel Lichtblau Nov 13 '14 at 19:48
  • 2
    $\begingroup$ A computer algebra system might evaluate a user-entered expression, and then, if it thereby became idle, go back and check its work using some easy-to-hard ancillary methods such as looking for indeterminate expressions. Isn't that part of how a mathematician would avoid certain errors which in retrospect seem embarrassingly obvious? Such heuristic goal-seeking behavior might be compared with that of an optimizing compiler. The result would never be perfect -- but neither is the output of a mathematician. $\endgroup$ – Ralph Dratman Nov 19 '14 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.