WeBWorK Problems

Not Correctly Checking the Function

Not Correctly Checking the Function

by Jason Aubrey -
Number of replies: 2
Hi All,

I wrote the problem below on derivatives. My intention with parts (a) and (b) was for students to see the virtues of simplifying the function they are given (if possible) before finding the derivative. Standard stuff. Anyway, a student (with seed 188) did exactly as I wished and put in the correct answer for part (a), but WW counted her answer as incorrect.

I understand that WW is each function at 5(?) points, and that this almost always works. But this particular problem (which seems standard to me) led me to wonder if we can predict when it won't work (or at least say something about when it might not work).

As a practical question - can we access the actual test points (and corresponding function values) from within the problem to find out what's really happening?

Or, maybe I did something I shouldn't have done when writing this problem which could be avoided in the future.

Thanks for any comments.
Jason

loadMacros(
"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
#"source.pl", # allows code to be displayed on certain sites.
#"PGcourse.pl", # Customization file for the course
);

# Print problem number and point value (weight) for the problem
TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;

##############################################################
#
# Setup
#
#
Context("Numeric");
Context()->variables->add(t=>'Real');

$x = Formula('x');
$t = Formula('t');

#Function 1
$a1 = random(1,10,1);
$power11 = random(2,9,1);

$b1 = random(1,10,1);
$power12 = random(2,9,1);

$c1 = random(2,15,1);
$power13 = random(4,20,2);

$function1 = Formula("$a1/sqrt($t**$power11) + $b1*sqrt($t**$power12) - $c1*$t**$power13");

$derivative1 = $function1-> D();

#Function 2

$a2 = random(1,10,1);
$power21 = random(2,9,1);

$b2 = random(2,10,1);
$power22 = random(2,9,1);

$c2 = random(2,15,1);
$power23 = min($power21,$power22);

$function2 = Formula("($a2*$x**$power21+$b2*$x**$power22+$c2)/$x**$power23");

$derivative2 = $function2 -> D();

#Function 3

$a3 = random(1,10,1);
$power31 = random(2,9,1);

$b3 = random(1,10,1);

$c3 = random(2,15,1);

$function3 = Formula("($a3*$x**$power31 + sqrt($x))/($b3*$x + $c3)");
$derivative3 = $function3 -> D();

#Function 4

$const = random(-10,-1,1);

$a4 = random(1,10,1);
$power41 = random(2,9,1);

$b4 = random(1,10,1);
$power42 = random(2,9,1);

$c4 = random(2,50,1);

$d4 = random(2,9,1);
$e4 = random(2,50,1);

$power43 = random(2,9,1);


$function4 = Formula("$const*($a4*$x**$power41 + $b4*$x**$power42 + $c4)(sqrt($x) + $d4*$x - $e4)**$power43");

$derivative4 = $function4->D();

##############################################################
#
# Text
#
#

Context()->texStrings;
BEGIN_TEXT
Find the derivative of each function.
$PAR
(a) \( \displaystyle g(t) = $function1\)
$PAR
\( \displaystyle g'(t) = \) \{ ans_rule(40) \}
$PAR
(b) \( \displaystyle y = $function2 \)
$PAR
\( \displaystyle y' = \) \{ ans_rule(40) \}
$PAR
(c) \( \displaystyle f(x) = $function3 \)
$PAR
\( \displaystyle f'(x) = \) \{ ans_rule(60) \}
$PAR
(d) \( \displaystyle f(x) = $function4 \)
$PAR
\( \displaystyle f'(x) = \) \{ ans_rule(60) \}
$PAR
END_TEXT
Context()->normalStrings;

##############################################################
#
# Answers
#
#
ANS( $derivative1 -> cmp() );
ANS( $derivative2 -> cmp() );
ANS( $derivative3 -> cmp() );
ANS( $derivative4 -> cmp() );

In reply to Jason Aubrey

Re: Not Correctly Checking the Function

by Jason Aubrey -
Ah (of course) I should have either restricted t to positive values or the exponent in sqrt(t^n) to odd values.
In reply to Jason Aubrey

Re: Not Correctly Checking the Function

by Davide Cervone -
Can you give the answer the student actually entered? I did the simplification and WW marked it correct.

For me, with seed 188 I get the original question being [dmath]g(t) = \frac{9}{\sqrt{t^{8}}}+2\sqrt{t^{2}}-8t^{10}[/dmath] so I simplified as [dmath]g(t) = \frac{1}{t^4}+2|t|-8t^{10}[/dmath] which gives a derivative of [dmath]g'(t) = -\frac{4}{t^5}+2\frac{t}{|t|}-80t^9[/dmath] which WeBWorK marks as correct.

Could it be that the student "simplified" [math]\sqrt{t^2}[/math] as [math]t[/math] rather than [math]|t|[/math]? Since the values of [math]t[/math] range over both positives and negatives, that would make a difference. Of course, the derivative of [math]|t|[/math] is the signum function [dmath]\mathop{\rm sgn}(x)=\begin{cases}-1&{\rm if\ }x < 0,\cr 1&{\rm if\ }x &gt 0,\cr {\rm undefined}&{\rm if\ }x=0\end{cases}[/dmath] which I obtained by using [math]t/|t|[/math].

As for seeing the test points, you can do that by adding diagnostics=>1 to the answer checker:

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

This will produce a table of the values, color-coded to see which ones are marked correct and which aren't, and when the function is a single-variable function, it will show the graph of the function and the errors.

Hope that helps.

Davide