0
$\begingroup$

Wolfram alpha is giving inconsistent results to this problem:

When I enter:

16÷2( 8-3(4-2) )+1 the result is 17.

When I enter:

16÷2[ 8-3(4-2) ]+1 the result is 5.

and

16÷2*[ 8-3(4-2) ]+1 brings us back to 17.

I attribute the third case to the explicit multiplication, meaning the division occurs before the 2 is distributed over the bracket. But should the first two not yield the same result?

NOTE: The original problem was intentionally ambiguous, with the purpose of showing the dangers of the ÷ operator, so let's not talk about that.

  • 2
    @Chris Are you actually asking a question, or just making an observation about Wolfie's behavior?2012-02-25

1 Answers 1

1

It has nothing to do with ÷ at all. It is all about how Alpha interprets "$2*[..]$" vs "$2[..]$".

The square bracket means a function application. Alpha gives precedence to $f[x]$ (expression $f$ applied to expression $x$, or $f(x)$) over other arithmetic operators. But since $2$ is not a function, $2[\cdots]$ is interpreted as $(2\times \cdots)$ before the rest of the expression.

You can easily see the difference is a simpler example: 16 ÷ 2[3] is $\frac{16}{2 \times 3}$ but 16 ÷ 2*[3] is $\frac{16}{2}\times 3.$