__header__
Description
The Expression tool creates an expression, and evaluates a mathematical expression.
Using the Expression Tool
On the Expression tool's parameters page the user
defines
the expression that will be evaluated in the
"Expression" menu. When the tool is run the expression will
be
evaluated and the result will be displayed in the "Result" menu.
A, B, etc. can be defined within the tool itself, or can be
linked to
a global parameter by dragging the Parameter object off the ROT.
When the parameter object is added to a menu in the parameters
page (A, B, etc.) a drop down menu will appear over the text box, and
the user can use the drop down menu to select a parameter.
Example:
A = 25
B = 4
In the "Expression" menu type in "A*B".
When the tool is run the values in the A and B menus will be evaluated
and the result will be given in the "Result" menu.
Result = 100
note the standard math symbols * / % + - AND OR are all recognized
Possible Expressions
The Maths tool incorporates all the basic math expressions (addition, subtraction, greater than, less than etc.) as well as several other more powerful expressions. Below is a list of the commands and their use.(NOT case sensitive)
Trig Functions
- Cos
Takes the Cosine
-
Sin
Takes the Sin
- Tan
Takes the Cosine
-
ArcSin
Takes the ArcSin
-
ArcCos
Takes the ArcCos
-
ArcTan
Takes the ArcTan
-
ArcTan2
Takes the ArcTan passing two arguments ARCTAN2(sin,cos)
Maths Functions
-
ABS
Finds the absolute value.
Use - ABS (-35) and the value will return 35.
-
SQR
Finds the square of a value.
Use sqr (4) and the value will return 16.
-
SQRT
Finds the square root of a value.
Use sqrt (4) and the value will return 2.
-
LN(x)
return natural log
-
LOG or LOG10
returns log base 10
-
EXP(x)
return e power x
-
POW(x,y)
returns x to the y
-
FLOOR(x)
return the integer part of x downwards
-
TRUNC(x)
return the integer part of x floored towards 0.0
-
ROUNG(x [,nbDecimals])
return the rounded value of x
Constants/Random
-
Random(Min,Max)
-
PI
-
EULER
returns E ie 2.71828182845904523536
Misc
-
If( Val, MinVal, MaxVal, newVal [,elseValue])
if(Val>=Min && Val <=Max)
Val = newVal
else
Val = elseVal if elseVal exsists
-
LIMIT
Limit (val,Min,Max)
if the number exceed min max set to min max
-
CIR (val,Min,Max)
if the number exceed min max set to the circular entry between min max
eg CIR( angle, -179, 180)
-
SWEEP angle,Start, Sweep) (in degrees)
ensures a angle is between start and sweep or at it limits
eg SWEEP( angle, 23, -90)
-
MIN
Finds the minimum value in a set of numbers.
Use - MIN (4, 1, 7, 4, 2) and the value will return 1. or on SpreadSheet MIN(A1..A10)
-
MAX
Finds the maximum value in a set of numbers.
Use - MAX (4, 1, 7, 4, 2) and the value will return 7. or on SpreadSheet MAX(A1..A10)
-
SUM
Finds the maximum value in a set of numbers.
Use - SUM (4, 1, 7, 4, 2) or on SpreadSheet SUM(A1..A10)br>
-
MEAN
Finds the maximum value in a set of numbers.
Use - MEAN (4, 1, 7, 4, 2) or on SpreadSheet MEAN(A1..A10) .
-
STDDEV
Finds the maximum value in a set of numbers.
Use - STDDEV (4, 1, 7, 4, 2) or on SpreadSheet STDDEV(A1..A10) .
-
SCORE(a,b)
score = (1 - (a-b)/(a+b)/2) (checks for zero)
-
ERROR(a,b)
Error = ((a-b)/(a+b)/2) (checks for zero)
BYTE/WORD extraction
-
LOBYTE(x)
returns the lower 8 bits
-
HIBYTE(x)
returns the upper 8 bits of a 16 bit word
-
LOWORD(x)
returns the lower 16 bits
-
HIWORD(x)
returns the upper 16 bits of a 32 bit word
String Functions
- Chr(str, index)
returns the ascii value of a character
- StrToNum
Can set the start, end and base of a string. ( str [,start] [,length] [,base])
Use - strtonum (str,0,10,5) to set the start position to 0 the number characters to 10 and the base to 5.
The square brackets [ ] denote an optional value.
- Find
Returns a value based on location.
Use - find (qwertyu, ty) and the value will return 5 because t is the 5th letter in the string.
- StrLen
Date Functions
- TIMEepoch(optional_date /*, start*/)
returns the seconds from year, else 1970
- TIMEJulian(str_date)
returns the nb days to this date
eg TIMEJulian(2023/1/1) = 1