Difference between revisions of "IndefiniteIntegrals1"

From WeBWorK_wiki
Jump to navigation Jump to search
(PGML example link)
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<h2>Indefinite Integrals and General Antiderivatives</h2>
 
<h2>Indefinite Integrals and General Antiderivatives</h2>
   
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;">
 
  +
[[File:IndefiniteIntegrals1.png|300px|thumb|right|Click to enlarge]]
  +
<p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;">
 
This PG code shows how to check answers that are indefinite integrals or general antiderivatives.
 
This PG code shows how to check answers that are indefinite integrals or general antiderivatives.
<ul>
 
<li>Download file: [[File:IndefiniteIntegrals1.txt]] (change the file extension from txt to pg when you save it)</li>
 
<li>File location in NPL: <code>NationalProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/IndefiniteIntegrals1.pg</code></li>
 
</ul>
 
 
</p>
 
</p>
  +
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/IndefiniteIntegrals1.pg FortLewis/Authoring/Templates/IntegralCalc/IndefiniteIntegrals1.pg]
  +
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/IndefiniteIntegrals1_PGML.pg FortLewis/Authoring/Templates/IntegralCalc/IndefiniteIntegrals1_PGML.pg]
   
  +
<br clear="all" />
 
<p style="text-align:center;">
 
<p style="text-align:center;">
 
[[SubjectAreaTemplates|Templates by Subject Area]]
 
[[SubjectAreaTemplates|Templates by Subject Area]]
Line 67: Line 67:
 
Context("Numeric");
 
Context("Numeric");
   
#
 
# Specific antiderivative:
 
# Marks correct e^x, e^x + pi, etc
 
#
 
 
$specific = Formula("e^x");
 
$specific = Formula("e^x");
   
#
 
# General antiderivative
 
# Marks correct
 
#
 
 
$general = FormulaUpToConstant("e^x");
 
$general = FormulaUpToConstant("e^x");
 
</pre>
 
</pre>
Line 83: Line 75:
 
<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.
 
  +
Examples of specific and general antiderivatives:
  +
<ul>
  +
<li>Specific antiderivatives: <code>e^x, e^x + pi</code></li>
  +
<li>General antiderivatives: <code>e^x + C, e^x + C - 3, e^x + K</code></li>
  +
</ul>
 
</p>
 
</p>
 
<p>
 
<p>
Line 142: Line 138:
 
Context()->texStrings;
 
Context()->texStrings;
 
BEGIN_SOLUTION
 
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
 
 
Solution explanation goes here.
 
Solution explanation goes here.
 
END_SOLUTION
 
END_SOLUTION
Line 165: Line 160:
   
 
[[Category:Top]]
 
[[Category:Top]]
[[Category:Authors]]
+
[[Category:Sample Problems]]
  +
[[Category:Subject Area Templates]]

Revision as of 13:49, 14 June 2015

Indefinite Integrals and General Antiderivatives

Click to enlarge

This PG code shows how to check answers that are indefinite integrals or general antiderivatives.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"AnswerFormatHelp.pl",
"parserFormulaUpToConstant.pl",
);

TEXT(beginproblem());

Initialization:

Context("Numeric");

$specific = Formula("e^x");

$general = FormulaUpToConstant("e^x");

Setup: Examples of specific and general antiderivatives:

  • Specific antiderivatives: e^x, e^x + pi
  • General antiderivatives: e^x + C, e^x + C - 3, e^x + K

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 FormulaUpToConstant() constructor provided by parserFormulaUpToConstant.pl.

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 upToConstant=>1, otherwise the only answer that will be marked correct will be e^x.

Context()->texStrings;
BEGIN_SOLUTION
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();

Solution:

Templates by Subject Area