# NAME

parserDifferenceQuotient.pl - An answer checker for difference quotients.

# DESCRIPTION

This is a Parser class that implements an answer checker for difference quotients as a subclass of the Formula class. The standard ->cmp routine will work for this. The difference quotient is just a special type of formula with a special variable for 'dx'. The checker will give an error message if the student's result contains a dx in the denominator, meaning it is not fully reduced.

Use DifferenceQuotient(formula) to create a difference equation object. If the context has more than one variable, the last one alphabetically is used to form the dx. Otherwise, you can specify the variable used for dx as the second argument to `DifferenceQuotient()`. You could use a variable like h instead of dx if you prefer. This is specified in the second argument. If you want to identify division by zero when a value other than zero is substituted in for dx (or h), then the third argument is a number to be substituted into the variable named in the second argument. The third argument is optional and the default value 0 is used when the third argument is omitted.

# USAGE

```        # simplify (f(x+dx)-f(x)) / dx for f(x)=x^2
\$df = DifferenceQuotient("2x+dx");
ANS(\$df->cmp);```
```        # simplify (f(x+h)-f(x)) / h for f(x) = x^2
\$df = DifferenceQuotient("2x+h","h");
ANS(\$df->cmp);

# simplify (f(t+dt)-f(t)) / dt for f(t)=a/t
Context()->variables->are(t=>'Real',a=>'Real');
ANS(DifferenceQuotient("-a/[t(t+dt)]","dt")->cmp);```
```        # simplify (f(x)-f(c)) / (x-c) for f(x)=x^2 at c=3
\$df = DifferenceQuotient("x+3","x",3);```
```        # simplify (x^2 - 4) / (x-2)
\$df = DifferenceQuotient("x+2","x",2);
ANS(\$df->cmp);```