Hacker News new | ask | show | jobs
by shawn 2838 days ago
One way to do this is to install Mathematica and then run

  $ wolframscript --code "6 == 5 + 1"
  True
Suppose you know that a function is equal to "(x - 1)(x + 1) - 42". You want to check whether the student has given an equivalent function, like "x^2 - 43":

  $ wolframscript --code "f[x_] := (x - 1)(x + 1) - 42;
  Simplify[f[x]] == Simplify[x^2 - 43]"
  True
But it should also return True for any other form, like "-43 + x^2". And indeed it does:

  $ wolframscript --code "f[x_] := (x - 1)(x + 1) - 42; 
  Simplify[f[x]] == Simplify[-43 + x^2]"
  True
So in general, you can write a script which inserts the student's answer into the right-hand "Simplify[...]" block. If it prints True, they're equivalent.

It's also possible to feed a natural language expression like "the integral of Sin(x) from 0 to pi is equal to 2" into wolfram alpha, and check whether it returns True or False:

http://www.wolframalpha.com/input/?i=the+integral+of+Sin(x)+...

(To be clear, I don't think this is how this project does it. I was just giving a way to do it.)