Operators

Below is the list of mathematical, logical and array operators used in USolver's spreadhseet. Some of them could also be called through functions.

Math Operators

Operator Name Example
+ Addition
5 + 10
5 plus 10
- Subtraction
10 - 5
10 minus 5
* Multiplication
5 * 10
5 times 10
/ Division
20 / 5
20 divide by 5
^ Exponentiation
2 ^ 5
2 to the power of 5
' Transpose of an array
[1,2,3]'
flips an array over its diagonal
& String concatenation
"abc" & "def"
results in "abcdef"
MOD Modulus
MOD(22, 5)
remainder or modular division

Logical Operators

Operator Name Example
= Equal to
5 = 5
<> Not equal to
5 <> 6
> Greater than
5 > 1
>= Greater or equal
5 >= 5
< Less than
1 < 5
<= Less or equal
5 <= 5
&& AND
true && true
same as
AND(true, true)
|| OR
true || false
same as
OR(true, false)
XOR XOR
XOR(1 = 2, 5 = 6)
NOT NOT
NOT(1 = 2, 5 = 6)

Array Operators

Example Description
[1, 2, 3] Generates 1x3 array - row vector
[1; 2; 3] Generates 3x1 array - column vector
[1, 2, 3; 5, 6, 7] Generates 2x3 array - 2 rows, 3 columns
[1..5] Generates 1x5 array with number [1,2,3,4,5]
[1,3..5] Generates 1x3 array with number [1,3,5]
[1..14,(n=5)] Generates 1x5 array with number generates [1,14,27,40,53]
[1,*6,(n=5)] Generates 1x5 array with number generates [1,6,36,216,1296] - multiplies each next by 6
[1, 2, 3]' Transposes array (flips an array over its diagonal) - converts row to a column or column to a row
[1, 2, 3] + 5 Adds 5 to each value of array. You can use + - / * ^ and logical operators.
[1..5; 6..10] + [6..10; 11..15] Adds corresponsding values from each array. Matriesies must be of the same size. You can use + - / * ^ and logical operators
[1.10] * [1..10]' Cross multiplies values. One array should be a row and another a column. You can also use + - / * ^ and logical operators

Extract Data from Data Table

If cell a1 has a data tabe then you can do

Example Description
a1(2, 4) Extracts value form row = 2 and column = 4
a1("d2") Extracts value form row = 2 and column = 4
a1(*, 4) Extracts sub-array returning all rows, but only column = 4
a1(2, *) Extracts sub-array returning row = 2, but all columns
a1([1,4], 5) Extracts sub-array rows 1 and 4, and column = 5
a1([1..4], 5) Extracts sub-array rows 1 through 4, and column = 5
a1(2, [5, 6]) Extracts sub-array row = 2, and column 5 and 6
a1(2, [$a, $c]) Extracts sub-array row = 2, and column 1 and 3
a1("a2:b3") Extracts sub-array returning rows 2, 3 and columns 1, 2
a1(b1, [5, 6]) Extracts sub-array row = value from cell b1, and column 5 and 6
a1(5, [b1, b2]) Extracts sub-array row = 5, and column = value from b1 and b2
a1().WHERE($b > 10) Extracts sub-array of all rows and columns where value of column 2 is greater than 10
a1().WHERE($b > 10 && $b < 15) Extracts sub-array of all rows and columns where value of column 2 is between 10 and 15

There are other functions to perform array operations, few examples: