I'm writing a small app in python which lets users answer math questions. The problem I'm having is checking their answers.
Say there's a question like: "Factorise x^2 + 3x +2
"
There are different ways to answer this; for example:
- (x + 1)(x + 2)
- (x + 2)(x + 1)
- (2 + x)(x + 1)
- etc.
Is there a library which will check if an answer is equivalent to another? Particularly one which doesn't simplify the given answer; so:
(x + 1)(x + 2)
=== (2 + x)(x + 1)
But
(x + 1)(x + 2)
!== x^2 + 3x +2
I thought about using wolframalpha for this — would this be possible — and if so what syntax should I use?
Thanks!