IndefiniteIntegrals1: Difference between revisions
(Created page with '<h2>Indefinite Integrals and General Antiderivatives</h2> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> This PG code shows how to check answers that a…') |
No edit summary |
||
Line 71: | Line 71: | ||
# Marks correct e^x, e^x + pi, etc | # Marks correct e^x, e^x + pi, etc | ||
# | # | ||
$specific = Formula("e^x" | $specific = Formula("e^x"); | ||
# | # | ||
# General antiderivative | # General antiderivative | ||
# Marks correct | # Marks correct | ||
# | # | ||
$general = FormulaUpToConstant("e^x"); | $general = FormulaUpToConstant("e^x"); | ||
Line 82: | Line 82: | ||
<td style="background-color:#ffffcc;padding:7px;"> | <td style="background-color:#ffffcc;padding:7px;"> | ||
<p> | <p> | ||
<b>Setup:</b> | <b>Setup:</b> | ||
The specific antiderivative should mark correct answers such as <code>e^x, e^x + pi</code>, etc. The general antiderivative should mark correct answers such as <code>e^x + C, e^x + C - 3, e^x + K</code>, etc. | |||
</p> | |||
<p> | |||
The specific antiderivative is an ordinary formula, and we check this answer, we will specify that it be a formula evaluated up to a constant (see the Answer Evaluation section below). For the general antiderivative, we use the <code>FormulaUpToConstant()</code> constructor provided by <code>parserFormulaUpToConstant.pl</code>. | |||
</p> | </p> | ||
</td> | </td> | ||
Line 119: | Line 123: | ||
$showPartialCorrectAnswers = 1; | $showPartialCorrectAnswers = 1; | ||
ANS( $specific->cmp() ); | ANS( $specific->cmp(upToConstant=>1) ); | ||
ANS( $general ->cmp() ); | |||
ANS( $general->cmp() ); | |||
</pre> | </pre> | ||
<td style="background-color:#eeccff;padding:7px;"> | <td style="background-color:#eeccff;padding:7px;"> | ||
<p> | <p> | ||
<b>Answer Evaluation:</b> | <b>Answer Evaluation:</b> | ||
For the specific antiderivative, we must use <code>upToConstant=>1</code>, otherwise the only answer that will be marked correct will be <code>e^x</code>. | |||
</p> | </p> | ||
</td> | </td> |
Revision as of 03:17, 2 December 2010
Indefinite Integrals and General Antiderivatives
This PG code shows how to check answers that are indefinite integrals or general antiderivatives.
- Download file: File:IndefiniteIntegrals1.txt (change the file extension from txt to pg when you save it)
- File location in NPL:
NationalProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/IndefiniteIntegrals1.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "AnswerFormatHelp.pl", "parserFormulaUpToConstant.pl", ); TEXT(beginproblem()); |
Initialization: |
Context("Numeric"); # # Specific antiderivative: # Marks correct e^x, e^x + pi, etc # $specific = Formula("e^x"); # # General antiderivative # Marks correct # $general = FormulaUpToConstant("e^x"); |
Setup:
The specific antiderivative should mark correct answers such as
The specific antiderivative is an ordinary formula, and we check this answer, we will specify that it be a formula evaluated up to a constant (see the Answer Evaluation section below). For the general antiderivative, we use the |
Context()->texStrings; BEGIN_TEXT Enter a specific antiderivative for \( e^x \): \{ ans_rule(20) \} \{ AnswerFormatHelp("formulas") \} $BR $BR Enter the most general antiderivative for \( e^x \): \{ ans_rule(20) \} \{ AnswerFormatHelp("formulas") \} END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers = 1; ANS( $specific->cmp(upToConstant=>1) ); ANS( $general->cmp() ); |
Answer Evaluation:
For the specific antiderivative, we must use |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |