# Game / Challenge (Mathematical Functions)

So recently I’ve been looking into String parsing, and how to do it efficiently, and easily, and all that good stuff. I’m beginning to build up some tests with it, and so far I’ve created a couple “math statements” if you will,

``````additionCompound(multiplicationCompound(4, mean(1, 3)), eval((5*2) + 2 ^ 2))
``````

being one such statement. If the syntax looks like another language, it is not meant to, I created the syntax based on what I imagined. I figured I could create a challenge out of this to both test the community’s knowledge - and the understand-ability of my math system thing.

So to get to the point, the ‘challenge’ is:

Using the below example function, and list of functions provided, construct an equation. Post the equation and expected output. I will run your function in the parser, and reply with what the parser came up with.

Sample function:

``````additionCompound(multiplicationCompound(4, mean(1, 3)), eval((5*2) + 2 ^ 2))
``````

The above function/equation evaluates to 22.

List of Functions:

``````    ​add(double... values)
ceil(double value)
cos(double value)
divide(double... values)
floor(double value)
max(double... values)
mean(double... values)
median(double... values)
min(double... values)
mod(double a, double b)
multiply(double... values)
range(double... values)
rem(double a, double b)
sin(double value)
subtract(double... values)
tan(double value)
eval(String expression)
additionCompound([function || value]...)
divisionCompund([function || value]...)
multiplicationCompound([function || value]...)
subtractionCompound([function || value]...)
``````

I’d appreciate any replies because I’m interested in testing the parser itself, and not just how understandable it is.

Edit: Also, if anyone finds Im missing a crucial function, call me out on it.
Missing functions:
sqrt
powerOf
abs
sqr

removed…misunderstood