WeBWorK Problems

Evaluating a Formula at an undefined value

Evaluating a Formula at an undefined value

by Paul Seeburger -
Number of replies: 2
I have figured out how to use test_at to add values where the correct answer is defined but the student answer may not be defined.

For example when the correct answer is ln |x| and the student enters: ln x.

But what if the situation is the other way around?

What if the correct answer is ln x and the student enters: ln |x|?  When I try to add negative values to test_at, I get the error:  Can't evaluate formula on test point (-1)

Yet when I don't check at negative values, the student is given full credit for the ln |x|, even though it is NOT equivalent to the correct function.  It just happens to be equivalent on the domain of the correct answer.

The same issue comes up with sqrt(x) and sqrt|x| for example.

Can anyone point me to the way to help the checker to discriminate correctly in these cases?

Thanks!

Paul
In reply to Paul Seeburger

Re: Evaluating a Formula at an undefined value

by Davide Cervone -
You need to set the formula's checkUndefinedPoints property to true in order for MathObjects to allow checking at undefined points. See the table of Formula Properties for details.
In reply to Davide Cervone

Re: Evaluating a Formula at an undefined value

by Paul Seeburger -
I had tried that, but apparently not in conjunction with extra test_at points.

I had an issue with a bad seed causing there not to be enough valid test points with a square root function.

Now it works perfectly.  I added enough additional test_at points to eliminate the "not enough test points" error, and I added a -1 test_at value to check for the correct domain of the function along with your suggested flag set to 1.

Thanks, Davide!

Paul