1 The Problem

There are lots of reasons we would find it much easier to test derivatives, rather than functions themselves. For example, if you want to see if a student supplied a correct antiderivative can be tricky, since there are infinitely many options for an antiderivative. So this validator checks that the derivatives of the student’s answer and the author’s answer line up.

2 Potential Pitfalls and Problems

2.1 Letters like Arbitrary Constants are treated like Variables

In order to build a validator that is, somehow, indifferent to variable, this validator actually checks all lower case letters as if they are variables to make sure that it matches the provided answer. This can also be nice to make sure that students don’t randomly change variables (e.g. default to “x” rather than keep it in terms of the variable given). It also checks the “variable” , to make the classic “” testable. Note however, that this checks the derivatives as if the was a variable, so if the student enters something like “” and the instructor provided , then the derivatives won’t match () and thus the answer will be rejected. This may be desirable behaviors in some classes, and not in others.

3 Example

This problem shows the ’same derivative’ validator. It’s intended to be used to test the result of an indefinite integral, so it requires the “” at the end, and (should) mark any answer wrong that doesn’t have it. Note that the is case-sensitive.

Enter in any answer whose derivative is (and don’t forget the , but notice you can also add random constants to it too).

Sidenote: You can avoid the problem of the if you don’t put it in the expected answer box, which will then (correctly) mark an answer wrong that does include a . So in a sense you can force the student to include it, or not, with this validator. Although only checking the derivatives to match has obvious issues for non indefinite integrals.

4 The Code

\begin{javascript}
 
// NOTE: The below are intended to be used inside an \answer optional argument with the validator key, NOT in a validator environment.  
 
// sameDerivative checks to see if the derivative with respect to x and c are equal.  
// Because of how they are loaded, I need to currently manually check each variable letter, so we do a full comparison  
// Currently not checking e, f, g, h, or i as variables because they are special reserve letters in math.  
  sameDerivative = function(a,b) {  
    return (  
    a.derivative(’a’).equals( b.derivative(’a’) ) &&  
    a.derivative(’b’).equals( b.derivative(’b’) ) &&  
    a.derivative(’c’).equals( b.derivative(’c’) ) &&  
    a.derivative(’d’).equals( b.derivative(’d’) ) &&  
    a.derivative(’j’).equals( b.derivative(’j’) ) &&  
    a.derivative(’k’).equals( b.derivative(’k’) ) &&  
    a.derivative(’l’).equals( b.derivative(’l’) ) &&  
    a.derivative(’m’).equals( b.derivative(’m’) ) &&  
    a.derivative(’n’).equals( b.derivative(’n’) ) &&  
    a.derivative(’o’).equals( b.derivative(’o’) ) &&  
    a.derivative(’p’).equals( b.derivative(’p’) ) &&  
    a.derivative(’q’).equals( b.derivative(’q’) ) &&  
    a.derivative(’r’).equals( b.derivative(’r’) ) &&  
    a.derivative(’s’).equals( b.derivative(’s’) ) &&  
    a.derivative(’t’).equals( b.derivative(’t’) ) &&  
    a.derivative(’u’).equals( b.derivative(’u’) ) &&  
    a.derivative(’v’).equals( b.derivative(’v’) ) &&  
    a.derivative(’w’).equals( b.derivative(’w’) ) &&  
    a.derivative(’x’).equals( b.derivative(’x’) ) &&  
    a.derivative(’y’).equals( b.derivative(’y’) ) &&  
    a.derivative(’z’).equals( b.derivative(’z’) ) &&  
    a.derivative(’C’).equals( b.derivative(’C’) )) ;  
  };  
 
 
 
\end{javascript}  
 
%%%%  
\begin{problem}  
    This problem shows the ’same derivative’ validator. It’s intended to be used to test the result of an indefinite integral, so it requires the ‘‘$+C$’’ at the end, and (should) mark any answer wrong that doesn’t have it. Note that the $C$ is case-sensitive. \\  
 
    Enter in any answer whose derivative is $x^2 + \sin(x) - 3$ (and don’t forget the $+C$, but notice you can also add random constants to it too).  
    \[  
        \int x^2 + \sin(x) - 3 dx = \answer[validator=sameDerivative]{\frac{1}{3}x^3 - \cos(x) - 3x + C}  
    \]  
 
    Sidenote: You can avoid the problem of the $+C$ if you don’t put it in the expected answer box, which will then (correctly) mark an answer wrong that \textit{does} include a $+C$. So in a sense you can force the student to include it, or not, with this validator. Although only checking the derivatives to match has obvious issues for non indefinite integrals.  
\end{problem}