WeBWorK Main Forum

domain mismatch with apparently correct answer

domain mismatch with apparently correct answer

by Michael Shulman -
Number of replies: 1

I have a strange situation where a student appears to have entered the correct answer, but is getting the message "The domain of your function doesn't match that of the correct answer."  See attached screenshot.  I can imagine that maybe there is some issue with fractional powers of negative numbers (I'm using Context("Fraction") to get the 1/3 instead of 0.3333333, and the "limits" flag is set to [2,5]), but in that case I would expect instead to see "Can't generate enough valid points for comparison" when the student answer and the correct answer are identical.  Any ideas?  This is a custom-written problem; I can share the source if it would help.

Attachment Screenshot from 2023-12-14 10-52-48.png
In reply to Michael Shulman

Re: domain mismatch with apparently correct answer

by Alex Jordan -

Sharing the problem source would help to see what exactly is happening here. Perhaps one side of a comparison reduces a "1/3" to 0.3333, and then raising a negative number to that power produces no output. While the other side of the comparison is with an object where the 1/3 power is interpreted as a third root, and a negative base is OK.

You can set the interval that test points should be drawn from:
https://webwork.maa.org/wiki/FormulaTestPointshttps://webwork.maa.org/wiki/FormulaTestPoints

You will probably avoid this issue (whatever the actual issue is) if you keep the bases positive. So in this case using [-1,1] would keep cos(x) positive.