Expressions
Contents Up Previous Next

Expressions

Operators
Built-in functions
Assignments
Conditionnal expressions
Logical operators
Derivatives
Vectors
System resolution
Second order equations
User defined functions
Non-linear evaluation


Operators

Negation -a
Invertion /a
Factorial a!
Addition a + b
Substraction a - b
Multiplication a * b
Parallel a b
Division a / b
Power a ^ b
Or a | b
And a&b
Xor a ~ b
Equal a == b
Not Equal a <> b
Less Than a < b
Less Than or Equal a <= b
Greater a > b
Greater Than or Equal a >= b

Built-in functions

Sinus sin( a )
Cosinus cos( a )
Arcsinus asin( a )
Arccossinus acos( a )
Hyperbolic sinus hsin( a )
Hyperbolic cosinus hcos( a )
Arccossinus acos( a )
Arctangent atan( a )
Exponential exp( a )
Logarithm log( a )
Base-10 Logarithm log10( a )
Square root sqrt( a )
Floor floor( a )
Randomize rand()
Minimum min( a, b )
Maximum max( a, b )
Modulo mod( a, b )


Assignments

c = 3
a + b = 6
a - b = 2

Conditionnal expressions

Conditionnal expressions can be of the form :

  • if..then

    Example :

    if( V >= 0 ) 
      a=0;
    else 
      a=1; 
    
    It is possible to use '{}' to enclose code :

    Example :

    if( V >= 0 ) {
      a=0; 
    }
    else {
      a=1;
    }
    
  • ternary

    Example :

    d( ramp )/dt = ramp < 1 ? 1000 : 0;
    


Logical operators

logical AND 3&1 = 1
logical OR 2 | 1 = 3
logical exclusive OR 4 ~ 6 = 2
logical left shift 1 << 2 = 4
arithmetic right shift 4 >> 2 = 1


Derivatives

d(a*t)/dt = a
d(sin(a*t))/dt = a*cos(a*t)

Vectors

{0,1,-1}+{1,2,3}={1,3,2}
{0,1,-1}[0]=0
{0,1,-1}[1]=1
{0,1,-1}[2]=-1

System resolution

solve( {2*x+3*y+4*z-9 , 3*x+3*y+3*z-9 , 7*x+8*y-9*z-6}, {x,y,z} ) = {1,1,1}

Second order equations

solve(x^2-1,x)[0]=-1
solve(x^2-1,x)[1]=1
Complex
j*j = -1
re(2+5j)=2
im(2+5j)=5

User defined functions

conv(x):=re(x)-im(x)
conv(2+3j) = 2-3j

f(x):=4*x
y=f(z)-4*z -> y=0

Non-linear evaluation

sin(x)=0.5
-> x = 0.523598775598