More > Media Center 17

Math() : available functions list...

(1/4) > >>

MrC:
Here is the list of functions and operators I've been able to determine that are valid in the Math() expression:

+ - * / % ( )
abs(x)
atan(x)
cos(x), sin(x), tan(x)
log(x), log10(x)
min(x,y), max(x,y)
pow(x, y)
rand(seed)

If there are others you are aware of, or a reference of the complete list, post them here...

Matt:
A few more:
log10
abscos
abssin
randn (random with range -x to x)
sign
equal
below
above
if

Matt:
You can also save and use variables (and string of letters will be a variable).

Multiple equations can be run.  Sub-equations should be separated by a semi-colon.

MrC:
Thanks. 

Is this the syntax of if ?

  if(tcond,tval,fval)

eg:

  if(2+1,5,2)

this seems to work, but functions in tcond part do not:

  if(equal(2,1),5,2)

MrC:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version