Expression syntax¶
The Following Functions, Operators and Constants are defined and useable in expression strings.
Note
All names are case-sensitive
Constants¶
Constants are special values of mathematical or scientific significance.
Name |
Value |
---|---|
pi |
Pi () |
e |
Euler’s number () |
Inf |
Infinity () |
NaN |
Not a Number |
Operators¶
Operators are a special function mapped to a symbol, that will appear between the operands rather than as a name followed by a comma separated list of operands.
Operators have a precedence which indicates the priority with which they are applied i.e. low precedence valued operators will be evaluated before higher valued ones.
Note
Values of the same precedence are evaluated left to right
Symbol |
Operation |
Syntax |
Precedence |
Display |
---|---|---|---|---|
+ |
Added A to B |
A + B |
3 |
|
- |
Subtract B from A |
A - B |
3 |
|
* |
Mutlipy A by B |
A * B |
2 |
|
/ |
Divide A by B |
A / B |
2 |
|
% |
Reminder of A Divided by B |
A % B |
2 |
|
^ |
Raise A to the B’th power |
A ^ B |
1 |
|
& |
Logical AND of A and B |
A & B |
4 |
|
| |
Logical OR of A and B |
A | B |
4 |
|
<\> |
Logical XOR of A and B |
A <> B |
4 |
|
! |
Logical NOT of A |
!A |
UNARY |
|
== |
Test if A is equal to B |
A == B |
5 |
|
~ |
Test if A is similar to B |
A ~ B |
5 |
|
!= |
Test if A isn’t equal to B |
A != B |
5 |
|
!~ |
Test if A isn’t similar to B |
A !~ B |
5 |
|
< |
Test if A is less than to B |
A < B |
5 |
|
> |
Test if A is more than to B |
A > B |
5 |
|
<= |
Test if A is less than or equal to B |
A < B |
5 |
|
>= |
Test if A is more than or equal to B |
A > B |
5 |
|
<~ |
Test if A is less than or similar to B |
A < B |
5 |
|
>~ |
Test if A is more than or similar to B |
A > B |
5 |
Functions¶
These as normal functions a name followed by a list of parameters
Name |
Operation |
Syntax |
Display |
---|---|---|---|
abs |
Absolute value of A |
|
|
sin |
Sine value of A |
|
|
cos |
Cosine value of A |
|
|
tan |
Tangent value of A |
|
|
re |
Real component of A |
|
|
im |
Imagery component of A |
|
|
sqrt |
Square root of A |
|
|
loc |
Gets specific value from array |
|
|
last |
Last value in array |
|
|
first |
First value in array |
|
|
rloc |
Sub-array of array |
|
|
cumsum |
cumulative sum |
|
|
is_last |
True if value is last in array |
|
|
is_loc |
True if value at specified location |
|
|
rank |
SQL RANK function |
|
|
dense_rank |
SQL DENSE_RANK function |
|
|
date |
Date of datetime |
|
|
year |
Year of datetime |
|
|
month |
Month of datetime |
|
|
weekday |
Weekday of datetime |
|
|
dayofyear |
Day of year of datetime |
|
|
day |
Day of datetime |
|
|
hour |
Hour of datetime |
|
|
minute |
Minute of datetime |
|
|
second |
Second of datetime |
|
|
microsecond |
Microsecond of datetime |
|
|
days |
Days of timedelta |
|
|
hours |
Hours of timedelta |
|
|
minutes |
Minutes of timedelta |
|
|
seconds |
Seconds of timedelta |
|
|
now |
Current datetime |
|
|
if |
SQL IF function |
|
|
case |
SQL CASE function |
|
|
coalesce |
SQL COALESCE function |
|
|
maximum |
Max value within array |
|
|
minimum |
Min value within array |
|
|
as_dt |
Transform value or array to datetime |
|
|
as_td |
Transform value or array to timedelta |
|
|
as_int |
Transform value or array to int |
|
|
as_float |
Transform value or array to float |
|
Examples¶
The Following are some example expressions demonstrating the Precedence order and display formatting
sin(x*(y+z))
sin((x * (y + z)))
(a+b)/(c+d)
((a + b) / (c + d))
a+b/c+d*e^f
((a + (b / c)) + (d * (e ^ f)))
a^b/c^d
((a ^ b) / (c ^ d))
a*b/c*d
(((a * b) / c) * d)
a*b/(c*d)
((a * b) / (c * d))