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:
- Point calculation before line calculation (common form):
But even here there are ambiguities, for example in the expression 1/2-3:
- from right to left as 1/(2-3):
- from left to right as (1/2)-3 (common form)
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, . 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 must be read 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.