Difference between revisions of "Volume1"

From WeBWorK_wiki
Jump to navigation Jump to search
m
(add historical tag and give links to newer problems.)
 
(2 intermediate revisions by one other user 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/VolumeOfRevolution.html a newer version of this problem]</p>
  +
  +
 
<h2>A Question with Weighted Answer Blanks</h2>
 
<h2>A Question with Weighted Answer Blanks</h2>
   
Line 5: Line 10:
 
This PG code shows how to ask students to set up and evaluate an integral for calculating the volume of a solid of revolution. Each answer blank is weighted.
 
This PG code shows how to ask students to set up and evaluate an integral for calculating the volume of a solid of revolution. Each answer blank is weighted.
 
</p>
 
</p>
* Download file: [[File:Volume1.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/Volume1.pg FortLewis/Authoring/Templates/IntegralCalc/Volume1.pg]
* File location in NPL: <code>FortLewis/Authoring/Templates/IntegralCalc/Volume1.pg</code>
+
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/IntegralCalc/Volume1_PGML.pg FortLewis/Authoring/Templates/IntegralCalc/Volume1_PGML.pg]
   
 
<br clear="all" />
 
<br clear="all" />
Line 194: Line 199:
 
Context()->texStrings;
 
Context()->texStrings;
 
BEGIN_SOLUTION
 
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
 
 
Solution explanation goes here.
 
Solution explanation goes here.
 
END_SOLUTION
 
END_SOLUTION

Latest revision as of 05:16, 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


A Question with Weighted Answer Blanks

Click to enlarge

This PG code shows how to ask students to set up and evaluate an integral for calculating the volume of a solid of revolution. Each answer blank is weighted.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

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

TEXT(beginproblem());

install_weighted_grader();

$showPartialCorrectAnswers = 1;

Initialization: We load weightedGrader.pl and install it. We load answerHints.pl to give student feedback on particular incorrect answers. We load PGunion.pl so that we can construct tables in HTML mode that will make the answer blanks for the limits of integration appear at the top and bottom of the integral symbol.

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). ' = '.
     NAMED_ANS_RULE("volume",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.
       NAMED_ANS_RULE("volume",10),
     ],separation=>2).
   EndTable();
}
Context()->normalStrings;

Setup: To keep the code that needs to be modified compartmentalized, we define the functions involved, the limits of integration, the integrand, the volume, and an array of weights (which sum to 100) for each of these answers.

The code for correctly displaying the answer blanks creates $integral which will be displayed correctly both in TeX and HTML modes. Notice that it uses NAMED_ANS_RULE(name,width) for all of the answer blanks instead of ans_rule(width).

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.
${EITALIC}"));
Context()->normalStrings;

Main Text: We use the mode-specific $integral to display the integral and answer blanks correctly. In TEXT() we specify for the students how the answer will be graded (weightedGrader.pl does not do this automatically, as some other graders do.)

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]
);
NAMED_WEIGHTED_ANS( "volume" => $vol->cmp(), $weights[3] );

Answer Evaluation: The answer evaluator we use is NAMED_WEIGHTED_ANS( name => $answer->cmp()->withPostFilter(), weight) instead of using ANS( $answer->cmp()->withPostFilter() ). Providing customized answer hints for students is a very good idea, because the whole point of this homework exercise it to learn how to set up this integral using proper notation. If we just wanted to ask for the volume, we could have done it using only one answer blank.

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


COMMENT('MathObject version.  Weights each answer blank separately.');

ENDDOCUMENT();

Solution: We include a comment to the instructor to let them know how the question is being graded.

Templates by Subject Area