Function List

Functions built into java script

Operations
+ addition
- subtraction
* multiplacation
/ division
% modulus
== equality
!= inequality
! logical NOT
&& logical AND
& bitwise AND
|| logical OR
| bitwise OR
^ bitwise XOR
Trigometric Functions(in radians)
Math.sin(x) sine
Math.cos(x) cosine
Math.tan(x) tangent
Math.asin(x) arcsine
Math.acos(x) arccosine
Math.atan(x) arctanget
Math.atan2(x,y) converts x,y coordinate values to angular mesurment
Other Functions
Math.sqrt(x) returns the square root of x
Math.pow(x,y) returns x y
Math.exp(x) returns Ex
Math.log(x) return the natural logarithm of x
Math.min(x,y) returns the minimum of x and y
Math.max(x,y) returns the maximum of x and y
Math.round(x) rounds x to the nearest whole number
Math.floor(x) rounds x down to the nearest whole number
Math.ceil(x) rounds x up to the nearset whole number
Math.random() returns a random number between 0 and 1
Constants
Math.PI Pi 3.141592653589793
Math.SQRT1_2 square root of 1/2 0.7071067811865476
Math.SQRT2 square root of 2 1.4142135623730951
Math.E Euler's constant 2.718281828459045
Math.LN10 natural logarithm of 10 2.302585092994046
Math.LN2 natural logarithm of 2 0.6931471805599453
Math.LOG10E base 10 logarithm of E 0.4342944819032518
Math.LOG2E base 2 logarithm of E 1.4426950408889633

Special Functions I wrote myself to do all kinds of weird stuff

Fun with numerals
syl_count(x) returns the number of sylables of the English word for a three digit posative integer (a function used by sylables(x))
sylables(x) returns the number of sylables of the English word for any integer
between(-999,999,999,999 and 999,999,999,999)
DigitSum(x) recusivly sums the digits of an integer until one digit is reached
(x must be posotive and less than 9,999,999,999)
eg 476 4 + 7 + 6 = 17 1 + 7 = 8
DigitProduct(x) recusivly multiply the digits of an integer until one digit is reached
(x must be posotive and less than 9,999,999,999)
eg 456 4 * 7 * 6 = 168 1 * 6 * 8 = 48 4 * 8 = 32 3 * 2 = 6
ConvertToRoman(x) converts an integer to Roman Numeral (x must be for 1 to 3,999,999)
note instead of overscores on large numbers lowcase letters are used
ConvertToGray(x) accepts a decimal integer converts a number to gray code returns a decimal integer
eg x = 15 binary-> 1111 gray code-> 1000 decimal-> 8
x = 13 binary-> 1101 gray code ->1011 decimal->11
Probability
PRS(x,y) Papper(1), Rock(2), Sissors(3) x and y must be either 1, 2 ,3 the winner is returned
Paper beats Rock, Rock beats Sissors, Sissors beats Papper
In the event of a tie 0 is returned. If either x or y is not 1, 2, 3 it will be disqualified and the other one will be returned. If both are not 1, 2, 3; 0 is returned
Rand(low,high) randomy returns an integer from low to high
coinToss(x,y) randomly returns either x or y
Shuffle(size,shuffles,CardNumber) shuffles a hypathetical deck the number of times you tell it the deck is cut into equal sized stacks and one card from each stack is contiualy stacked on one another for each shuffle
size is the number of cards in the deck cards are numbered 0 to size-1 (must be an even number)
shuffles is the number of times the deck is shuffled
CardNumber is the card to deal out 0 is the top card, size-1 is the bottom card
Syracuse Algorithm
Start with any posative integer
if it is even divide by 2
if it is odd multply by 3 and add 1
repeat
Syra(StartWith,NumSteps) Starts with StartWith, runs through the Syracuse Algorithm NumSteps times returns what ever number it stops on
SyraSteps(x) runs through the Syracuse Algorithm starting with x returns the number of steps it takes to reach 1
SyraMax(x) runs through the Syracuse Algorithm starting with x returns the maximum number reached
SyraMaxat(x) runs through the Syracuse Algorithm starting with x returns the number of steps to reach the maximum number
Ternary Logic

0 = No 1 = Mabey 2 = Yes; if anything other than 0,1 or 2 is used, NaN is returned
tnot(x)
xreturns
02
11
20
tor(x,y)
xyreturns
000
011
022
101
111
122
202
212
222
tand(x,y)
xyreturns
000
010
020
100
111
121
200
211
222
txor(x,y)
xyreturns
000
011
022
101
111
121
202
211
220
tnand(x,y)
xyreturns
002
012
022
102
111
121
202
211
220
tnor(x,y)
xyreturns
002
011
020
101
111
120
200
210
220
txnor(x,y)
xyreturns
002
011
020
101
111
121
200
211
222