Please sign in to comment.
add type inference and variable value generators for JME part
Numbas.jme.inferVariableTypes finds assignments of types to free variables in an expression which should allow the expression to be evaluated. For example, in `k*det(a)`, `a` should be a matrix, and `k` can be anything that can be multiplied by a number. The type inference is used to establish types for free variables in the answers to mathematical expression parts, so we can pick random values for them and evaluate, to compare against the student's answer. There are default expressions generating values for the built-in types for which that makes sense (i.e. things like number and matrix, but not list, dict or html). Now, parts with answers like `k*det(a)` and `a and b` can be marked without any further setup by the question author. Question authors can optionally give a value-generating expression for a variable used in the correct answer. The expression is given a value `vRange` representing the checking range parameter for the part. Now that the type inference is in, I'm struggling to come up with a question where the custom expressions are needed. Maybe an expression whose domain is x>1 and y<-1? fixes #398
- Loading branch information...
Showing with 528 additions and 10 deletions.
Oops, something went wrong.