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…')
 
Line 115: Line 115:
 
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 138: Line 137:
 
$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;">
Line 159: Line 158:
 
Context()->normalStrings;
 
Context()->normalStrings;
   
COMMENT('MathObject version.');
 
  +
  +
COMMENT('MathObject version');
   
 
ENDDOCUMENT();
 
ENDDOCUMENT();

Revision as of 17:28, 3 December 2010

Answer Blanks in the Limits of Integration

Click to enlarge

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

  • Download file: File:LimitsOfIntegration1.txt (change the file extension from txt to pg when you save it)
  • File location in NPL: FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1.pg


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

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

TEXT(beginproblem());

Initialization:

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:

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:

$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:

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;


COMMENT('MathObject version');

ENDDOCUMENT();

Solution:

Templates by Subject Area