Expression

There are many places in Sailwave where the user can enter an expression. In each context the user will be provided with a list of variables that can be used within the expression, but the general form of the expression is always the same.

The following operators can be used:-

Addition +
Subtraction -
Division /
Multiplication *
Modulus division %
Exponentiation ^

Standard precedence rules apply; i.e. ^ has precedence over /*% which have precedence over +-. Always use parenthesis if you are not sure.

The following functions can be used:-

Absolute value - abs(x).
Truncate to integer value – int(x).
Natural logarithm – loge(x).
Base 10 logarithm log10(x).
Round to decimal places dependant on y – round(x,y).  E.g. round(x,1), round(x,0.01).
Square root – sqrt(x).

Example expressions in a context where the variables s and p are allowed:-

s
s-p
(s-p)/c
p + 10*log10(p) – 1
p^3/c
101 + 1000 * log10(r) – 1000*log10(p)
101 + 1000 * log10(r/p)
89.5*(1 – 2.7183^(-(0.8 + 0.23*s)))*(s-p)/(s-1) + 10.5
1311 – 100*(r*p + 11)^(1/3)

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>