[Moo Documentation]

Showing help on Math Utilities (#33)

Trigonometric/Exponential functions:

sin(a),cos(a),tan(a) -- returns 10000*(the value of the corresponding

trigonometric function) angle a is in degrees.

arctan([x,]y) -- returns arctan(y/x) in degrees in the range -179..180.

x defaults to 10000. Quadrant is that of (x,y).

exp(x[,n]) -- calculates e^x with an nth order taylor polynomial

Statistical functions:

combinations(n,r) -- returns the number of combinations given n objects

taken r at a time.

permutations(n,r) -- returns the number of permutations possible given

n objects taken r at a time.

Number decomposition:

div(n,d) -- correct version of / (handles negative numbers correctly)

mod(n,d) -- correct version of % (handles negative numbers correctly)

divmod(n,d) -- {div(n,d),mod(n,d)}

parts(n,q[,i]) -- returns a list of two elements {integer,decimal fraction}

Other math functions:

sqrt(x) -- returns the largest integer n <= the square root of x

pow(x,n) -- returns x^n

factorial(x) -- returns x!


fibonacci(n) -- returns the 1st n fibonacci numbers in a list

geometric(x,n) -- returns the value of the nth order geometric series at x

Integer Properties:

gcd(a,b) -- find the greatest common divisor of the two numbers

lcm(a,b) -- find the least common multiple of the two numbers

are_relatively_prime(a,b) -- return 1 if a and b are relatively prime

is_prime(n) -- returns 1 if the number is a prime and 0 otherwise


random(n) -- returns a random number from 0..n if n > 0 or n..0 if n < 0

random_range(n[,mean]) -- returns a random number from mean - n..mean + n

with mean defaulting to 0

simpson({a,b},{f(a),f((a+b)/2),f(b)}) -- returns the numerical

approximation of an integral using simpson's rule

Bitwise Arithmetic:

AND(x,y) -- returns x AND y

OR(x,y) -- returns x OR y

XOR(x,y) -- returns x XOR y (XOR is the exclusive-or function)

NOT(x) -- returns the complement of x

All bitwise manipulation is of 32-bit values.

Search the help for:

You are not logged in.

[home | help | who | search | setup | code]