mathematics


number

mathematics

none

none

A number is any element where all the items are a number (which can include a decimal point .) such as 123 or 413.21. Numbers can be stored in containers, for example: put 5 in :container

show 214.32


+

mathematics

number | number

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


mathematics

number | number

number

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

print 5 - 4
1


*

mathematics

number | number

number

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

print 6 * 3
18


/

mathematics

number | number

number

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

print 12 / 4
3


^

mathematics

number | number

number

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

show 5 ^ 3
125


%

mathematics

number | number

number

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

show 10 % 4
2


arccos

mathematics

number

number

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

show arccos 0.2


arcsin

mathematics

number

number

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

show arcsin 4


clamp

mathematics

number (number) | floor (number) | ceiling (number)

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

mathematics

input (number)

output (output)

Returns the cosine of the input. See sin

show cos 120
-0.50000077735


dec

mathematics

word

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

mathematics

number1 (number) | number2 (number)

number

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

show difference 5 1
4


e

mathematics

none

number

Returns the constant e, which is 2.7182818284590452353

show e


fraction frac

mathematics

number

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

mathematics

number

number

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

show integer 23.34
23


intquotient

mathematics

number1 (number) | number2 (number)

number

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

show intquotient 22 7
3


log

mathematics

number

number

Returns the log of the given number.

show log 5
0.698970004336


max

mathematics

number | number

number

Returns the greater of the two provided numbers. See min

show max 4 6
6


min

mathematics

number | number

number

Returns the lesser of the two provided numbers. See max

show min 4 5
4


mod

mathematics

numerator (number) | denominator (number)

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

mathematics

number

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

mathematics

none

number

Returns 3.141592653589793

show pi
3.141592653589793


power

mathematics

number | number

number

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

show power 5 5
125


product

mathematics

number1 (number) | number2 (number)

number

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

show product 4 5
20


quotient

mathematics

number1 (number) | number2 (number)

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

mathematics

number

number

Outputs the inverse cosine of its input in radians.

show radarccos 0.5
0.87758256189


radarcsin

mathematics

number

number

Outputs the inverse sine of its input in radians.

show radarcsin 0.5
0.479425538604


radarctan

mathematics

number

number

Outputs the inverse tangent of its input in radians.

show radarctan 0.5
0.463647609001


radcos

mathematics

number

number

Outputs the cosine of the input in radians.

show radcos 0.5


radsin

mathematics

number

number

Outputs the sine of the input in radians.

show radsin 0.5


radtan

mathematics

number

number

Outputs the tangent of the input in radians.

show radtan 0.5


random

mathematics

maximum (number)

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

mathematics

none

boolean

Randomly returns TRUE or FALSE.

show randomboolean


remainder

mathematics

numerator (number) | denominator (number)

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

mathematics

number

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

mathematics

[from | to | count] (list)

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]


sqrt

mathematics

number

number

Returns the square root of the provided number.

show sqrt 16
4


sum

mathematics

number1 (number) | number2 (number)

result (number)

Sums (adds) the two provided numbers.

show sum 2 2
4


tan

mathematics

number

number

Returns the tangent of the supplied number. See arctan

print tan 5
0.087489


truncate

mathematics

number | decimalplaces (number)

number

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

print truncate 10.4325 2
10.43


vectoradd

mathematics

vector (list) | vector (list)

list

Add two vectors giving a new vector.

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


vectorcross

mathematics

vector (list) | vector (list)

list

Returns vector perpendicular to the two provided vectors.

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


vectordot

mathematics

vector (list) | vector (list)

number

Returns the “dot” product of two vectors.

show vectordot [0 0.12 0.12] [0.5 0 0.5]
0.06


vectornormal

mathematics

vector (list)

list

Returns a “normal” vector of length 1.

show vectornormal [20 20 20]
[0.5773502691896257 0.5773502691896257 0.5773502691896257]


vectormultiply

mathematics

vector (list) | amount (number)

list

Multiply vector by given amount.

show vectormultiply [0.5 0.5 0.5] 2
[1 1 1]


vectorsub

mathematics

vector1 (list) | vector2 (list)

list

Subtract vector1 from vector2, giving a new vector.

show vectorsub [0 1 0] [1 0 1]
[1 -1 1]