Infix notation
The 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 priority (order in which the arithmetic operations are processed).
At the above Examples are e.g. B. the following processing is conceivable:
- left to right:
1 + 2 = 3 3 · 8 = 24 24 / 12 = 2
- Point calculation before line calculation (commonly used form):
2 · 8 = 16 16 / 12 = 1,333... 1 + 1,333... = 2,333...
But even here there are still ambiguities, for example with 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
For this reason, certain rules for processing more complex arithmetic operations have been agreed for the infix notation. These define priorities for individual operator groups. For example, point calculation ( multiplication , division ) is carried out before line calculation ( addition , subtraction ). If several point calculations or several line calculations meet, then they are evaluated from left to right; it is said that the operators concerned are left-associative .
Even before the point calculations, exponentiations are evaluated so that e.g. B. is. The exponentiation is also right-associative , i.e. , in contrast to point and line calculations, it is evaluated from right to left. This means that, for example, the expression as to be read.
In order to change the predefined operator precedence, different types of structural symbols are used, such as the brackets already used here. For more on the topic of outline characters, see Operator Precedence: Outline Characters .
See also
- For more information, see the articles Operator Precedence and Operator Associativity .
- Some other notations are described in the articles Prefix Notation , Postfix Notation , Conceptual Notation , Existential Graphs .
- With the shunting yard algorithm , an infix notation can be converted into reverse Polish notation or an abstract syntax tree.