Unary, Binary, and List Operators and Their Precedence Rules
Table 5-1: Unary Operators
The binary operators include arithmetic and logical operations.
Table 5-2: Binary Operators
In addition, you can use e or E to represent the power of 10 using a scientific notation (E notation). The following examples are equivalent and all represent 5.6·107: 5.6*10^7, 5.6e7, and 5.6E7.
A comparison using a binary operator can be, for example x<1, which returns 1 (true) if x is smaller than 1and 0 (false) otherwise. For a composite comparison such as 0 < x < 1, you can achieve it using (0<x)*(x<1). An expression like 0<x<1 is possible to use but is evaluated as (0<x)<1, which for an x in the interval is interpreted as 1<1 and thus returns 0 instead of 1 for all such value of x.
For simulating “if statements”, use the if operator instead of logical expressions. If you use logical expressions, values that are Inf can propagate to NaN, making a plot empty, for example.
The following operators are used for precedence, grouping, lists, and unit definitions:
The following list shows the precedence order for the operators above: