|
|
(2 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| <h2>Difference Quotients as Student Answers</h2>
| | #REDIRECT [[DifferenceQuotient1]] |
| | |
| <!-- Header for these sections -- no modification needed -->
| |
| | |
| <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;">
| |
| <em>This PG code shows how to check student answers that fully reduced difference quotients for limits that compute derivatives.</em>
| |
| </p>
| |
| | |
| <p style="text-align:center;">
| |
| [[IndexOfProblemTechniques|Problem Techniques Index]] | |
| </p>
| |
| | |
| <table cellspacing="0" cellpadding="2" border="0">
| |
| | |
| <tr valign="top">
| |
| <th> PG problem file </th>
| |
| <th> Explanation </th>
| |
| </tr>
| |
| | |
| <!-- Load specialized macro files section -->
| |
| | |
| <tr valign="top">
| |
| <td style="background-color:#ddffdd;border:black 1px dashed;">
| |
| <pre>
| |
| DOCUMENT();
| |
| | |
| loadMacros(
| |
| "PGstandard.pl",
| |
| "MathObjects.pl",
| |
| "parserDifferenceQuotient.pl",
| |
| );
| |
| | |
| TEXT(beginproblem());
| |
| </pre>
| |
| </td>
| |
| <td style="background-color:#ccffcc;padding:7px;">
| |
| <p>
| |
| <b>Initialization:</b>
| |
| We need to include the macros file <code>parserDifferenceQuotient.pl</code>.
| |
| </p>
| |
| </td>
| |
| </tr>
| |
| | |
| <!-- Setup section -->
| |
| | |
| <tr valign="top">
| |
| <td style="background-color:#ffffdd;border:black 1px dashed;">
| |
| <pre>
| |
| Context("Numeric");
| |
| | |
| $limit = DifferenceQuotient("2*x+h","h");
| |
| | |
| $fp = Compute("2 x");
| |
| </pre>
| |
| </td>
| |
| <td style="background-color:#ffffcc;padding:7px;">
| |
| <p>
| |
| <b>Setup:</b>
| |
| The routine <code>DifferenceQuotient("function","variable")</code> takes the simplified function and a variable name. If the variable is omitted, <code>dx</code> is used by default.
| |
| </p>
| |
| <p>
| |
| If the student enters an unsimplified answer such as
| |
| <code>((x+h)^2-x^2)/h</code>, their answer will not be marked correct and they will receive the message
| |
| <i>It looks like you didn't finish simplifying your answer</i>.
| |
| </p>
| |
| | |
| </td>
| |
| </tr>
| |
| | |
| <!-- Question text section -->
| |
| | |
| <tr valign="top">
| |
| <td style="background-color:#ffdddd;border:black 1px dashed;">
| |
| <pre>
| |
| 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;
| |
| </pre>
| |
| <td style="background-color:#ffcccc;padding:7px;">
| |
| <p>
| |
| <b>Main Text:</b>
| |
| The problem text section of the file is as we'd expect.
| |
| </p>
| |
| </td>
| |
| </tr>
| |
| | |
| <!-- Answer section -->
| |
| | |
| <tr valign="top">
| |
| <td style="background-color:#eeddff;border:black 1px dashed;">
| |
| <pre>
| |
| $showPartialCorrectAnswers = 1;
| |
| | |
| $showPartialCorrectAnswers = 1;
| |
| | |
| ANS( $limit->cmp() );
| |
| ANS( $fp->cmp() );
| |
| | |
| ENDDOCUMENT();
| |
| </pre>
| |
| <td style="background-color:#eeccff;padding:7px;">
| |
| <p>
| |
| <b>Answer Evaluation:</b>
| |
| As is the answer.
| |
| </p>
| |
| </td>
| |
| </tr>
| |
| </table>
| |
| | |
| <p style="text-align:center;">
| |
| [[IndexOfProblemTechniques|Problem Techniques Index]]
| |
| </p>
| |
| | |
| [[Category:Problem Techniques]]
| |
| | |
| | |
| <ul>
| |
| <li>POD documentation: [http://webwork.maa.org/doc/cvs/pg_CURRENT/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>
| |
| </ul>
| |