## DESCRIPTION
## Integral calculus: volume of solids of revolution
## ENDDESCRIPTION

## KEYWORDS('Integrals', 'volume of solids of revolution')

## DBsubject('WeBWorK')
## DBchapter('WeBWorK Tutorial')
## DBsection('Fort Lewis Tutorial 2011')
## Date('10/20/2010')
## Author('Paul Pearson')
## Institution('Fort Lewis College')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')


###############################
#  Initialization

DOCUMENT();

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

TEXT(beginproblem());

install_problem_grader(~~&std_problem_grader);

$showPartialCorrectAnswers = 1;


################################
#  Setup
 
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"); 


#
#  Display the answer blanks properly in different modes
#
Context()->texStrings;
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();
}
Context()->normalStrings;


#####################################
#  Main text

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
Context()->normalStrings;


#####################################
#  Answer Evaluation


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() );


#####################################
#  Solution

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;


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

ENDDOCUMENT();