/
Volume2.pg
144 lines (114 loc) · 3.27 KB
/
Volume2.pg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
## DESCRIPTION
## Integral calculus: volume of solids of revolution
## ENDDESCRIPTION
## DBsubject(WeBWorK)
## DBchapter(WeBWorK tutorial)
## DBsection(Fort Lewis tutorial 2011)
## Date(10/20/2010)
## Institution(Fort Lewis College)
## Author(Paul Pearson)
## MO(1)
## KEYWORDS('Integrals', 'volume of solids of revolution')
###############################
# Initialization
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGunion.pl",
"answerHints.pl",
"weightedGrader.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
install_weighted_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");
@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;
#####################################
# 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
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;
#####################################
# Answer Evaluation
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] );
#####################################
# Solution
Context()->texStrings;
BEGIN_SOLUTION
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;
COMMENT('Weights each answer blank separately,
and the last answer provides full credit for all other answer blanks.');
ENDDOCUMENT();