Volume of solids of revolution
Download file: Volume2.pg
DOCUMENT(); loadMacros( 'PGstandard.pl', 'PGML.pl', 'unionTables.pl', 'answerHints.pl', 'weightedGrader.pl', 'PGcourse.pl' ); install_weighted_grader();
Preamble
We load weightedGrader.pl
and install it. We load answerHints.pl
to give student feedback on particular incorrect answers. We load unionTables.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.
If the weighted grader is to be used, the command install_weighted_grader();
must be called.
Context()->variables->are(x => 'Real', dx => 'Real', y => 'Real', dy => 'Real'); $f = Compute('x'); $g = Compute('x^2'); $upper = Real('1'); $lower = Real('0'); $int = Compute('(pi x - pi x^2) dx'); $vol = Compute('pi'); @weights = (5, 5, 40, 50); # Display the answer blanks properly in different modes 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(); }
Setup
Notice that for the final answer (volume) we use ans_rule(width)
, while for the answer blanks that involve setting up the integral we use NAMED_ANS_RULE(name, width)
.
BEGIN_PGML 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. [$integral]* [@ MODES( TeX => '', HTML => << "END_HTML" ${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} END_HTML ) @]* END_PGML
Statement
This is the problem statement in PGML.#; which can provide full credit, we use 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
Notice that we use NAMED_WEIGHTED_ANS(name => $answer->cmp()->withPostFilter(), weight)
for the questions that have named answer blanks above. For the final answer, CREDIT_ANS( $answer->cmp(), ['name1', 'name2', ...], weight)
for this answer to provide credit for the answers with names in the list ['name1', 'name2', ...]
.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION COMMENT( 'Weights each answer blank separately, and the last answer provides full ' . 'credit for all other answer blanks.'); ENDDOCUMENT();
Solution
A solution should be provided here.