Skip to content

Commit 362ee61

Browse files
authored
Merge pull request #1152 from gajennings/main
Fix bug 4825, simplify the code
2 parents 701bef3 + 82684ff commit 362ee61

File tree

1 file changed

+41
-72
lines changed
  • OpenProblemLibrary/AlfredUniv/anton8e/chapter10/review

1 file changed

+41
-72
lines changed

OpenProblemLibrary/AlfredUniv/anton8e/chapter10/review/prob2.pg

Lines changed: 41 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -32,83 +32,52 @@ DOCUMENT();
3232
loadMacros(
3333
"PGstandard.pl",
3434
"MathObjects.pl",
35-
"PGgraphmacros.pl",
36-
"PGchoicemacros.pl",
35+
"PGML.pl",
36+
"parserCheckboxList.pl",
37+
"parserPopUp.pl",
3738
"PGcourse.pl"
3839
);
39-
TEXT(beginproblem());
40-
$showPartialCorrectAnswers = 1;
4140

41+
$showPartialCorrectAnswers = 0;
4242

43-
my @all,@correct,%difference;
44-
45-
###############################################################################
46-
##
47-
## The list of series tests
48-
##
49-
Context()->strings->are("Converges"=>{},"Converges Absolutely"=>{},"Converges Conditionally"=>{},"Diverges"=>{},"Divergence Test"=>{},"Geometric Series"=>{},"Integral Test"=>{},"P-Series"=>{},"Comparison Test"=>{},"Limit Comparison Test"=>{},"Ratio Test"=>{},"Alternating Series Test"=>{});
50-
51-
$blank = String("");
52-
$converges = String("Converges");
53-
$convergesabs = String("Converges Absolutely");
54-
$convergescond = String("Converges Conditionally");
55-
$diverges = String("Diverges");
56-
57-
$divergence = String("Divergence Test");
58-
$geometric = String("Geometric Series");
59-
$integral = String("Integral Test");
60-
$pseries = String("P-Series");
61-
$comparison = String("Comparison Test");
62-
$limitcomparison = String("Limit Comparison Test");
63-
$ratio = String("Ratio Test");
64-
$alternating = String("Alternating Series Test");
65-
66-
67-
##############################################################################
68-
##############################################################################
69-
##
70-
## Set up the infinite series
71-
##
72-
## To change the problem change $n the start value for the series, $an the
73-
## terms of the series, $correct which is the list of test that can be used
74-
## for the series, $ans which is whether the series converges or not.
75-
76-
Context()->variables->are(n=>"Real",k=>"Real");
77-
78-
$n = 1; # starting value for the series
79-
$an = Formula("1/(n^2)")->TeX;
80-
$ans = $converges;
81-
82-
my @all = ($divergence->string,$geometric->string,$integral->string,$pseries->string,$comparison->string,$limitcomparison->string,$ratio->string,$alternating->string);
83-
84-
my @correct = ($pseries->string,$integral->string);
85-
86-
my %all=map{$_ =>1} @all;
87-
my %correct=map{$_=>1} @correct;
88-
my @difference=grep(!defined $correct{$_}, @all);
89-
90-
## The multiple choice question.
91-
$mc = new_checkbox_multiple_choice();
92-
## the correct answers.
93-
$mc->qa("", @correct);
94-
## the list of other answers.
95-
$mc->extra(@difference);
96-
97-
Context()->texStrings;
98-
BEGIN_TEXT
99-
Which of the following series convergence tests could be applied to the infinite series \(\sum\limits_{n=$n}^\infty $an\)? Check all that apply.
100-
\{ $mc->print_q() \}
101-
\{ $mc->print_a() \}
102-
$BR
103-
The series \{ pop_up_list([$blank->string,$converges->string,$convergesabs->string,$convergescond->string,$diverges->string]) \}
104-
END_TEXT
105-
Context()->normalStrings;
106-
107-
install_problem_grader(~~&std_problem_grader);
43+
$test = CheckboxList(
44+
[ "Divergence Test",
45+
"Geometric Series Test",
46+
"Integral Test",
47+
"P-Series Test",
48+
"Comparison Test",
49+
"Limit Comparison Test",
50+
"Ratio Test",
51+
"Alternating Series Test"
52+
],
53+
[2,3]
54+
);
10855

109-
$showPartialCorrectAnswers = 0;
110-
ANS( checkbox_cmp( $mc->correct_ans() ) );
111-
ANS($ans->cmp);
56+
$convergeQ = PopUp(
57+
["??", "Yes, it converges.","No, it diverges.", "The test(s) fail to decide this."],
58+
"Yes, it converges."
59+
);
11260

61+
BEGIN_PGML
62+
Consider the infinite series
63+
[`` \sum_{n=1}^{\infty} \frac{1}{n^2} ``]
64+
Which of the following convergence tests is a good way to decide whether or not this series converges? Check all that apply.
65+
[_]{$test}
66+
67+
Does the series converge?
68+
[_]{$convergeQ}
69+
END_PGML
70+
71+
BEGIN_PGML_SOLUTION
72+
* [``0=\lim_{n\to\infty} 1/n^2 \ ``] so the "divergence test" does not apply.
73+
* Our series is not a geometric series.
74+
* Our series is a series of positive terms and [``\int_1^\infty 1/x^2\; dx < \infty ``] so the integral test says that the series converges.
75+
* Our series is a "p-series" with [`p=2`] which is larger than 1, so the "P-series test" says that the series converges.
76+
* To use the "comparison test" we'd need another series [``\ \sum_{n=1}^{\infty} b_n \ ``] that satisfies the criteria for the comparison test, and where it's easier to decide the convergence or divergence of this series than it is for
77+
our series. I can't think of any good candidates for the series [``\ \sum_{n=1}^{\infty} b_n``], can you?
78+
* The "limit comparison test" has the same issue as the "comparison test".
79+
* [``\lim_{n\to\infty} \frac{1/(n+1)^2}{1/n^2} = 1 ``] so the "ratio test" does not yield any useful information.
80+
* Our series is not an alternating series.
81+
END_PGML_SOLUTION
11382

11483
ENDDOCUMENT();

0 commit comments

Comments
 (0)