Infix notation

Infix notation is the commonly used form of mathematical notation in which the operators are placed between the operands. It is also called algebraic notation. Example: 1 + 2 · 8 / 12

However, this representation can lead to confusion, since the result depends on the operator ranking (order in which the arithmetic operations are processed).

In the above example, the following processes are conceivable:

  • From left to right:
1 + 2 = 3 3 · 8 = 24 24 / 12 = 2
  • Point calculation before line calculation (common form):
2 · 8 = 16 16 / 12 = 1,333... 1 + 1,333... = 2,333...

But even here there are ambiguities, for example in the expression 1/2-3:

  • from right to left as 1/(2-3):
2 · 3 = 6 1 / 6 = 0,1666...
  • from left to right as (1/2)-3 (common form)
1 / 2 = 0,5 0,5 · 3 = 1,5

Therefore, certain rules for the processing of complex arithmetic operations have been agreed upon for the infix notation. These define priorities for individual operator groups. For example, point calculations (multiplication, division) are carried out before dash calculations (addition, subtraction). If several point calculations or several dash calculations meet, then they are evaluated from left to right; the operators concerned are said to be left associative.

Even before the point calculations, exponentiations are evaluated, so that, for example, a\cdot b^{c}=a\cdot (b^{c}). Moreover, exponentiation is right-associative, so it is evaluated from right to left, unlike dot and dash calculations. This means that, for example, the expression a^{{b^{{c^{d}}}}}must be read a^{{(b^{{(c^{d})}})}}as

To change the predefined operator order, you can use different types of structuring characters, such as the parentheses already used here. For more on the topic of delimiters, see Operator Order: Delimiters.

See also

  • For more information, see the articles Operator Ranking and Operator Associativity.
  • Some other notations are described in the articles Prefix Notation, Postfix Notation, Term Notation, Existential Graphs.
  • The shunting-yard algorithm can be used to convert an infix notation into the reverse Polish notation or an abstract syntax tree.

AlegsaOnline.com - 2020 / 2023 - License CC3