## mathematics

- +
- –
- *
- /
- ^
- %
- abs
- arccos
- arcsin
- arctan
- clamp
- cos
- dec
- difference
- e
- fraction frac
- integer int
- intquotient
- ln
- log
- max
- min
- mod
- negative
- pi
- power
- product
- quotient quo
- radarccos
- radarcsin
- radarctan
- radcos
- radsin
- radtan
- random rd
- randomboolean randbool
- remainder re
- round
- sequence
- sin
- sqrt
- sum
- tan
- truncate
- vectoradd
- vectorcross
- vectordot
- vectornormal
- vectormultiply
- vectorsub

#### +

**Takes: ** number | number

**Returns: ** number

Adds two numbers or numerical results of other primitives. Can be placed before or between the two items to be added. Similar to sum

`print 3 + 4 print + 3 4`

`make "container xpos + ypos`

#### –

**Takes: ** number | number

**Returns: ** number

Subtracts two numbers or numerical results of other primitives. Similar to difference

`print 5 - 4`

`1`

#### *

**Takes: ** number | number

**Returns: ** number

Multiplies two numbers or numerical results of other primitives. Similar to product

`print 6 * 3`

`18`

#### /

**Takes: ** number | number

**Returns: ** number

Divides two numbers or numerical results of other primitives. Similar to quotient

`print 12 / 4`

`3`

#### ^

**Takes: ** number | number

**Returns: ** number

Returns the first number to the power of the second number. Similar to power

`show 5 ^ 3`

`125`

#### %

**Takes: ** number | number

**Returns: ** number

Returns the remainder from dividing the first number by the second number. Similar to remainder

`show 10 % 4`

`2`

#### abs

**Takes: ** number

**Returns: ** absolute-number

Returns the absolute (non-negative) value of the input provided.

`pr abs -54`

`54`

#### arccos

**Takes: ** number

**Returns: ** number

Returns the inverse cosine of the provided number. The number must be between -1 and 1.

`show arccos 0.2`

#### arcsin

**Takes: ** number

**Returns: ** number

Returns the inverse sine of the provided number. The number must be between -1 and 1.

`show arcsin 4`

#### arctan

**Takes: ** number

**Returns: ** number

Returns the arctangent (inverse) of number in degrees.

`print arctan 50`

`88.854199`

#### clamp

**Takes: ** number (number) | floor (number) | ceiling (number)

**Returns: ** number

Clamp takes the inputted number, and if it is lower than the floor, or higher than the ceiling, it returns the floor or the ceiling respectively.

`print clamp 10 5 20`

`10`

`print clamp 1 5 20`

`5`

`print clamp 30 5 20`

`20`

#### cos

**Takes: ** input (number)

**Returns: ** output (output)

Returns the cosine of the input. See sin

`show cos 120`

`-0.50000077735`

#### dec

**Takes: ** word

**Returns: ** none

Decreases the value of the specified container (variable) by one. Note that the container (variable) specified by dec begins with a quote (“) not a colon. This is so that you can pass dec a container specified inside another container. See inc

`make "counter 10`

`dec "counter `

`print :counter`

`9`

`will decrement the container named counter by one.`

`make "fred 5`

`make "counter "fred`

`dec :counter `

`print :fred`

`4`

`will decrement the container specified by :counter ("fred) by one.`

#### difference

**Takes: ** number1 (number) | number2 (number)

**Returns: ** number

Difference outputs the result of subtracting number 2 from number 1.

`show difference 5 1`

`4`

#### e

**Takes: ** none

**Returns: ** number

Returns the constant e, which is 2.7182818284590452353

`show e`

#### fraction frac

**Takes: ** number

**Returns: ** number

Returns the fractional part of a number. Similar to mod X 1 or X – int X. See mod, int

`show frac 3.14`

`0.14`

#### integer int

**Takes: ** number

**Returns: ** number

Returns the integer value (rounded down) of the provided number.

`show integer 23.34`

`23`

#### intquotient

**Takes: ** number1 (number) | number2 (number)

**Returns: ** number

Returns the integer of the quotient (division) of the two provided input numbers. See quotient, remainder

`show intquotient 22 7`

`3`

#### ln

**Takes: ** number

**Returns: ** number

Returns the natural logarithm of the given input

`show ln 100`

#### log

**Takes: ** number

**Returns: ** number

Returns the log of the given number.

`show log 5
`

`0.698970004336`

#### max

**Takes: ** number | number

**Returns: ** number

Returns the greater of the two provided numbers. See min

`show max 4 6`

`6`

#### min

**Takes: ** number | number

**Returns: ** number

Returns the lesser of the two provided numbers. See max

`show min 4 5`

`4`

#### mod

**Takes: ** numerator (number) | denominator (number)

**Returns: ** Returns the floating-point remainder of the division of the supplied numerator by the denominator, as opposed the remainder primitive, which takes and returns integer (whole) values. See remainder

show mod 22 6.5

`2.5`

#### negative

**Takes: ** number

**Returns: ** number

Returns the negative of the provided number. You can also negate containers or advisor returns by prefixing them with -, eg -:container or -advisor. See abs

`show negative 10`

`-10`

`show negative -20`

`20`

#### pi

**Takes: ** none

**Returns: ** number

Returns 3.141592653589793

`show pi`

`3.141592653589793`

#### power

**Takes: ** number | number

**Returns: ** number

Returns the power of the second number to the first number. Similar to ^.

`show power 5 5`

`125`

#### product

**Takes: ** number1 (number) | number2 (number)

**Returns: ** number

Returns the product of (multiplies) its two inputs, similar to the * operator.

`show product 4 5`

`20`

#### quotient quo

**Takes: ** number1 (number) | number2 (number)

**Returns: ** number

Returns the first number divided by the second number, similar to using the / operator. See intquotient, remainder

`show quotient 22 7`

`3.142857142857143`

#### radarccos

**Takes: ** number

**Returns: ** number

Outputs the inverse cosine of its input in radians.

`show radarccos 0.5
`

`0.87758256189`

#### radarcsin

**Takes: ** number

**Returns: ** number

Outputs the inverse sine of its input in radians.

`show radarcsin 0.5
`

`0.479425538604`

#### radarctan

**Takes: ** number

**Returns: ** number

Outputs the inverse tangent of its input in radians.

`show radarctan 0.5
`

`0.463647609001`

#### radcos

**Takes: ** number

**Returns: ** number

Outputs the cosine of the input in radians.

`show radcos 0.5`

#### radsin

**Takes: ** number

**Returns: ** number

Outputs the sine of the input in radians.

`show radsin 0.5`

#### radtan

**Takes: ** number

**Returns: ** number

Outputs the tangent of the input in radians.

`show radtan 0.5`

#### random rd

**Takes: ** maximum (number)

**Returns: ** number

Returns a random integer (whole number) between 0 and the specified maximum, but not including that maximum. So, for example, random 2 returns one of two numbers, 0 or 1. random 8 returns one of 8 numbers, between zero and 7. Note that random and its input must be isolated from other expressions using brackets () if you don’t want a random number based on that expression, for example, unless you want random 15 + 10 to return a number between 0 and 34, you need to use (random 15) + 10 to return a number between 10 and 24

`show random 16`

`3`

`show 1 + random 15`

`4`

`show (random 15) + 1`

`4`

#### randomboolean randbool

**Takes: ** none

**Returns: ** boolean

Randomly returns TRUE or FALSE.

`show randomboolean`

#### remainder re

**Takes: ** numerator (number) | denominator (number)

**Returns: ** integer (number)

Returns the integer remainder of the division of the numerator by the denominator. The numerator and denominator are converted to integers if they are not provided as integers. For floating-point calculations, use mod

`show remainder 22 7`

`1`

#### round

**Takes: ** number

**Returns: ** number

Takes a number and returns it rounded to the nearest whole number, up or down (whichever is closer).

`print round 4.6`

`5`

`print round 1.2`

`1`

#### sequence

**Takes: ** [from | to | count] (list)

**Returns: ** list (list)

Similar to range but outputs a list of numbers starting with the first parameter, then takes a number of equally-spaced steps specified by the third parameter to reach the number given in the second parameter. See range

`show sequence [1 10 6]`

`[1 2.5 4 5.5 7 8.5 10]`

#### sin

**Takes: ** degrees

**Returns: ** sine of degrees

Returns the sine of degrees.

`print sin 90`

#### sqrt

**Takes: ** number

**Returns: ** number

Returns the square root of the provided number.

`show sqrt 16`

`4`

#### sum

**Takes: ** number1 (number) | number2 (number)

**Returns: ** result (number)

Sums (adds) the two provided numbers.

`show sum 2 2`

`4`

#### tan

**Takes: ** number

**Returns: ** number

Returns the tangent of the supplied number. See arctan

`print tan 5`

`0.087489`

#### truncate

**Takes: ** number | decimalplaces (number)

**Returns: ** number

Returns the input rounded to the specified number of decimal places.

`print truncate 10.4325 2`

`10.43`

#### vectoradd

**Takes: ** vector (list) | vector (list)

**Returns: ** list

Add two vectors giving a new vector.

`vectoradd [0 1 0] [1 0 1]`

`[1 1 1]`

#### vectorcross

**Takes: ** vector (list) | vector (list)

**Returns: ** list

Returns vector perpendicular to the two provided vectors.

`show vectorcross [0 .2 0] [0 0.5 0.5]
`

`[0.1 0 0]`

#### vectordot

**Takes: ** vector (list) | vector (list)

**Returns: ** number

Returns the “dot” product of two vectors.

`show vectordot [0 0.12 0.12] [0.5 0 0.5]
`

`0.06`

#### vectornormal

**Takes: ** vector (list)

**Returns: ** list

Returns a “normal” vector of length 1.

`show vectornormal [20 20 20]`

`[0.5773502691896257 0.5773502691896257 0.5773502691896257]`

#### vectormultiply

**Takes: ** vector (list) | amount (number)

**Returns: ** list

Multiply vector by given amount.

`show vectormultiply [0.5 0.5 0.5] 2`

`[1 1 1]`

#### vectorsub

**Takes: ** vector1 (list) | vector2 (list)

**Returns: ** list

Subtract vector1 from vector2, giving a new vector.

`show vectorsub [0 1 0] [1 0 1]
`

`[1 -1 1]`