WeBWorK Problems

Using "limits" for test points

Using "limits" for test points

by Bentley Garrett -
Number of replies: 1

It's my understanding that I should manually set the range of test points to be within the domain of a function to avoid an answer being graded as incorrect, that is really correct.

For example, when I use

$answer = Formula(" 1/(cosx(1-3tanx)^(1/3)) ")->with(limits=>[.01,.02]);

then the student's answer


will be marked correct, whereas it might not with out these limits, since the test points might fall outside the domain.

However, I noticed that, with these same manual limits, the answer


is counted as correct, even though it isn't.

If I expand the limits to [.01,1], for example, then the answer will be marked as incorrect, as it should.

Is there a way to know how large I need to set the limits to avoid students' problems being graded incorrectly?



In reply to Bentley Garrett

Re: Using "limits" for test points

by Davide Cervone -
Usually you want to use a domain that is reasonably large, but that says away from where the function has zeros or where it gets too large. If the domain is too small, you can easily get functions marked correct that aren't, since they only have to match in a small region.

In your case, the function blows up near the zeros of the denominator, which are when cos(x) = 0 or 1-3tan(x) = 0. The first is at -pi/2, pi/2, etc. while the second is when tan(x) = 1/3, which is approximately .322 (and other values). So a range between -pi/2 and .322 would be good. Of course, near these endpoints, the function gets very large, so perhaps [-1.2,.2] would be sufficient.

Of course, the problem may adjust the coefficients, so you might need to adjust that for different random values, but that's the idea.

I would not recommend [.01,1] as that includes a discontinuity of the function, and so you may get numeric instability as the values get very large in magnitude near that point.