Expression Syntax For Generic Applets
Expression syntax are used to describe mathematical operations, functions and conditions in applets.
Expression for math functions
In the generic framework, there are predefined expressions for constants of functions that are used to describe the value of a number or function variable. Be aware that you shouldn't use these expressions as names of your variables, as this will cause problems.
Category 
Syntax 
Examples 
Note 
Numbers 
09 
42, 2.5, ... 

Number Constants 
pi, e 
pi/2, e (~2.718...) 

Parentheses 
() 
(x+1)*(x+2) 

Standard Operations 
+,,/,*,^ 
1+2, pi/2 

Absolute value 
abs(arg) or arg 
abs(x), 

Trigonometric functions 
sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh 
sin(2*pi), (cos(x))^2 
if z is a complex number, atan(z) is the phase of z. It is in the range (pi, pi], you may use also arcsin, arccos, etc 
Signum 
sign(arg) 
sign(x) = 1, x>0; sign(0)=0; sign(x)=1,x<0 
If the number field is complex or complexrational, sign(arg) is only defined for im(arg)=0. 
Theta/Heaviside 
theta(arg) 
theta(x) = 1,x>=0; theta(x)=0, x<0 
If the number field is complex or complexrational, theta(arg) is only defined for im(arg)=0. 
Dirac delta function (1 for x = 0, 0 otherwise) 
dirac(arg) 
dirac(x) 
If the number field is complex or complexrational, dirac(arg) is only defined for im(arg)=0. 
Exponential function 
exp(x) or e^x 
exp(2*x) 


minimum/maximum function 
min(arg), max(arg) 
min(myMatrix), min([1;3;2;5]) 
arg has to be a matrix or row vector: either an identifier or directly described using the python like syntax. Those two functions are not defined for nonreal numbers. 
If the number field is chosen to be complex or complexrational, the imaginary unit is i
, and there are the functions re
and im
for the real and imaginary part, e.g. re(1+2*i)
and im (1i)
.
Expression for conditions
This is used to described conditions, such as in \randadjustif or in generic visualization's \IFELSE command
It is basically a relation between the values of two Operations or function from the 1st category
Category 
Syntax 
Examples 
Note 
Equal 
left=right 
x=0, x=y, (x)=1 
is true if the value of the left side equals the value of the right side 
Not equal 
left!=right 
x!=0, x!=y 

Greater than 
left>right 
x > y 

Less than 
left < right 
x < y 

Greater than or equal 
left >=right 
x >= y 

Less than or equal 
left <=right 
x <= y, abs(x)<3, sin(x)<0.5 

Grouping brackets 
[left>=right] 
[abs(x)>3] AND [abs(x)<5] 
use to group a relation 
Negation 
NOT [left > right] 
NOT [x = y] 
negate the relation in the brackets, returns true if x != y 
AND 
[cond1] AND [cond2] 
[x>0] AND [x<3] 

OR 
[cond1] OR [cond2] 
[x<0] OR [x>3] 
Special syntax in a generic visualization: var()
In a generic visualization, var(arg)
can be used in operations or conditions and it will be replaced by the value of
the variable with the name arg. Remember to write var as a function var(x)
and not as a Texcommand \var{x}.
1 2 3 4 5  \begin{variables}
\randint{x}{5}{5} %create two random integers
\randint{y}{5}{5}
\point{p1}{real}{var(x),var(y)} %creates a point on (x,y) depending on the values of x and y.
\end{variables}
