Expression equality is handled by https://github.com/kisonecat/math-expressions using a few heuristics, which is necessary because Richardson's theorem says this problem is undecidable. The main trick is to regard the expressions as complex-valued functions, find a point where the value is (nearly) equal, and then check for numerical equality in a neighborhood. (Doing this over the complex plane addresses the problem that many common expressions like sqrt(small number-x^2) have a restricted domain over the reals).
We rely on unit tests from Chris Sangwin (who wrote the textbook _Computer Aided Assessment of Mathematics_) to ensure that we're adjudicating expression equality mostly correctly.
For polynomial functions, it's clear how many samples to use; what about others? Do you settle on a magic constant and call it a day?
The main goal is to make sure that we pass the tests listed in https://github.com/kisonecat/math-expressions/blob/master/sp...
I'm going to try to make some stuff myself. I would mostly do it for developmental math, college algebra, and trig. I haven't dug too deep into how to make my own stuff using Ximera but I'm hoping I won't have to write Javascript myself to handle checking expressions.
So we do support SageMath for more complicated answer validation. This depends on the public SageMath cell servers, which provides cloud-hosted SageMath and enables things like \sage{derivative(x*x,x)}. It's also more performant to rely on JavaScript.
For developmental math, answer validation is somewhat harder than for calculus, because often you want to distinguish between say (x+1)^2 and x^2 + 2x + 1.
We run workshops on how to use Ximera. The next one is at UFlorida in October. If you're interested, there is some travel support available. Contact us at ximera@math.osu.edu
https://ximera.osu.edu/introduction
you can see how to make your own materials.
There is a set of example environments here:
$ 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.)