Difference between revisions of "Volume2"
(Created page with '<h2>A Question with Weighted Answer Blanks and a Credit Answer</h2> 300pxthumbrightClick to enlarge <p style="backgroundcolor:#f9f9f9;border:black solid…') 
Paultpearson (talk  contribs) (PGML example link) 

(2 intermediate revisions by the same user not shown)  
Line 5:  Line 5:  
This PG code shows how to construct a volume of solids of revolution question that allows students to set up the integral and earn partial credit, or to answer just the final question for full credit. 
This PG code shows how to construct a volume of solids of revolution question that allows students to set up the integral and earn partial credit, or to answer just the final question for full credit. 

</p> 
</p> 

−  * Download file: [[File:Volume2.txt]] (change the file extension from txt to pg when you save it) 

+  * File location in OPL: [https://github.com/openwebwork/webworkopenproblemlibrary/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/Volume2.pg FortLewis/Authoring/Templates/IntegralCalc/Volume2.pg] 

−  * 
+  * PGML location in OPL: [https://github.com/openwebwork/webworkopenproblemlibrary/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/Volume2_PGML.pg FortLewis/Authoring/Templates/IntegralCalc/Volume2_PGML.pg] 
<br clear="all" /> 
<br clear="all" /> 

Line 193:  Line 193:  
Context()>texStrings; 
Context()>texStrings; 

BEGIN_SOLUTION 
BEGIN_SOLUTION 

−  ${PAR}SOLUTION:${PAR} 

Solution explanation goes here. 
Solution explanation goes here. 

END_SOLUTION 
END_SOLUTION 

Line 218:  Line 217:  
[[Category:Top]] 
[[Category:Top]] 

−  [[Category: 
+  [[Category:Sample Problems]] 
+  [[Category:Subject Area Templates]] 
Latest revision as of 21:47, 13 June 2015
A Question with Weighted Answer Blanks and a Credit Answer
This PG code shows how to construct a volume of solids of revolution question that allows students to set up the integral and earn partial credit, or to answer just the final question for full credit.
 File location in OPL: FortLewis/Authoring/Templates/IntegralCalc/Volume2.pg
 PGML location in OPL: FortLewis/Authoring/Templates/IntegralCalc/Volume2_PGML.pg
PG problem file  Explanation 

Problem tagging: 

DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGunion.pl", "answerHints.pl", "weightedGrader.pl", ); TEXT(beginproblem()); install_weighted_grader(); $showPartialCorrectAnswers = 1; 
Initialization:
We load 
Context("Numeric"); Context()>variables>are( x=>"Real", dx=>"Real", y=>"Real", dy=>"Real" ); $f = Compute("x"); $g = Compute("x^2"); $upper = Real("1"); $lower = Real("0"); # answers below are intentionally wrong $int = Compute("( pi x  pi x^2 ) dx"); $vol = Compute("pi"); @weights = (5,5,40,50); # # Display the answer blanks properly in different modes # Context()>texStrings; if ($displayMode eq 'TeX') { $integral = 'Volume = \(\displaystyle' . '\int_{'. NAMED_ANS_RULE("lowerlimit",4). '}^{'. NAMED_ANS_RULE("upperlimit",4). '}'. NAMED_ANS_RULE("integrand",30). ' = '. ans_rule(10). '\)'; } else { $integral = BeginTable(center=>0). Row([ 'Volume = \(\displaystyle\int\)', NAMED_ANS_RULE("upperlimit",4).$BR.$BR. NAMED_ANS_RULE("lowerlimit",4), NAMED_ANS_RULE("integrand",30).$SPACE.' = '.$SPACE. ans_rule(10), ],separation=>2). EndTable(); } Context()>normalStrings; 
Setup:
Notice that for the final answer (volume) we use 
Context()>texStrings; BEGIN_TEXT Set up and evaluate an integral for the volume of the solid of revolution obtained by rotating the region bounded by \( y = $f \) and \( y = $g \) about the \(x\)axis. $BR $BR $integral END_TEXT TEXT(MODES(TeX=>"",HTML=> "${PAR}${BITALIC}${BBOLD}Note:${EBOLD} You can earn $weights[0]${PERCENT} for the upper limit of integration, $weights[1]${PERCENT} for the lower limit of integration, $weights[2]${PERCENT} for the integrand, and $weights[3]${PERCENT} for the finding the volume. If you find the correct volume, you will get full credit no matter what your other answers are. ${EITALIC}")); Context()>normalStrings; 
Main Text: In HTML mode, we add an explanation of how the question will be graded, pointing out that full credit can be earned if the volume calculation is correct. 
NAMED_WEIGHTED_ANS( "upperlimit" => $upper>cmp(), $weights[0] ); NAMED_WEIGHTED_ANS( "lowerlimit" => $lower>cmp(), $weights[1] ); NAMED_WEIGHTED_ANS( "integrand" => $int>cmp() >withPostFilter(AnswerHints( Formula("pi x  pi x^2 dx") => "Don't forget to multiply every term in the integrand by dx", Formula("pi x  pi x^2") => "Don't forget the differential dx", Formula("(pi x^2  pi x)*dx") => "Is the parabola above the line?", Formula("pi x^2  pi x") => "Is the parabola above the line?", )), $weights[2] ); CREDIT_ANS( $vol>cmp(), ["upperlimit","lowerlimit","integrand"], $weights[3] ); 
Answer Evaluation:
Notice that we use 
Context()>texStrings; BEGIN_SOLUTION Solution explanation goes here. END_SOLUTION Context()>normalStrings; COMMENT('MathObject version. Weights each answer blank separately, and the last answer provides full credit for all other answer blanks.'); ENDDOCUMENT(); 
Solution: 