Correct Check for Numeric Value

I assume you meant you wanted to check that an answer is given as a mixed fraction.

I’d use something like this (in the math input component):

checkValue = numericValue("\abs(${this.latex}-(8/3))")<=0.01
checkMixed = countNumberUsage(this.latex,2)=2 and countNumberUsage(this.latex,3)=1
correct: checkValue and checkMixed

checkValue just checks if the value is correct within 0.01, so 2.67, 8/3, or 2 2/3 would output true. checkMixed uses countNumberUsage to see if the number 2 is used twice, and 3 once. I split into two parts so you could give specific feedback if the answer isn’t a mixed fraction but is the correct value.

Let me know if there are any other questions about the code.