Difference between revisions of "DifferenceQuotients"

From WeBWorK_wiki
Jump to navigation Jump to search
m (3 revisions: import all default namespace pages from old wiki)
(Update links to http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserDifferenceQuotient.pl?view=log, etc)
Line 131: Line 131:
   
 
<ul>
 
<ul>
<li>POD documentation: [http://webwork.maa.org/doc/cvs/pg_CURRENT/macros/parserDifferenceQuotient.pl.html parserDifferenceQuotient.pl.html]</li>
+
<li>POD documentation: [http://webwork.maa.org/pod/pg_TRUNK/macros/parserDifferenceQuotient.pl.html parserDifferenceQuotient.pl.html]</li>
<li>PG macro: [http://cvs.webwork.rochester.edu/viewcvs.cgi/pg/macros/parserDifferenceQuotient.pl parserDifferenceQuotient.pl]</li>
+
<li>PG macro: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserDifferenceQuotient.pl?view=log parserDifferenceQuotient.pl]</li>
 
</ul>
 
</ul>

Revision as of 15:24, 6 November 2010

Difference Quotients as Student Answers


This PG code shows how to check student answers that fully reduced difference quotients for limits that compute derivatives.

Problem Techniques Index

PG problem file Explanation
DOCUMENT();

loadMacros(
"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.

If the student enters an unsimplified answer such as ((x+h)^2-x^2)/h, their answer will not be marked correct and they will receive the message It looks like you didn't finish simplifying your answer.

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.

Problem Techniques Index