Difference between revisions of "FormulaTroubleshooting"

From WeBWorK_wiki
Jump to navigation Jump to search
(New page: <h2>Formula Answer Evaluation: Troubleshooting</h2> <!-- Header for these sections -- no modification needed --> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;...)
 
m (3 revisions: import all default namespace pages from old wiki)
 
(2 intermediate revisions by one other user not shown)
Line 68: Line 68:
 
</p>
 
</p>
 
<p>
 
<p>
The domain and the tolerance should be set to work together. For example, if you ask students for an increasing exponential function f(x) and also for f(300) as a follow up question, but you set the domain to -1 &LT; x &LT; 1 with tolerance 0.0000001, it is likely that because the domain is so far from x=300 that no matter how small you set the tolerance, the answer checker won't work as you would like for f(300). Instead, in this situation, it would be better to set the domain to 290 &LT; x &GT; 310 with a moderate tolerance such as 0.0001.
+
The domain and the tolerance should be set to work together. For example, if you ask students for an increasing exponential function f(x) and also for f(300) as a follow up question, but you set the domain to -1 < x < 1 with tolerance 0.0000001, it is likely that because the domain is so far from x=300 that no matter how small you set the tolerance, the answer checker won't work as you would like for f(300). Instead, in this situation, it would be better to set the domain to 290 < x < 310 with a moderate tolerance such as 0.0001.
 
</p>
 
</p>
 
</td>
 
</td>
Line 100: Line 100:
 
<p>
 
<p>
 
<b>Answer Evaluation:</b>
 
<b>Answer Evaluation:</b>
We can use <code>diagnostics=&GT;1</code> as an argument to the <code>cmp()</code> call to get graphs of the correct answer and the student answer, as well as information about how far off the student's answer is from the correct answer. This will create a pink screen and generate a warning, so you should only use it while troubleshooting, and not while a problem is in normal service.
+
We can use <code>diagnostics=>1</code> as an argument to the <code>cmp()</code> call to get graphs of the correct answer and the student answer, as well as information about how far off the student's answer is from the correct answer. This will create a pink screen and generate a warning, so you should only use it while troubleshooting, and not while a problem is in normal service. You may also want to try <code>debug=>1</code>.
 
</p>
 
</p>
 
</td>
 
</td>

Latest revision as of 15:19, 14 May 2010

Formula Answer Evaluation: Troubleshooting


This code snippet offers advice for troubleshooting when the correct answer isn't being marked correct, or when incorrect answers are being marked correct. Note that these are insertions, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.

Problem Techniques Index

PG problem file Explanation
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
);

Initialization: We use MathObjects answer checkers.

Context("Numeric");
Context()->flags->set(tolerance=>0.0001,tolType=>"relative");

$f = Formula("ln(x)");
$f->{limits} = [1,3]; # default is [-1,1]

Setup: Set the domain to 1 < x < 3 to avoid places where the function is undefined or has a vertical asymptote. For more ways to set the domain and to set test points that will avoid bad spots in the domain, see FormulaTestPoints

Try to keep outputs of formulas in the range between 10^(-4) and 10^4 for accurate function evaluation, especially near vertical asymptotes. Moderate values are better. Outside of this range, you may want to set the tolerance manually (which has default 0.01 percent). For more on how to set the tolerance, see NumericalTolerance

The domain and the tolerance should be set to work together. For example, if you ask students for an increasing exponential function f(x) and also for f(300) as a follow up question, but you set the domain to -1 < x < 1 with tolerance 0.0000001, it is likely that because the domain is so far from x=300 that no matter how small you set the tolerance, the answer checker won't work as you would like for f(300). Instead, in this situation, it would be better to set the domain to 290 < x < 310 with a moderate tolerance such as 0.0001.

BEGIN_TEXT
Enter \( ln(x) \): \{ ans_rule(10) \}
END_TEXT

Main Text: This is standard.

ANS( $f->cmp(diagnostics=>1) );

Answer Evaluation: We can use diagnostics=>1 as an argument to the cmp() call to get graphs of the correct answer and the student answer, as well as information about how far off the student's answer is from the correct answer. This will create a pink screen and generate a warning, so you should only use it while troubleshooting, and not while a problem is in normal service. You may also want to try debug=>1.

Problem Techniques Index