I have a question about using limits to specify the domain of a function in fun_cmp. If for example the answer I'm looking for is sqrt(1-x^2), do I need to specify
limits=>[-1,1] or will WebWork know to pick test points between -1 and 1. And if the answer is 1/sqrt(1-x^2), should I use something like limits=>[-.9,.9] to make sure the endpoints are avoided?
Thanks.
Gabriela
Hi Gabriela,
WebWork does have a default domain (which is [-1,1], I think). However, whenever a function has domain issues, it is best to use a custom domain. I would recommend that you set the domain yourself and also use the MathObjects answer checkers, which are newer and provide better feedback to the students than the old answer checkers. For an example of how to use MathObjects for this type of question, see
http://webwork.maa.org/wiki/FormulaDomain1
More generally, there are many examples of how to use MathObjects at
http://webwork.maa.org/wiki/SubjectAreaTemplates
http://webwork.maa.org/wiki/IndexOfProblemTechniques
Good luck!
Paul Pearson
WebWork does have a default domain (which is [-1,1], I think). However, whenever a function has domain issues, it is best to use a custom domain. I would recommend that you set the domain yourself and also use the MathObjects answer checkers, which are newer and provide better feedback to the students than the old answer checkers. For an example of how to use MathObjects for this type of question, see
http://webwork.maa.org/wiki/FormulaDomain1
More generally, there are many examples of how to use MathObjects at
http://webwork.maa.org/wiki/SubjectAreaTemplates
http://webwork.maa.org/wiki/IndexOfProblemTechniques
Good luck!
Paul Pearson
Hi Gabriela,
WeBWorK's default domain is essentially (0,1) (really [.0000001,.9999999]) and is set in global.conf (functLLimitDefault and functULimitDefault).
End points are automatically avoided when random evaluation points are chosen (see pg/macros/PGfunctionevaluators.pl) so in your example above you can use limits=>[-1,1]. Note that the default domain [.0000001,.9999999] is being doubly careful to avoid 0 and 1 and is really (.0000001,.9999999).
Arnie
Just a slight expansion on Paul and Arnie's replies. The default limits for the traditional checkers (i.e., the non-MathObjects checkers like
Note that the traditional checkers now use MathObjects behind the scenes, so you get nearly the same error messages and syntax checking that you do with MathObject directly. You also get the automatic discarding of points outside the domain, so you don't have to worry about the endpoints in your case, even if you give the limits explicitly.
Paul is right, though, that you should always be thinking about the domain, and should set it to something appropriate whenever there are potential domain issues. In addition to avoiding where the function is undefined, it is also best to avoid zeros of the function, if you can, as the numeric stability of the answer checker breaks down near these points.
Davide
fun_cmp
) is, as Arnie says essentially (0,1). The MathObject Formula checker uses [-2,2], but it discards points that are outside the domain (I don't think the traditional ones did that, which was one reason MathObjects could get away with a larger domain).Note that the traditional checkers now use MathObjects behind the scenes, so you get nearly the same error messages and syntax checking that you do with MathObject directly. You also get the automatic discarding of points outside the domain, so you don't have to worry about the endpoints in your case, even if you give the limits explicitly.
Paul is right, though, that you should always be thinking about the domain, and should set it to something appropriate whenever there are potential domain issues. In addition to avoiding where the function is undefined, it is also best to avoid zeros of the function, if you can, as the numeric stability of the answer checker breaks down near these points.
Davide
Hi Davide,
I have a question regarding "it is also best to avoid zeros of the function, if you can, as the numeric stability of the answer checker breaks down near these points".
Does the MathObjects function compare switch to doing an absolute comparison near zero values rather than a relative comparison in a manner similar to how the default numerical comparison method works? This is done in an attempt to mitigate numeric instability near zero.
Arnie
Yes, MathObejcts handles this in the same way that the traditional checkers do. But the zero-level tolerances are so tight that they don't usually kick in early enough, and answers near zeros that are above them are still problematic. Many times that I look into a "WeBWorK isn't grading this correct answer as correct" (when the answer actually is correct) it is due to instability near a zero.
I would like to modify the point-selection algorithm to discard the point that produces the smallest and largest numbers, in hopes of avoiding this problem.
I would like to modify the point-selection algorithm to discard the point that produces the smallest and largest numbers, in hopes of avoiding this problem.
Hi Davide,
As you say the tolerances are very tight (functZeroLevelDefault => 1E-14, functZeroLevelTolDefault => 1E-12) and are the same as the analogous numerical tolerances. These are probably exactly what Mike and I first set when we wrote the function compare algorithm back in 1996 or so. And the defaults (which are set in global.conf) were just based on an educated (but not a very educated) guess.
If you have some experience from looking at examples what might be more reasonable values to use, it would probably be good to change these.
Arnie