A calculator! Just put your expression or expressions in, and it'll simplify them (using radians). Instructions are in default expressions.
no commas in numbers
1^2^3 will be interpeted as 1^(2^3)
unary negation (like -x) must be written as 0-x
for now, the laws of exponents haven't been implemented
if you want to write 1/3, DO NOT WRITE 0.3333333. instead, just write (1/3). in fact, decimals won't work here.
ofc this is buggy, and if you just need normal calculation use Desmos or wolfram alpha
This calculator suppourts the following:
succesor (S(x)): adds 1 to a number (no, I don't actually use peano axioms for this)
addition (x+y): if y is 0, is x, if y can be written as S(z), is S(x+z), and will generalize to non-natrual numbers
subtraction (x-y): if x-y=z, then x=y+z
multiplication (x*y): if y is 0, is 0, if y can be written as S(z), is x*y + x, will generalize to non-natrual numbers, and by default evaluated before addition and subtraction
division (x/y): if x/y=z, then x=y*z
modulos (x%y): 2&6 = 8%6, basically wrap-around for math, not to be confused with remainder (they are same for positives tho)
exponentiation (x^y): if x and y are 0, is 1 (deal with it), if x isn't zero and y is 0, is 1, if y can be written as S(z), is x^y * x, will generalize (for the most part) to non-natrual numbers, and is by default evalutated before addition, subraction, multiplication, and division
parentheses ((x)): is the value of x, even in situations like 5*(4+7), where addition would otherwise go before multiplication
also parentheses ((x,y)): used for inputs of things like min(x,y), to show 2 inputs, and also would make parsing numbers with commas too hard
min (min(x,y)): if x is less than y, x, otherwise y
max (max(x,y)): min but greater than instead of less than
abs (abs(x)): the euclidean distance from 0 to x
if (if(c,i,e)): if c is true, i, otherwise e
goto (goto(x)): goto the line with the neumeric label x
= (x=y): x is defined as y
== (x==y): checks if x is the same as y (abstract equality)
> (x>y): checks if x is greater than y
< (x<y): checks if x is less than y
>= (x>y): checks if x is greater than or equal to y
<= (x>y): checks if x is less than or equal to y
!= (x!=y): checks if x is not equal to y, and works as xor
& (x&y): only true if x is true and y is true
| (x|y): only false if x is false and y is false
! (!(x)): only true if x is false
exp (exp(x)): e^x
ln (ln(x)): the value y such that e^y = x
log2 (log2(x)): the value y such that 2^y = x
log10 (log10(x)): the value y such that 10^y = x
log (log(b,x)): the value y such that b^y = x
sqrt (sqrt(x)): the number that, when multiplied by itself, is x
cbrt (cbrt(x)): the number that, when multiplied by [itself multiplied by itself], is x
nthroot (nthroot(n,x)): the number that, when multiplied by itself n times, is x
round (round(x)): the integer closest x
sin (sin(x)): let's say I have an arrow starting at the center of a circle whose radius is 1 meter, and it is rotated (starting from pointing +x, counterclockwise, around the center of the circle) by an angle of θ, where if θ=τ we rotate 360 degrees, then sin(θ) is the y coordinate (how far up/down) of the arrow's tip
cos (cos(x)): sin but x coordinate (how far left/right)
tan (tan(x)): sin(x)/cos(x), or the distance you must travel going only in the direction the circle was curving when yiu started to get to the x axis starting from the point where your rotated arrow touches the circle
asin (asin(x)): the number θ closest to 0 such that x=sin(θ)
acos (acos(x)): asin but cos
atan (atan(x)): asin but tan
atan2 (atan2(x,y)): the angle you must go to get to the point (y,x), calculated as atan(y/x) with a whole load of exceptions where atan(y/x) would break
comment (//x): if a line starts with //, it is ignored
The simplification rules are:
a=b -> a=b (only simplify RHS (you can't see it there, but b is simplified and a isn't))
a, a=b -> b (substitution)
a+a -> 2*a (double)
a*b+b -> (a+1)*b (mul 1 and distribute)
a*c+b*c -> (a+b)*c (distribute (works if addends are flipped))
where capital letters are constants, along with computation when exact for BigInts and booleans. These simplifications can be seen in the console.
changelog (new.bugfix)
2.2: if and goto
2.1: more simplification rules
2.0: 0.1+0.2 no longer equals 0.30000000000000004: it is EXACTLY 0.3. in fact, this calculator has a simplification step!
1.0: added variable definition, fixed 1+1 equaling 11, and made a whole new instruction manual... and oh geez this thing is nearing gravity simulator in length lol