Fractions(/mathematical expressions) in matrices

17 views
Skip to first unread message

Christopher Tedd

unread,
Nov 8, 2021, 9:39:00 AM11/8/21
to Numbas Users

Hi,

A student has run into an issue with the following question: https://numbas.mathcentre.ac.uk/question/share/view/1010bb19-5b80-406e-9c00-fa834b024e6a (I have fixed the matrix entries to those which replicate the bug; the correct answer is –60/11), which arises due to the fact that in wanting to provide custom feedback, the author (not myself, although I am responsible for 'maintaining' the question) wrote a custom marking algorithm which puts the student's answer into the matrix in the place of a and calculates the determinant using JME's det() function. The issue is that the student's answer begins as a fraction, but as soon as it gets put into the matrix it becomes (I imagine) a Javascript floating point number, and so (again, I imagine) Javascript's famous aptitude for arithmetic takes over. Any suggestions for how to work around this? For example can I still set the relevant feedback, without marking the question based on whether Javascript thinks det(D)=0? If I take out the custom script, as I have done here: https://numbas.mathcentre.ac.uk/question/share/view/54ee5c8e-bda8-46ae-9369-99e2bc1715b6 the question is marked correctly. (a cheap way round it would be to multiply through by the denominator before taking the determinant but I would like something a little more sophisticated).

Thanks,
Christopher

Reply all
Reply to author
Forward
0 new messages