# Basic Math Tests
# `Plus`: Add numbers.
$ wo 'Plus[1, 2]'
3
$ wo 'Plus[1, 2, 3]'
6
$ wo 'Plus[-1, -2]'
-3
# `+` (Plus): Add numbers.
$ wo '1+2'
3
$ wo '8 + (-5)'
3
# `Minus`: Subtract numbers.
$ wo 'Minus[5]'
-5
$ wo 'Minus[5, 2]'
Minus::argx: Minus called with 2 arguments; 1 argument is expected.
5 − 2
# `-`: Subtract numbers.
$ wo '5-2'
3
# `Times`: Multiply numbers.
$ wo 'Times[2, 3]'
6
$ wo 'Times[2, 3, 4]'
24
$ wo 'Times[-2, 3]'
-6
$ wo '2*2'
4
$ wo '2 * (-2)'
-4
# `Divide`: Divide numbers.
$ wo 'Divide[6, 2]'
3
$ wo 'Divide[6, 2, 3]'
Divide::argrx: Divide called with 3 arguments; 2 arguments are expected.
Divide[6, 2, 3]
# `*` (Times): Multiply numbers.
$ wo '2*3'
6
# `Sign`: Returns the sign of a number.
$ wo 'Sign[5]'
1
$ wo 'Sign[0]'
0
$ wo 'Sign[-7]'
-1
# `Prime`: Returns the nth prime number.
$ wo 'Prime[5]'
11
# `Abs` (Absolute Value): Returns the absolute value of a number.
$ wo 'Abs[-5]'
5
$ wo 'Abs[5]'
5
$ wo 'Abs[0]'
0
# `Floor`: Rounds down to the nearest integer.
$ wo 'Floor[3.7]'
3
$ wo 'Floor[-3.7]'
-4
$ wo 'Floor[3.2]'
3
$ wo 'Floor[0]'
0
$ wo 'Floor[-0]'
0
$ wo 'Floor[0.5]'
0
$ wo 'Floor[-0.5]'
-1
# `Ceiling`: Rounds up to the nearest integer.
$ wo 'Ceiling[3.2]'
4
$ wo 'Ceiling[-3.2]'
-3
$ wo 'Ceiling[3.7]'
4
$ wo 'Ceiling[0]'
0
$ wo 'Ceiling[-0]'
0
$ wo 'Ceiling[0.5]'
1
$ wo 'Ceiling[-0.5]'
0
# `Round`: Rounds to the nearest integer.
$ wo 'Round[3.5]'
4
$ wo 'Round[3.4]'
3
$ wo 'Round[-3.5]'
-4
$ wo 'Round[-3.4]'
-3
$ wo 'Round[0.5]'
0
$ wo 'Round[-0.5]'
0
$ wo 'Round[0]'
0
$ wo 'Round[-0]'
0
# `Sqrt` (Square Root): Returns the square root of a number.
$ wo 'Sqrt[16]'
4
$ wo 'Sqrt[0]'
0
# `Sin`: Returns the sine of an angle in radians.
$ wo 'Sin[Pi/2]'
1
# `NumberQ`: Returns the sine of an angle in radians.
$ wo 'NumberQ[2]'
True
# `MemberQ`: Checks if an element is in a list.
$ wo 'MemberQ[{1, 2}, 2]'
True
$ wo 'MemberQ[{1, 2}, 3]'
False
# `RandomInteger[]`: Randomly gives 0 or 1.
$ wo 'MemberQ[{0, 1}, RandomInteger[]]'
True
# `RandomInteger[{1, 6}]`: Randomly gives a number between 1 and 6.
$ wo 'MemberQ[{1, 2, 3, 4, 5, 6}, RandomInteger[{1, 6}]]'
True
# `RandomInteger[{1, 6}, 50]`: Randomly gives 50 numbers between 1 and 6.
$ wo 'AllTrue[RandomInteger[{1, 6}, 50], 1 <= # <= 6 &]'
True