Skip to content

Commit c1d4874

Browse files
authored
Merge pull request #1276 from dlglin/fixUnionIBPProb
Update Union IBP problem to PGML, and improve randomization
2 parents b28e69f + e8e2e52 commit c1d4874

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

OpenProblemLibrary/Union/setIntByParts/sc5_6_01.pg

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,38 @@
1616
## MO(1)
1717
## KEYWORDS('calculus','integration','integration by parts')
1818

19-
DOCUMENT(); # This should be the first executable line in the problem.
19+
DOCUMENT(); # This should be the first executable line in the problem.
2020

21-
loadMacros(
22-
"PGstandard.pl",
23-
"PGunion.pl",
24-
"MathObjects.pl",
25-
"PGcourse.pl"
26-
);
21+
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');
2722

28-
TEXT(beginproblem());
29-
30-
###################################
3123
# Setup
3224

33-
$a = random(2,4,1);
34-
35-
$integrand=Formula(" x e^{$a x} ");
25+
$a = random(2, 9, 1);
26+
$integrand = Formula(" x e^{$a x} ");
3627

37-
###################################
38-
# Main text
28+
Context()->flags->set(reduceConstants => 0);
29+
$antideriv = Formula("1/$a (x e^(${a}x) - 1/$a e^(${a}x))");
3930

40-
Context()->texStrings;
41-
BEGIN_TEXT
31+
BEGIN_PGML
4232
Evaluate the indefinite integral.
43-
$PAR
44-
\( \displaystyle\int $integrand \, dx \)
45-
= \{ans_rule(50)\} \( + C\).
46-
END_TEXT
47-
Context()->normalStrings;
4833

49-
###################################
50-
# Answers
34+
[``\int [$integrand] \, dx ``]=
35+
[_]{$antideriv->cmp(upToConstant=>1)}{50} [` + C`].
36+
END_PGML
5137

52-
$showPartialCorrectAnswers = 1;
53-
Context()->flags->set(reduceConstants=>0);
38+
BEGIN_PGML_SOLUTION
39+
Calculate the integral using integration by parts.
5440

55-
$antideriv = Formula( "1/$a (x e^(${a}x) - 1/$a e^(${a}x))");
41+
Let [`u=x`] and [`dv=e^{[$a]x}dx`]
5642

57-
ANS($antideriv->cmp(upToConstant=>1));
43+
Then [`du=dx`] and [`v=\frac{1}{[$a]}e^{[$a]x}`].
5844

59-
###################################
45+
[``\int u\,dv=uv-\int v\,du``], so
6046

47+
[``\begin{eqnarray}\int xe^{[$a]x}\,dx & = & x\left(\frac{1}{[$a]}e^{[$a]x}\right)-\int \frac{1}{[$a]}e^{[$a]x}\,dx\\
48+
& = & \frac{1}{[$a]}\left(xe^{[$a]x}-\int e^[$a]x\,dx\right)+C\\
49+
& = & \frac{1}{[$a]}\left(xe^{[$a]x}-\frac{1}{[$a]} e^[$a]x\,dx\right)+C
50+
\end{eqnarray}``]
51+
END_PGML_SOLUTION
6152

62-
;
6353
ENDDOCUMENT();

0 commit comments

Comments
 (0)