Skip to content

Commit fbb87c2

Browse files
authored
Merge pull request #1020 from gajennings/bugfix
Bugfix
2 parents 168a71f + 484197c commit fbb87c2

File tree

5 files changed

+41
-171
lines changed

5 files changed

+41
-171
lines changed

OpenProblemLibrary/WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/7_Techniques_of_Integration/7.3_Trigonometric_Substitution/7.3.18.pg

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Context();
2626

2727
TEXT(beginproblem());
2828

29+
Context("Numeric");
30+
2931
$a = Real(random(2, 6, 1));
3032
$b = Real(random(2, 6, 1));
3133
$a2 = $a**2;
@@ -42,7 +44,7 @@ BEGIN_TEXT
4244
$PAR
4345
Evaluate the integral \( \int \sqrt{$ab2 + $b2 x^2} \, dx \) using trigonometric substitution.
4446
$PAR
45-
\{ans_box( 3,60)\}
47+
\{ans_rule( 60)\}
4648
$PAR
4749
Note: Use C for an arbitrary constant, and be sure to absorb as much into C as is possible.
4850
$PAR
@@ -51,38 +53,9 @@ Context()->normalStrings;
5153

5254
ANS($ans->cmp);
5355

54-
sub put_pic{
55-
56-
my $s='\[
57-
\setlength{\unitlength}{1in}
58-
\begin{picture}(0,0)(1,1)
59-
\begin{math}
60-
\put(-.2,.5){x}
61-
\put(.6,.5){\(\sqrt{$a2+x^2}\)}
62-
\put(0,0){\line(1,0){1}}
63-
\put(0,0){\line(0,1){1}}
64-
\put(0,1){\line(1,-1){1}}
65-
\qbezier(0.8, 0)(0.6, 0.1)
66-
(0.9, 0.13)
67-
\put(.6,0.02){t}
68-
\put(0.3,-0.1){\($a\)}
69-
\end{math}
70-
\end{picture}
71-
\vspace{1in}
72-
\]';
73-
if ($displayMode eq "TeX") {
74-
return $s }
75-
76-
}
77-
78-
79-
8056

8157
Context()->texStrings;
82-
SOLUTION(EV3(<<'END_SOLUTION'));
83-
$PAR
84-
$SOL
85-
$PAR
58+
BEGIN_SOLUTION
8659
First simplify the integral:
8760
\[
8861
\begin{array}{ll}
@@ -107,17 +80,9 @@ I & = $b \int \sqrt{$a \sec^2 t}\left(\sqrt{$a} \sec^2 t \, dt\right) \cr
10780

10881
Since \( x = \sqrt{$a} \tan t \), we construct a right triangle with \( \tan t = \frac{x}{\sqrt{$a}} \).
10982
$PAR
110-
\{put_pic\}
111-
END_SOLUTION
112-
Context()->normalStrings;
113-
if ($displayMode ne "TeX") {
114-
SOLUTION(EV3(image("figtan.png", width=>160, height=>118)));
115-
SOLUTION(EV3('$BR Here a=$sa. $BR'));
116-
}
117-
Context()->texStrings;
118-
SOLUTION(EV3(<<'EEND_SOLUTION'));
83+
\{image("figtan.png", width=>160, height=>118)\} $SPACE a=\(\sqrt{$a}\) in this triangle.
11984
$PAR
120-
From that triangle, the Pythagorean theorem,
85+
From this triangle, the Pythagorean theorem,
12186
and the definition of secant with respect to right triangles,
12287
we see that \( \sec t = \frac{\sqrt{x^2 + $a}}{\sqrt{$a}} \), so we have
12388
\[
@@ -128,6 +93,6 @@ we see that \( \sec t = \frac{\sqrt{x^2 + $a}}{\sqrt{$a}} \), so we have
12893
& = $ans
12994
\end{array}
13095
\]
131-
EEND_SOLUTION
96+
END_SOLUTION
13297

13398
ENDDOCUMENT();

OpenProblemLibrary/WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/7_Techniques_of_Integration/7.3_Trigonometric_Substitution/7.3.22.pg

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,12 @@
1616
DOCUMENT();
1717
loadMacros(
1818
"PGstandard.pl",
19+
"MathObjects.pl",
1920
"parserFormulaUpToConstant.pl",
20-
"PGchoicemacros.pl",
21-
"Parser.pl",
2221
"freemanMacros.pl",
2322
"PGcourse.pl"
2423
);
25-
$context = Context();
26-
27-
#$context->variables->add(C=>'Real');
28-
29-
#($a, $b, $ans) = @{ list_random([],
30-
# []
31-
#) };
24+
Context("Numeric");
3225

3326
TEXT(beginproblem());
3427

@@ -39,43 +32,19 @@ $a4 = $a**4;
3932
$a5 = $a**5;
4033

4134

42-
$ans = FormulaUpToConstant("-($a2/3) * (sqrt($a2 - x**2))**3 + (1/5) * (sqrt($a2 - x**2))**5 + C")->reduce();
35+
$ans = FormulaUpToConstant("-($a2/3) * (sqrt($a2 - x**2))**3 + (1/5) * (sqrt($a2 - x**2))**5 + C");
4336

4437
Context()->texStrings;
4538
BEGIN_TEXT
4639
\{ textbook_ref_exact("Rogawski ET 2e", "7.3","22") \}
4740
$PAR
4841
Evaluate the integral \( \int x^3 \sqrt{$a2 - x^2} \, dx \) using trigonometric substitution.
4942
$PAR
50-
\{ans_box( 3,60)\}
43+
\{ans_rule(60)\}
5144
END_TEXT
5245
Context()->normalStrings;
5346

54-
ANS($ans->cmp());
55-
56-
sub put_pic{
57-
my $t='$BR \{image("figsin$a.png", width=>160, height=>118)\} $BR';
58-
my $s='\[
59-
\setlength{\unitlength}{1in}
60-
\begin{picture}(0,0)(1,1)
61-
\begin{math}
62-
\put(-.2,.5){x}
63-
\put(.2,-.2){\(\sqrt{$a2-x^2}\)}
64-
\put(.6,.5){$a}
65-
\put(0,0){\line(1,0){1}}
66-
\put(0,0){\line(0,1){1}}
67-
\put(0,1){\line(1,-1){1}}
68-
\qbezier(0.8, 0)(0.6, 0.1)
69-
(0.9, 0.13)
70-
\put(.6,0.02){t}
71-
\end{math}
72-
\end{picture}
73-
\vspace{1.5in}
74-
\]';
75-
if ($displayMode eq "TeX") {
76-
return $s }
77-
else {return $t }
78-
}
47+
ANS($ans->cmp(limits->[-$a+.01,$a-.01]));
7948

8049

8150
Context()->texStrings;
@@ -104,11 +73,11 @@ Now use substitution, with \( u = \cos t \) and \( du = - \sin t \, dt \) for bo
10473
$PAR
10574
\( I = $a5 \left[ -\frac{1}{3}\cos^3 t + \frac{1}{5} \cos^5 t \right] + C \).
10675
$PAR
107-
Since \( x = $a \sin t \), we construct a right triangle with \( \sin t = \frac{x}{$a} \).
76+
Since \( x = $a \sin t \), we construct a right triangle with \( \sin t = \frac{x}{$a} \).
10877
$BR
109-
\{put_pic\}
78+
\{image("figsin.png", width=>160, height=>118)\}$SPACE a=$a in this triangle.
11079
$PAR
111-
From that triangle, the Pythagorean theorem, and the definition of cosine with respect to right triangles, we see that \( \cos t = \frac{\sqrt{$a2 - x^2}}{$a} \), so we have
80+
From this triangle, the Pythagorean theorem, and the definition of cosine with respect to right triangles, we see that \( \cos t = \frac{\sqrt{$a2 - x^2}}{$a} \), so we have
11281
\[
11382
\begin{array}{ll}
11483
I & = $a5 \left[ -\frac{1}{3}{\left(\frac{\sqrt{$a2 - x^2}}{$a}\right)}^3 + \frac{1}{5}{\left(\frac{\sqrt{$a2 - x^2}}{$a}\right)}^5 \right] + C \cr

OpenProblemLibrary/WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/7_Techniques_of_Integration/7.3_Trigonometric_Substitution/7.3.39.pg

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
DOCUMENT();
1717
loadMacros(
1818
"PGstandard.pl",
19-
"PGchoicemacros.pl",
20-
"Parser.pl",
19+
"MathObjects.pl",
20+
"parserFormulaUpToConstant.pl",
2121
"freemanMacros.pl",
2222
"PGcourse.pl"
2323
);
24-
$context = Context();
2524

26-
$context->variables->add(C=>'Real');
25+
Context("Numeric");
2726

2827
TEXT(beginproblem());
2928

@@ -36,52 +35,24 @@ $ad = $a*$d;
3635
$dd = $d*$d;
3736
$add = $a * $dd;
3837

39-
$ans = Formula("(1/sqrt($a)) * ln(abs(x + $d + sqrt(x**2 + $c x))) + C")->reduce();
38+
$ans = FormulaUpToConstant("(1/sqrt($a)) * ln(abs(x + $d + sqrt(x**2 + $c x))) + C")->reduce();
4039

4140
Context()->texStrings;
4241
BEGIN_TEXT
4342
\{ textbook_ref_exact("Rogawski ET 2e", "7.3","39") \}
4443
$PAR
4544
Evaluate the integral \( \int \frac{dx}{\sqrt{$ac x + $a x^2}} \) by completing the square and using trigonometric substitution.
4645
$PAR
47-
\{ans_box( 3,60)\}
46+
\{ans_rule(60)\}
4847
$PAR
4948
Note: Use C for an arbitrary constant.
5049
END_TEXT
5150
Context()->normalStrings;
5251

53-
54-
# ANS($ans->cmp);
55-
ANS(fun_cmp($ans,mode=>"antider",vars=>["x","C"],domain=>[2,5]));
56-
sub put_pic{
57-
my $t='$BR \{image("figsin$a.png", width=>160, height=>118)\} $BR';
58-
my $s='\[
59-
\setlength{\unitlength}{1in}
60-
\begin{picture}(-1,0)(1,1)
61-
\begin{math}
62-
\put(-.7,.5){\(\sqrt{u^2-$dd}\)}
63-
\put(.2,-.1){$d}
64-
\put(.6,.5){u}
65-
\put(0,0){\line(1,0){1}}
66-
\put(0,0){\line(0,1){1}}
67-
\put(0,1){\line(1,-1){1}}
68-
\qbezier(0.8, 0)(0.6, 0.1)
69-
(0.9, 0.13)
70-
\put(.6,0.02){t}
71-
\end{math}
72-
\end{picture}
73-
\vspace{1.5in}
74-
\]';
75-
if ($displayMode eq "TeX") {
76-
return $s }
77-
78-
}
79-
52+
ANS($ans->cmp(limits->[.2,5]));
8053

8154
Context()->texStrings;
82-
SOLUTION(EV3(<<'END_SOLUTION'));
83-
$PAR
84-
$SOL
55+
BEGIN_SOLUTION
8556
$PAR
8657
First complete the square:
8758
$PAR
@@ -110,17 +81,9 @@ Thus,
11081

11182
Since \( u = $d \sec t \), we construct a right triangle with \( \sec t = \frac{u}{$d} \).
11283
$PAR
113-
\{put_pic\}
114-
END_SOLUTION
115-
Context()->normalStrings;
116-
if ($displayMode ne "TeX") {
117-
SOLUTION(EV3(image("figsec.png", width=>160, height=>118)));
118-
SOLUTION(EV3('$BR Here a=$d $BR'));
119-
}
120-
Context()->texStrings;
121-
SOLUTION(EV3(<<'EEND_SOLUTION'));
84+
\{image("figsec.png", width=>160, height=>118)\} $SPACE a=$d in this triangle.
12285
$PAR
123-
From that triangle, the Pythagorean theorem, and the definition of
86+
From this triangle, the Pythagorean theorem, and the definition of
12487
secant with respect to right triangles, we see that \( \tan t = \frac{\sqrt{ u^2 - $dd}}{$d} \), so we have
12588
\[
12689
\begin{array}{ll}
@@ -130,7 +93,7 @@ secant with respect to right triangles, we see that \( \tan t = \frac{\sqrt{ u^2
13093
\end{array}
13194
\]
13295
because \(\sqrt{$ac x + $a x^2} = \sqrt{$a}\sqrt{u^2-$dd}\).
133-
EEND_SOLUTION
96+
END_SOLUTION
13497

13598
ENDDOCUMENT();
13699

OpenProblemLibrary/WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/7_Techniques_of_Integration/7.3_Trigonometric_Substitution/7.3.5.pg

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,35 @@
1616
DOCUMENT();
1717
loadMacros(
1818
"PGstandard.pl",
19-
"PGchoicemacros.pl",
20-
"Parser.pl",
19+
"MathObjects.pl",
20+
"parserFormulaUpToConstant.pl",
2121
"freemanMacros.pl",
2222
"PGcourse.pl"
2323
);
24-
$context = Context();
25-
26-
$context->variables->add(C=>'Real');
27-
28-
#($a, $b, $ans) = @{ list_random([],
29-
# []
30-
#) };
24+
Context("Numeric");
25+
#Context()->variables->add(C=>'Real');
3126

3227
TEXT(beginproblem());
3328

3429
$a = Real(random(3, 9, 1));
3530
$b=$a*$a;
3631

37-
$ans = Formula("($b / 2) * arcsin(x/$a) + ( x * sqrt($b - x**2))/2 + C");
32+
$ans = FormulaUpToConstant("($b / 2) * arcsin(x/$a) + ( x * sqrt($b - x**2))/2 ");
3833

3934
Context()->texStrings;
4035
BEGIN_TEXT
4136
\{ textbook_ref_exact("Rogawski ET 2e", "7.3","5") \}
4237
$PAR
4338
Use the substitution \( x = $a \sin t \) to evaluate the integral \( \int \sqrt{\{$a**2\} - x^2} \, dx \).
4439
$PAR
45-
\{ans_box( 3,60)\}
40+
\{ans_rule(60)\}
4641
$PAR
4742
Note: Use C for an arbitrary constant.
4843
$PAR
4944
END_TEXT
5045
Context()->normalStrings;
5146

52-
ANS($ans->cmp);
47+
ANS($ans->cmp(limits->[-$a+.01,$a-.01]));
5348

5449
sub put_pic{
5550
my $t='$BR \{image("figsin$a.png", width=>160, height=>118)\} $BR';
@@ -76,9 +71,7 @@ sub put_pic{
7671
}
7772

7873
Context()->texStrings;
79-
SOLUTION(EV3(<<'END_SOLUTION'));
80-
$PAR
81-
$SOL
74+
BEGIN_SOLUTION
8275
$PAR
8376
Let \( x = $a \sin t \). Then \( dx = $a \cos t \, dt \), and
8477
$PAR
@@ -96,17 +89,9 @@ I & = \int \sqrt{$b - x^2} \, dx \cr
9689

9790
Since \( x = $a \sin t \), we construct a right triangle with \( \sin t = \frac{x}{$a} \).
9891
$BR
99-
\{put_pic\}
100-
END_SOLUTION
101-
Context()->normalStrings;
102-
if ($displayMode ne "TeX") {
103-
SOLUTION(EV3(image("figsin.png", width=>160, height=>118)));
104-
SOLUTION(EV3('$BR Here a=$a $BR'));
105-
}
106-
Context()->texStrings;
107-
SOLUTION(EV3(<<'EEND_SOLUTION'));
92+
\{image("figsin.png", width=>160, height=>118)\} $SPACE a=$a in this triangle.
10893
$PAR
109-
From that triangle, the Pythagorean theorem, and the definition of cosine with respect to right triangles, we see that \( \cos t = \frac{1}{$a} \sqrt{$b - x^2} \), so we have
94+
From this triangle, the Pythagorean theorem, and the definition of cosine with respect to right triangles, we see that \( \cos t = \frac{1}{$a} \sqrt{$b - x^2} \), so we have
11095
$PAR
11196
\[
11297
\begin{array}{ll}
@@ -115,8 +100,7 @@ $PAR
115100
& = $ans .
116101
\end{array}
117102
\]
118-
119-
EEND_SOLUTION
103+
END_SOLUTION
120104

121105
ENDDOCUMENT();
122106

0 commit comments

Comments
 (0)