i know it seems like i am asking too much here. But with knowing expression evaluator class got me wondering if there also a way to calculate more complex expression like Max, Min, root, and Abs.

i already did some search by myself and found out about Ncalc, but i can’t found a way to use it, and it’s not maintained anymore.

Thank you for every response.

Edit: I’m sorry for being not clear enough.

what i am trying to do is calculate an equation inside a string like expression evaluator but with additional math command like Max, Min, root, and abs

here the following example

calculateThis(“max (30/2 , 1 , 10^(3/2))”)

Edit 2: even though i did mention Expression evaulator the solution i need is for runtime script

i would need to parse every string and doing it in correct order .

yes, you’ll need to tackle these sorts of things.

or you could search the googles for a solution.

Your question is still not specific enough. Since you mentioned Unity’s ExpressionEvaluator it’s not clear if you need a solution for an editor script or a solution for the runtime.

Anyways some time ago i’ve written a simple expression parser which creates a custom expression tree out of the provided expression. You can define constants or additional custom functions. The parser even supports “parameters” and the expression tree can be wrapped by a delegate so you can use it like a normal method.

Note that the “min” and “max” functions only support two parameters. Though you can provide your own implementation. Just use “AddFunc” and overwrite the min and max with your own implementation if you like.

If you want to use this ExpressionParser make sure you read the additional notes. There’s no unary minus. It need to be put in brackets.

So `(5 * -3)`

need to be written as `(5 * (-3))`

So far i only know of Mathf.Sqrt/Max/Min/Abs.

Documentation can be foun here. If you come by anything else let us know.