Math

Purpose:

Perform a mathematical calculation.

Category:

Mathematical

Syntax:

Math "formula" "variable"

formula

A mathematical formula. The formula can include the following operators and functions: +, -, *, / . Parentheses and variables may also be used in formulas.

variable

The name of the variable to store the result.

Example:

In the example below, a variable [MonthlyRent] is used to calculate the amount of rent paid per week. [MonthlyRent] could be set using the SetVar Action, or associated with a Text Entry object to allow the user to enter a number. The result is stored in the variable [WeeklyRent].


SetVar [MonthlyRent] 1200

Math "([MonthlyRent]*12)/52" [WeeklyRent]

Supported symbols:

+

Addition Operator eg. 2+3 results 5

-

Subtraction Operator eg. 2-3 results -1

/

Division operator eg 3/2 results 1.5

*

Multiplication Operator eg. 2*3 results 6

Mod

Modulus Operator eg. 3 Mod 2 results 1

(

Opening Parenthesis

)

Closing Parenthesis

Sigma

Summation eg. Sigma(1,100,n) results 5050

Pi

Product eg. Pi(1,10,n) results 3628800

n

Variable for Summation or Product

pi

Math constant pi returns 3.14

e

Math constant e returns 2.71

C

Combination operator eg. 4C2 returns 6

P

Permutation operator eg. 4P2 returns 12

!

factorial operator eg. 4! returns 24

log

logarithmic function with base 10 eg. log 1000 returns 3

ln

natural log function with base e eg. ln 2 returns .3010

pow

power function with two operator pow(2,3) returns 8

^

power operator eg. 2^3 returns 8

root

underroot function root 4 returns 2

sin

Sine function

cos

Cosine function

tan

Tangent function

asin

Inverse Sine funtion

acos

Inverse Cosine funtion

atan

Inverse Tangent funtion

sinh

Hyperbolic Sine funtion

cosh

Hyperbolic Cosine funtion

tanh

Hyperbolic Tangent funtion

asinh

Inverse Hyperbolic Sine funtion

acosh

Inverse Hyperbolic Cosine funtion

atanh

Inverse Hyperbolic Tangent funtion


Note: Actions that expect numeric values can also accept formulas as parameters like those used by the Math Action.


Random

Purpose:

Generate a random number between 0 (zero) and a maximun value.

Category:

Mathematical

Syntax:

Random "maximum value" "variable"

maximum value

The maximum possible value for the generated number. The number returned will be somewhere between 0 (zero) and maximum value.

variable

The name of the variable to store the random number.

Example:

Random 100 [rnumber]


RandomEx

Purpose:

Generate a random number between a minimun and a maximun value..

Category:

Mathematical

Syntax:

Random "minimum value" "maximum value" "variable"

minimum value

The minimum possible value for the generated number.

maximum value

The maximum possible value for the generated number. The number returned will be somewhere minimum value and maximum value.

variable

The name of the variable to store the random number.

Example:

RandomEx 1 6 [rnumber]