Order of operations: Difference between revisions

From Why start at x, y, z
No edit summary
No edit summary
Line 15: Line 15:


\( 8 \div 2(1+3) = 16 \) or \( 1 \)
\( 8 \div 2(1+3) = 16 \) or \( 1 \)
Some people think that the presence or omission of a multiplication symbol in the above expression is important: [[Missing multiplication symbol|implicit multiplication]] might bind more tightly than the division symbol.
Several ways of resolving the ambiguity have been suggested, but all the ones [[User:Christian Lawson-Perfect | I've]] seen introduce other problems.
==Suggested resolutions==
'''Reverse Polish Notation''': The expression \((x-2)(x-1)\) would be written instead \(\times \, - \, x \, 2 \, - \, x \, 1\), or something like that. There's no need for brackets or operator precedence, but it is hard to see at a glance what each operator applies to.
'''Add brackets''': around everything??
==References==
Christian Lawson-Perfect has made a tool called [https://www.checkmyworking.com/misc/samdob/ SAMDOB] which lets you make up your own mnemonic and see how an expression is evaluated.


[[Category:Ambiguities]]
[[Category:Ambiguities]]

Revision as of 12:55, 30 June 2021

There are quite a few mnemonics for the order of operations. A common one in the UK is BODMAS:

  • Brackets
  • Orders
  • Division
  • Multiplication
  • Addition
  • Subtraction

Elsewhere, PEMDAS is popular.

But division and multiplication have equal precedence, and so do addition and subtraction. A common convention is that operations with equal precedence are evaluated from left to right.

This leads to all sorts of misunderstandings.

\( 8 \div 2(1+3) = 16 \) or \( 1 \)

Some people think that the presence or omission of a multiplication symbol in the above expression is important: implicit multiplication might bind more tightly than the division symbol.

Several ways of resolving the ambiguity have been suggested, but all the ones I've seen introduce other problems.

Suggested resolutions

Reverse Polish Notation: The expression \((x-2)(x-1)\) would be written instead \(\times \, - \, x \, 2 \, - \, x \, 1\), or something like that. There's no need for brackets or operator precedence, but it is hard to see at a glance what each operator applies to.

Add brackets: around everything??


References

Christian Lawson-Perfect has made a tool called SAMDOB which lets you make up your own mnemonic and see how an expression is evaluated.