My current notes:
This Math() function provides the ability to perform mathematical calculations. It supports the standard arithmetic operators (e.g. addition, subtraction, etc.), provides some internal functions, and allows the use of variables and multiple statements.
Arithmetic Operators:
+ Addition
- Subtraction
* Multiplication
/ Division
^ Power
% Modulo
Boolean Operators
! NOT
& AND
| OR
Grouping Operators
( ) Precedence grouping
Comparitor Operators
} Absolute value maximum (i.e. x or y that is maximum distance from 0).
{ Absolute value minimum (i.e. x or y that is minimum distance from 0).
> Distance between x and y, positive when x greater than y, negative otherwise.
< Distance between x and y, positive when x less than y, negative otherwise.
Order of precedence is:
( )
!
^ (TBD - when bug fixed next release)
* / left to right
+ - left to right
| & left to right
Functions:
abs(x) Returns the absolute value of x.
sign(x) Returns the sign of x (1 when x >= 0, -1 when x < 0).
log(x) Returns the natural logarithm (base e) of x.
log10(x) Returns the common logarithm (base 10) of x.
pow(x, y) Returns x raised to the y-th power.
rand(x) Returns a random value ranging between 0 to x.
randn(x) Returns a random value ranging between -x and x.
Comparison Functions
min(x,y) Returns the minimum value of x and y.
max(x,y) Returns the maximum value of x and y.
equal(x,y) Returns 1 when x = y, 0 otherwise.
below(x,y) Returns 1 when x < y, 0 otherwise.
above(x,y) Returns 1 when x > y, 0 otherwise.
Trigonometric functions
atan(x) Returns the arctangent of x.
cos(x) Returns the cosine of x.
sin(x) Returns the sine of x.
tan(x) Returns the tangent of x.
abscos(x) Returns the absolute value of cosine(x).
abssin(x) Returns the absolute value of sin(x).
if() function.... TBD
Variables may be assigned and used by specifying a simple string of letters (e.g. val=2 or x=pow(2,3)).
Multiple equations may be specified, each separated by a semicolon. Expressions are evaluated left to right. The final value of the Math() function will be the result of the right-most equation.