Check for correctness when the correct answer is "undefined"

I’m working on a slope lesson and am wondering if it’s possible for my correctness check to look for “undefined” as an answer. Students can type in 3/0, for example, and it displays as undefined in the math input, but can I use a correct sink when the correct answer is undefined?

I know how to do this with MC, but hoping I can do it with math input while they’re still learning about slope ratios.

What would you find acceptable as an answer?

Do you want to give them a hint, such as “if the slope is undefined, type _____”?

The fraction pattern will still parse a fraction even if it’s undefined.

Aethir beat me to it, but yeah, I’d use a pattern and parse the denominator to check if it’s zero or not.

Or give them a table where they enter numerator and denominator separately, and Desmos combines them into a displayed slope fraction for them.

wondering if it’s possible for my correctness check to look for “undefined” as an answer

It almost sounds like you want to accept undefined as correct, but assuming it’s that you want to reject it but handle it differently than your typical error, something like this will work:

check = isDefined(this.numericValue) and this.submitted
undef = isUndefined(this.numericValue) and this.submitted

errorMessage: ""
disableEvaluation: true

suffix: 
when this.script.check "nice one!"
when this.script.undef "that's undefined"
otherwise ""

correct: check

The advantages being you don’t need to mess with parsing fractions and it will also correct kids who try to enter something else you’re not expecting that would be undefined(such as square root of a negative or something).

3 Likes