I'm trying to build a calculator that would accept mathematical expressions from different users. I'm stuck in one part and would like to know good ways of solving the following problem:
I need to check what user enters against my answer. Say I have x + 1 as a correct answer, but user entered 1 + x. How can I build something that would check for all associativity and commutativity in a given equation? Of course that's one example but the problem gets more complicated when you have more than 4 variables. (with one unknown variable things are easy just easy)
I have used shunting yard algorithm to find the operators-precedence but it complicated things and I failed to do the task. Any idea how would I solve such a problem?