The biggest trick here is that TeX source like $\answer{2} + 1 = 3$ provides "answer blank + 1 = 3" on the web, but you can do more complicated things like $\sqrt{\answer{4}} = 2$.
The website uses Fraser's differential synchronization algorithm, so a student's work is saved as they do it -- and that happens in real time, so an instructor can "look over their shoulder" and watch a student working in real time. The server is actually a git server, so an author publishes content by performing a git push, and because the server knows the history of the content, the server provides the version of the content on which the student last did work.
I really like the interactive exercises. I teach math at a community college and would like to create interactive exercise sheets for some of my classes. I’m not familiar with Github and poked around a bit but I could not figure out how the answer checking was done. In one problem I did the answer was 6 and I was pleasantly surprised the answer 5+1 was counted as correct. Do you know how this is done?
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.
Thanks for the response and info. I looked at the README and it seems like you all use Javascript for this. I was thinking maybe Maple or Mathematica was used. I'm impressed with the calculus notes/exercises I saw. It looks professionally done. The fonts/colors are nice.
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.
Maple and Mathematica are not open, and it's important that not only the resources be open-source, but also the underlying technology stack, because we're trying to not only teach students mathematics but the most engaged students need to "look under the hood" and learn how the technology works.
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
The magic number is currently 100 samples; the perturbation size is "adaptive" in that the perturbation size is changed when the expressions appear to equal but they're also close to zero.
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":
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:
The website uses Fraser's differential synchronization algorithm, so a student's work is saved as they do it -- and that happens in real time, so an instructor can "look over their shoulder" and watch a student working in real time. The server is actually a git server, so an author publishes content by performing a git push, and because the server knows the history of the content, the server provides the version of the content on which the student last did work.