DifferenceQuotients
Jump to navigation
Jump to search
Difference Quotients as Student Answers
This PG code shows how to check student answers that fully reduced difference quotients for limits that compute derivatives.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserDifferenceQuotient.pl", ); TEXT(beginproblem()); |
Initialization:
We need to include the macros file |
Context("Numeric"); $limit = DifferenceQuotient("2*x+h","h"); $fp = Compute("2 x"); |
Setup:
The routine
If the student enters an unsimplified answer such as
|
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: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; $showPartialCorrectAnswers = 1; ANS( $limit->cmp() ); ANS( $fp->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |
- POD documentation: parserDifferenceQuotient.pl.html
- PG macro: parserDifferenceQuotient.pl