# Aion Operator Overview¶

This section provides a concise overview of the available Aion operators.

## Operator Precedence¶

Table Table 35 provides an overview of the Aion operator precedence. Note that, you control order of operations explicity by how you enter mathematical expressions into Aion. Operator precedence merely controls when Aion automatically displays parenthesis.

This table includes some operators that are currently not available but are planned for a future release of Aion.

Note that you can force the order of operations by enabling parenthesis on an operator. Some operators, such as the division operator, will change their precedence based on how they are displayed.

Table 35 Operator Precedence

Precedence

Group

Operators

Description

1

Values

$$\pi$$, $$\mathit{e}$$, $$\infty$$

Special Symbols

$$2.5$$, $$2i$$, $$1.2 \times 10 ^ {3}$$

Literals

2

Large Operators

$$\sqrt{x}$$, $$\sqrt[y]{x}$$

Roots

$$\sum\limits_{i=x}^y \cdots$$, $$\sum\limits_{i=x}^\infty \cdots$$

Summation

$$\prod\limits_{i=x}^y \cdots$$, $$\prod\limits_{i=x}^\infty \cdots$$

Product Series

$$\int_x^y \cdots d z$$, $$\int \cdots d z$$

Integration

$$\frac{d}{dx} \cdots$$

Differentiation

$$\overrightarrow{\nabla} f \left ( x, y, z \right )$$

$$\lim_{x \rightarrow y} z$$

Limits

$$\binom{n}{k}$$

Binomials

3

Power Operators (base)

$$x ^ y$$

Power, Exponent

4

Function Operator

$$\sin x$$

Functions

Unary Operators

$$x^{*}$$

Complex Conjugate

$$A ^ T$$

Matrix Transpose

$$\neg x$$

Logical Not

6

Unary Plus/Minus Operator

$$+a$$, $$-a$$

Unary plus and minus operator

Division Operators

$$x \div y$$, $$\left . x \right / y$$

Division

Multiplication Operators

$$x * y$$

Convolution

$$x y$$,

Multiplication

$$x \times y$$

Cross Product

$$x \cdot y$$

Dot Product

$$A \circ B$$

8

$$x + y$$

$$x - y$$

Subtraction

9

Bitwise AND Operators

$$x \text{ AND } y$$

Bitwise AND

10

Bitwise OR Operators

$$x \text{ OR } y$$

Bitwise OR

$$x \text{ XOR } y$$

Bitwise Exclusive OR

11

Set Difference

$$A \setminus B$$

Set difference

$$A \bigtriangleup B$$

Symmetric difference

Cartesian Product

$$A \times B$$

Cartesian Product

Intersection Operators

$$A \cap B$$

Intersection

$$A \; \setminus \; B$$

Set Conjugate

Union Operators

$$A \cup B$$

Union

$$A \sqcup B$$

Disjoint Union

12

Comparison Operators

$$x = y$$

Equality

$$x \neq y$$

Inequality

$$x < y$$, $$x \leq y$$, $$x > y$$, $$x \geq y$$

Other Comparison Operators

$$i \in B$$

Test If Member

$$i \subset B$$, $$i \subseteq B$$

Test If Subset

$$i \supset B$$, $$i \supseteq B$$

Test If Superset

13

Logical AND Operators

$$x \land y$$

Logical AND

14

Logical OR Operators

$$x \lor y$$

Logical OR

15

Other logical Operators

$$x \lor\mspace{-15mu}- y$$

Logical Exclusive OR

$$x \rightarrow y$$

Logical Conditional

$$x \Leftrightarrow y$$

Logical Biconditional

16

Complex Literal

$$1.2 \times 10 ^ {-6} + 2.3 \times 10 ^ 2 i$$

Complex literal values

Power Operators (exponent)

$$x ^ y$$

Power, Exponent

17

Range Operators

$$1 \ldots N \;\;\;\;\; 1, 3 \ldots N$$

Ranges

Assignment Operators

$$x = 5$$

Variable Assignment

$$f(x) = x ^ 2$$

Function Definition

Grouping Operators

$$\left ( x \right )$$, $$\left [ x \right ]$$, $$\left \lbrace x \right \rbrace$$

Grouping

$$\left | x \right |$$

Absolute Value, Magnitude, Determinant

$$\left \lfloor x \right \rceil$$

Nearest Integer

$$\left \lfloor x \right \rfloor$$

Floor

$$\left \lceil x \right \rceil$$

Ceiling

$$\overline{x}$$

Logical Not (grouped)

$$\frac{x}{y}$$

Division (grouped)

Set Operator

$$A = \left \lbrace 1, 2, 3, 5, 8, 13,\right \rbrace$$

Set

Tuple

$$A = \left ( 1, 3, \ldots, N \right )$$

Tuple

Matrix Operator

$$\left [ \begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array} \right ]$$

Matrix

Subscripting Operators

$$A _ { 3 }$$

Subscript Index Operator

$$A _ { 3,4 }$$

Subscript Matrix Operator

Note

Literals adjust their precedence based on the type of value. For values that are real, imaginary, integer, or boolean, the precedence is taken from the top of the table so that parenthesis are not enforced. For complex values containing both real and imaginary parts, the precedence is taken from the bottom of the table.

## Datatypes¶

By default Aion will identify variable types based on the expressions where the variable is used as an L-value. If the variable type can not be determined then Aion will use a variant type that can support all other types of values.

There are four classes of data types:

• Scalar - Indicates types that hold a single numeric value and can be compared using the relational operators $$<$$, $$>$$, $$\leq$$, and $$\geq$$.

• Basic - Indicates either scalar types or the complex type.

• Iterable - Indicates types that contain one or more values that we can iterate through using subscripting operators and/or the $$\forall$$ operator.

• Matrix - Indicates types that hold values of a single type and track those values in a fixed arrangement.

You can explicitly force variable types using the notation shown in Datatypes Table With Classes.

Table 36 Datatypes

Datatype

Class

Notation

Boolean

Scalar, Basic

$$x \in \mathbb{B}$$

Integer

Scalar, Basic

$$x \in \mathbb{Z}$$

Real

Scalar, Basic

$$x \in \mathbb{R}$$

Complex

Basic

$$x \in \mathbb{C}$$

Sets

Iterable

$$A = \left \lbrace \ldots \right \rbrace$$

Tuples

Iterable

$$A = \left ( \ldots \right )$$

Boolean Matrix

Iterable, Matrix

$$x _ i \in \mathbb{B}$$ or $$x _ {i,j} \in \mathbb{B}$$

Integer Matrix

Iterable, Matrix

$$x _ i \in \mathbb{Z}$$ or $$x _ {i,j} \in \mathbb{Z}$$

Real Matrix

Iterable, Matrix

$$x _ i \in \mathbb{R}$$ or $$x _ {i,j} \in \mathbb{R}$$

Complex Matrix

Iterable, Matrix

$$x _ i \in \mathbb{C}$$ or $$x _ {i,j} \in \mathbb{C}$$

I cases where Aion can not determine the correct data type, Aion will use a variant type that can contain and manipulate values of all other types.

Future versions of Aion may also provide additional data types such as finite fields, quarternions, Galois fields, arbitrary precision types and/or saturating integer types.

## Variable And Function Names¶

Variable and function names must begin with a letter, either roman, greek, or a limited number of special characters and can letters and numbers. Variable and function names also support a single subscript as part of the name. Below are valid examples of variable and function names.

\begin{align}\begin{aligned}CurrentPrime\\i _ { CC }\\\mu _ { iCC4 }\end{aligned}\end{align}

Aion does not rely on the visual presentation to differentiate meaning, instead relying on how the variable or function was entered, As an example, You can use the variable name $$\pi$$ distinctly form the special value $$\pi$$.

## Sets, Tuples, And Iterable Types¶

Aion supports both sets and tuples. Note that tuples can contain any number of entries and thus can be used as tuples, triples, quads, etc.

\begin{align}\begin{aligned}A = \left \lbrace 1, 2, 3, 5, 8, 13, 21, 34 \right \rbrace\\B = \left ( 1, 5, 7 \right )\end{aligned}\end{align}

You can also defines ranges that you can iterate over. Ranges can also be used to define sets and tuples as well as to slice matrices.

\begin{align}\begin{aligned}A = \left \lbrace 1, 3, \ldots, N \right \rbrace\\B = \left ( N, N-1, \ldots, 0 \right )\\B = \left ( N, \ldots, N + 50 \right )\end{aligned}\end{align}

Sets and tuples can contain anything, including other sets and tuples. You can also includes values of different types a single set or tuple.

Aion sets have the unique feature that iterating across values will always be performed in a well defined order. For sets containing just boolean, integer, or real values, the set will be iterated in low-to-high order. Note that tests such as $$5 \in A$$ as well as many other set operations is still an ammortized constant time operation independent of the size of the set.

Note that you can also iterate across matrices. When matrices are iterated across, the values are processed in left-to-right, top-to-bottom order, allowing you to iterate across both row and column matrices.

## Matrices And Arrays¶

You can define matrices.

$\begin{split}A = \begin{bmatrix} 0 & 1 & 2 \\ 3 & 4 & 5 \\ 6 & 7 & 8 \end{bmatrix}\end{split}$

Mathematical operators will operate on matrices in a natural fashion.

You can index an individual element of a matrix using a subscripting operator

$x = A _ { r,c }$

Note that row and column index values are 1 based.

You can slice matrices using constructs such as.

\begin{align}\begin{aligned}S = \left \lbrace 1, 3, \ldots, 39 \right \rbrace\\T = \left ( 1, 24, 7 \right )\\\begin{split}L = \begin{bmatrix} 2 & 5 & 7 \\ 3 & 4 & 6 \end{bmatrix}\end{split}\\B = M _ { S, T }\\B = M _ { 1, T }\\B = M _ { L, S }\end{aligned}\end{align}

Note that Aion does not handle arrays distinctly from matrices. An array is simply a matrix with a single dimension and the distinction between arrays and matrices is determined by context.

$A = \begin{bmatrix} 0, 1, 2, 3, 4, 5, 6 \end{bmatrix}$

You can index individual elements of an array or matrix using a subscripting operator. For matrices, elements are numbered from left-to-right, top-to-bottom, starting at 1.

$x = A _ i$

## Assignments And Function Declarations¶

Assignments are made using an equals sign.

$x = 1$

For values containing basic types, this can be combined with the $$\in$$ operator to force the type of a variable.

$x \in \mathbb{R} = 1$

Functions are defined as shown below.

$\text{MyFunction} _ a \left ( x \in \mathbb{R} \right ) = x ^ 2 + x + 1$

The use of the $$\in$$ operator in a function declaration is optional. Aion will attempt to identify a best type for parameters based on context, defaulting to variant if the type could not be determined.

Note that the assignment operator, $$=$$ can also be used as a relational operator. The meaning of the operator is determined based on context.

## Built-In Functions And Special Values¶

Aion supports a wide range of built-in functions as well as number of useful special values. See Function Reference for a full list of functions provided with Aion.

Table Table 37 lists the pre-defined special values that are provided. Note that the $$\infty$$ value will be provided in a future release.

Table 37 Operator Precedence

Special Value

Meaning

$$\pi$$

Special value $$\pi$$, 3.1415…

$$e$$

Euler’s number, 2.7181…

$$\textit{E}$$

Machine epsilon, difference between 1 and the closest representable value less than 1.

$$\varnothing$$

Null set.

$$\infty$$

Infinity

## Conditionals¶

You can write conditional expressions by one of several methods.

$\begin{split}x = \left \lbrace \begin{array}{ll} y & \text{if } z = 1 \\ 2 \times y & \text{if } z = 2 \\ 0 & \text{otherwise} \end{array} \right .\end{split}$
\begin{align}\begin{aligned}\text{if } A \subset B \land i \in B \; : \; x = y\\\text{else if } A \supset B \; : \; x = z\end{aligned}\end{align}
$a \; \rightarrow \; x = 3$

Note that the $$\rightarrow$$ operator can also be used as a boolean relational operator. The meaning of the operator is determined based on context.

Note

Using $$\rightarrow$$ both as a conditional operator and as a boolean relational operator can lead to confusing statements such as $$a = b \; \rightarrow \; x = 4$$. While Aion can determine the intended meaning based on how the expression was entered, users may have difficulty.

For this reason, Inesonic, LLC does not recommend using the $$=$$ operator on the left side of a conditional operator.

## Looping And Iteration¶

Basic iteration can be performed using iterables described above.

$\forall i \in \left \lbrace 1, 3, \cdots, N \right \rbrace : x = x + i$

More complex looping based on a conditional statement can also be performed.

$\text{while } x \geq 5 : x = 2y - x$

## Compound Statements¶

Compound statements can be constructed using the compound operator as shown below.

$\begin{split}\begin{array}{l|l} \text{if } x > 5 : & y = 2y - 1 \\ & x = x - \text{myfunc} \left ( y \right ) \end{array}\end{split}$

Note that you can use the $$\therefore$$ operator to allow compound operators to present a result. As an example:

$\begin{split}\begin{array}{l|l} f \left ( x \in \mathbb{R} \right ) = & a = x ^ 2 + 2 x + 3 \\ & \therefore \left \lfloor a \right \rceil \end{array}\end{split}$