Difference between revisions of "LimitsOfIntegration1"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page with '<h2>Answer Blanks in the Limits of Integration</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black solid 1p…')
 
(add historical tag and give links to newer problems.)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  +
{{historical}}
  +
  +
<p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/IntegralCalc/LimitsOfIntegration.html a newer version of this problem]</p>
  +
  +
 
<h2>Answer Blanks in the Limits of Integration</h2>
 
<h2>Answer Blanks in the Limits of Integration</h2>
   
Line 5: Line 10:
 
This PG code shows how to put answer blanks into the limits of integration.
 
This PG code shows how to put answer blanks into the limits of integration.
 
</p>
 
</p>
* Download file: [[File:LimitsOfIntegration1.txt]] (change the file extension from txt to pg when you save it)
 
  +
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1.pg FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1.pg]
* File location in NPL: <code>FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1.pg</code>
 
  +
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1_PGML.pg FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1_PGML.pg]
   
 
<br clear="all" />
 
<br clear="all" />
 
<p style="text-align:center;">
 
<p style="text-align:center;">
 
[[SubjectAreaTemplates|Templates by Subject Area]]
 
[[SubjectAreaTemplates|Templates by Subject Area]]
  +
</p>
  +
  +
<p style="background-color:#ffffcc;padding:30px;border:black 1px dashed;">
  +
The approach given on this page has certain disadvantages in terms of the "reading order" of the content for screen reader users due to the manner in which visual formatting using tables is achieved.<br>
  +
<strong>Another, CSS based approach can be found in [https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4767]</strong> and allows keeping a more natural "reading" order to the content.
 
</p>
 
</p>
   
Line 55: Line 65:
 
<p>
 
<p>
 
<b>Initialization:</b>
 
<b>Initialization:</b>
  +
We must use <code>PGunion.pl</code> for table formatting commands we will use to put the answer blanks in the limits of integration. We use <code>answerHints.pl</code> to help guide students toward the correct answer.
 
</p>
 
</p>
 
</td>
 
</td>
Line 104: Line 115:
 
<p>
 
<p>
 
<b>Setup:</b>
 
<b>Setup:</b>
  +
The block of code that puts the answer blanks into the exponents correctly in HTML and TeX modes probably does not need to be modified.
 
</p>
 
</p>
 
</td>
 
</td>
Line 115: Line 127:
 
Context()->texStrings;
 
Context()->texStrings;
 
BEGIN_TEXT
 
BEGIN_TEXT
Question text
 
  +
Find a formula for the function \(f(x)\) such that
  +
\( \displaystyle f'(x)= $fpx \) and \( f(2)=5 \).
 
$BR
 
$BR
 
$BR
 
$BR
Answer =
 
  +
$integral
\{ ans_rule(20) \}
 
\{ AnswerFormatHelp("formulas") \}
 
 
END_TEXT
 
END_TEXT
 
Context()->normalStrings;
 
Context()->normalStrings;
Line 127: Line 138:
 
<p>
 
<p>
 
<b>Main Text:</b>
 
<b>Main Text:</b>
  +
To display the integral with answer blanks in the limits of integration properly, we insert it using <code>$integral</code>.
 
</p>
 
</p>
 
</td>
 
</td>
Line 138: Line 150:
 
$showPartialCorrectAnswers = 1;
 
$showPartialCorrectAnswers = 1;
   
ANS( $answer->cmp() );
+
ANS( Compute("5")->cmp() );
  +
ANS( Compute("x")->cmp() );
  +
ANS( Compute("2")->cmp() );
  +
ANS( Compute("$fpt * dt")->cmp()
  +
->withPostFilter(AnswerHints(
  +
Formula("$fpx") => "Are you using the correct variable?",
  +
Formula("$fpx*dx") => "Are you using the correct variable?",
  +
Formula("$fpt") => "Don't forget the differential dt",
  +
))
  +
);
 
</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>
  +
We use <code>AnswerHints</code> to guide the students to the correct answer.
 
</p>
 
</p>
 
</td>
 
</td>
Line 154: Line 167:
 
Context()->texStrings;
 
Context()->texStrings;
 
BEGIN_SOLUTION
 
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
 
 
Solution explanation goes here.
 
Solution explanation goes here.
 
END_SOLUTION
 
END_SOLUTION
 
Context()->normalStrings;
 
Context()->normalStrings;
   
COMMENT('MathObject version.');
 
  +
  +
COMMENT('MathObject version');
   
 
ENDDOCUMENT();
 
ENDDOCUMENT();
Line 177: Line 190:
   
 
[[Category:Top]]
 
[[Category:Top]]
[[Category:Authors]]
+
[[Category:Sample Problems]]
  +
[[Category:Subject Area Templates]]

Latest revision as of 06:15, 18 July 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This problem has been replaced with a newer version of this problem


Answer Blanks in the Limits of Integration

Click to enlarge

This PG code shows how to put answer blanks into the limits of integration.


Templates by Subject Area

The approach given on this page has certain disadvantages in terms of the "reading order" of the content for screen reader users due to the manner in which visual formatting using tables is achieved.
Another, CSS based approach can be found in [1] and allows keeping a more natural "reading" order to the content.

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGunion.pl",
"answerHints.pl",
);

TEXT(beginproblem());

Initialization: We must use PGunion.pl for table formatting commands we will use to put the answer blanks in the limits of integration. We use answerHints.pl to help guide students toward the correct answer.

Context("Numeric");
Context()->variables->are(
x=>"Real", dx=>"Real",
t=>"Real", dt=>"Real"
);

$fpx = Formula("sin(x)"); 
$fpt = Formula("sin(t)");   

#
#  Display the answer blanks properly in different modes
#
Context()->texStrings;
if ($displayMode eq 'TeX') {
   $integral =
   '\(\displaystyle f(x) = '.
   ans_rule(4). 
   '+ \int_{t = '. 
   ans_rule(4). 
   '}^{t = '. 
   ans_rule(4).
   '}'. 
   ans_rule(20).
   '\)';
  } else {
   $integral =
   BeginTable(center=>0).
     Row([
       '\(f(x)=\)'.$SPACE.ans_rule(4).$SPACE.'\(+\displaystyle\int\)',
       '\( t = \)'.ans_rule(4).$BR.$BR.'\( t = \)'.ans_rule(4),
       ans_rule(20)],separation=>2).
   EndTable();
}
Context()->normalStrings;

Setup: The block of code that puts the answer blanks into the exponents correctly in HTML and TeX modes probably does not need to be modified.

Context()->texStrings;
BEGIN_TEXT
Find a formula for the function \(f(x)\) such that 
\( \displaystyle f'(x)= $fpx \) and \( f(2)=5 \).
$BR
$BR
$integral
END_TEXT
Context()->normalStrings;

Main Text: To display the integral with answer blanks in the limits of integration properly, we insert it using $integral.

$showPartialCorrectAnswers = 1;

ANS( Compute("5")->cmp() );
ANS( Compute("x")->cmp() );
ANS( Compute("2")->cmp() );
ANS( Compute("$fpt * dt")->cmp()
->withPostFilter(AnswerHints( 
  Formula("$fpx") => "Are you using the correct variable?",
  Formula("$fpx*dx") => "Are you using the correct variable?",
  Formula("$fpt") => "Don't forget the differential dt", 
))
);

Answer Evaluation: We use AnswerHints to guide the students to the correct answer.

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


COMMENT('MathObject version');

ENDDOCUMENT();

Solution:

Templates by Subject Area