I have an exercise where I’d like to give feedback if the formula the student submitted is off by a specific constant (think: they took the antiderivative correctly but didn’t use the initial condition).
I know how to trigger the feedback when their answer plus a constant equals the correct answer, but how can I give the feedback if their answer plus the constant would be considered correct by the answer checker even if it’s not exactly equal to the correct answer?
More details: in some random variations of the problem, a numerical coefficient involves a repeating decimal and so the problem statement truncates the number, which means that the students will necessarily have a truncated decimal in their answer and won’t ever be “truly equal” to the correct answer. I set up the answer to allow error, and use symbolicEquality with simplifyOnCompare since it’s a function answer, and that works fine - it’s just triggering the feedback in this case that I need some help with.
What I would do is add an <award credit="0" name="close"> in the <answer> with the answer that is missing the constant. That way, you have all the other attributes available. Then, use <feedback condition="$close"> for the feedback. The nice part about that is (unless you muck with numAwardsCredited), the <award name="close" /> won’t be chosen if a different <award> with higher credit matches. You don’t have to worry about not showing the feedback if the answer is correct, as that is taken care of automatically.
Another option is to use a <boolean> (e.g., in a <setup>) and reference that inside the <feedback>. A <boolean> accepts attributes such as symbolicEquality and allowedErrorInNumbers.
That worked great, thank you! As you indicated, it seems better to me to trigger the feedback within the answer because then the same conditions definitely apply, along with the other features you mention.
I seem to recall having feedback in other problems where I’ve had to set conditions for answer.justSubmitted and answer.creditAchieved!=1… this likely means I could have triggered it better within a 0 credit award instead of whatever it was I was doing!
That’s right. Triggering off a zero-credit award can make it cleaner, as it then does not need help to infer that it should just update when the answer is submitted.