Volume of Solids of Revolution 3

Volume of solids of revolution

Complete Code

Download file: Volume3.pg

PG problem file

Explanation

DOCUMENT();

loadMacros(
    'PGstandard.pl',     'PGML.pl',
    'unionTables.pl',    'answerHints.pl',
    'weightedGrader.pl', 'PGcourse.pl'
);

Preamble

These standard macros need to be loaded.
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');

# Display the answer blanks properly in different modes
if ($displayMode eq 'TeX') {
    $integral =
        'Volume = \(\displaystyle'
        . '\int_{'
        . ans_rule(4) . '}^{'
        . ans_rule(4) . '}'
        . ans_rule(30) . ' = '
        . ans_rule(10) . '\)';
} else {
    $integral = BeginTable(center => 0)
        . Row(
            [
                'Volume = \(\displaystyle\int\)',
                ans_rule(4) . $BR . $BR . ans_rule(4),
                ans_rule(30) . $SPACE . ' = ' . $SPACE . ans_rule(10),
            ],
            separation => 2
        ) . EndTable();
}

Setup

This perl code sets up the problem.
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]*
END_PGML

Statement

This is the problem statement in PGML.
ANS($upper->cmp);
ANS($lower->cmp);
ANS($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?',
)));
ANS($vol->cmp);

Answer

This is used for answer checking.
BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

COMMENT('Gives full credit only if all answers are correct.');

ENDDOCUMENT();

Solution

A solution should be provided here.