Closed christianp closed 1 year ago
Just using display mode for subvars
when getting the correct answer for a mathematical expression part was not the right thing to do: it meant that subbed-in values don't always get brackets round them.
I don't think Numbas.jme.subvars
can be fixed in display mode without breaking a lot of existing questions: we'd need to interpret the expression as a tree, but there are questions that rely on it acting like a string, particularly with unclosed braces.
I've made a note that Numbas.jme.subvars
shouldn't be used for subbing into JME expressions in display mode, instead preferring Numbas.jme.display.subvars
, which does parse the expression as a tree.
decimal
values are currently rendered using thedec(...)
syntax in JME, and often in scientific notation in TeX.Quite often, this isn't the best choice: a student would expect to see an unannotated decimal number.
The immediate motivation of this issue is when the correct answer to a mathematical expression part has a decimal value substituted in. The expected answer ends up looking like
dec("1.23")*x
, which a student would never type, and the LaTeX preview looks like\\textrm{1.23} x
.The
getCorrectAnswer
method for mathematical expression parts usesNumbas.jme.subvars
to substitute values in. It doesn't currently use thedisplay
flag, but maybe it should. The simplification step then rendersx^{dec(0.123456789}
asx^1.23456789*10^-1
, which is not equivalent.Should we avoid rendering decimals in scientific notation when the exponent is small?