Difference between revisions of "LimitsOfIntegration1"
Jump to navigation
Jump to search
Paultpearson (talk | contribs) m |
Paultpearson (talk | contribs) |
||
Line 5: | Line 5: | ||
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> |
||
<br clear="all" /> |
<br clear="all" /> |
||
Line 166: | Line 165: | ||
Context()->texStrings; |
Context()->texStrings; |
||
BEGIN_SOLUTION |
BEGIN_SOLUTION |
||
− | ${PAR}SOLUTION:${PAR} |
||
Solution explanation goes here. |
Solution explanation goes here. |
||
END_SOLUTION |
END_SOLUTION |
Revision as of 16:01, 16 June 2013
Answer Blanks in the Limits of Integration
This PG code shows how to put answer blanks into the limits of integration.
- File location in OPL: FortLewis/Authoring/Templates/IntegralCalc/LimitsOfIntegration1.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGunion.pl", "answerHints.pl", ); TEXT(beginproblem()); |
Initialization:
We must use |
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 |
$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 |
Context()->texStrings; BEGIN_SOLUTION Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version'); ENDDOCUMENT(); |
Solution: |