# DifferenceQuotient1

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Answer is a Difference Quotient

Click to enlarge

This PG code shows how to require students to simplify a difference quotient.

PG problem file Explanation

Problem tagging:

DOCUMENT();

"PGstandard.pl",
"MathObjects.pl",
"parserDifferenceQuotient.pl",
);

TEXT(beginproblem());


Initialization: We need to include the macros file parserDifferenceQuotient.pl.

Context("Numeric");

$limit = DifferenceQuotient("2*x+h","h");$fp = Compute("2 x");


Setup: The routine DifferenceQuotient("function","variable") takes the simplified function and a variable name. If the variable is omitted, dx is used by default.

Context()->texStrings;
BEGIN_TEXT
Simplify and then evaluate the limit.
$BR$BR
$$\displaystyle \frac{d}{dx} \big( x^2 \big) = \lim_{h \to 0} \frac{(x+h)^2-x^2}{h} = \lim_{h \to 0} \big($$
\{ ans_rule(15) \}
$$\big) =$$
\{ ans_rule(15) \}
END_TEXT
Context()->normalStrings;


Main Text:

$showPartialCorrectAnswers = 1; ANS($limit->cmp() );
ANS( \$fp->cmp() );


Context()->texStrings;