Skip to content

Commit 612410d

Browse files
authored
Merge pull request #1308 from dlglin/UpdateGraphProblems
Update graph problems
2 parents 6118821 + 18bb4f2 commit 612410d

File tree

4 files changed

+329
-322
lines changed

4 files changed

+329
-322
lines changed

OpenProblemLibrary/ASU-topics/setLimitConcepts/3-2-36.pg

Lines changed: 82 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
## Tagged by LD
66

7-
87
## DBsubject(Calculus - single variable)
98
## DBchapter(Limits and continuity)
109
## DBsection(Finding limits using graphs)
@@ -36,107 +35,88 @@
3635
## Problem4('45')
3736
## KEYWORDS('calculus','limits', 'derivatives','limit')
3837

39-
DOCUMENT(); # This should be the first executable line in the problem.
40-
41-
loadMacros(
42-
"PGstandard.pl",
43-
"PGchoicemacros.pl",
44-
"PGgraphmacros.pl",
45-
"PGcourse.pl"
38+
DOCUMENT(); # This should be the first executable line in the problem.
39+
40+
loadMacros('PGstandard.pl', 'PGML.pl', 'plots.pl', 'PGcourse.pl');
41+
42+
$a = random(-3, 3, 1);
43+
$b = random(-2, 3, 1);
44+
$c = random(-3, 2, 1);
45+
$ap1 = 1 + $a;
46+
$bp1 = 1 + $b;
47+
$m1 = random(-1, 1, 0.5);
48+
$m2 = ($b - $a) / 2;
49+
$m3 = ($c - $b - 1) / 2;
50+
$m4 = random(-1, 1, 0.5);
51+
$ystart = $a - $m1;
52+
$yend = $c + $m4;
53+
54+
$color = list_random("blue", "red", "green");
55+
56+
$plot = Plot(
57+
xmin => -3,
58+
xmax => 5,
59+
ymin => -6,
60+
ymax => 6,
61+
xtick_delta => 1,
62+
xminor => 0,
63+
ytick_delta => 1,
64+
yminor => 0,
65+
xlabel => '\(x\)',
66+
ylabel => '\(y\)',
67+
aria_label => 'The graph of the function y=F(x)',
68+
axes_on_top => 1,
4669
);
4770

48-
TEXT(beginproblem());
49-
$showPartialCorrectAnswers = 1;
50-
51-
$a=random(-3,3,1);
52-
$b=random(-2,3,1);
53-
$c=random(-3,2,1);
54-
$m1=random(-1,1,0.5);
55-
$m2=($b - $a)/2;
56-
$m3=($c - $b - 1)/2;
57-
$m4=random(-1,1,0.5);
58-
@slice = NchooseK(3,3);
59-
60-
@colors = ("blue", "red", "green");
61-
@sc = @colors[@slice]; #scrambled colors
62-
@sa = ('A','B','C')[@slice];
63-
64-
$f1 = FEQ("${m1}*(x+1)+$a for x in [-2,-1) using color:$sc[0] and weight:2");
65-
$f2 = FEQ("${m2}*(x-1)+$b for x in (-1,1) using color=$sc[0] and weight:2");
66-
$f3 = FEQ("${m3}*(x-3)+$c for x in [1,3) using color=$sc[0] and weight=2");
67-
$f4 = FEQ("1+$a for x in [-1,-1] using color=$sc[0] and weight=2");
68-
$f5 = FEQ("${m4}*(x-3)+$c for x in (3,4] using color=$sc[0] and weight=2");
69-
70-
$graph = init_graph(-3,-6,5,6,'axes'=>[0,0],'grid'=>[8,12]);
71-
72-
($f1Ref,$f2Ref,$f3Ref,$f4Ref,$f5Ref) = plot_functions($graph,$f1,$f2,$f3,$f4,$f5);
73-
74-
TEXT(EV2(<<EOT));
75-
Let F be the function below.$PAR
76-
If you are having a hard time seeing the picture clearly, click on the picture. It will expand to a larger picture on its own page so that you can inspect it more clearly.$PAR
77-
EOT
78-
79-
TEXT(image( insertGraph($graph) ));
80-
81-
TEXT(EV2(<<EOT));
82-
$BR
83-
$BR
84-
Evaluate each of the following expressions. $PAR
85-
Note: Enter 'DNE' if the limit does not exist or is not defined. $PAR
86-
87-
a) \( \displaystyle \lim_{x \to -1^-} F(x) \) = \<ans_rule(7)\>
88-
$SPACE
89-
90-
\( \displaystyle \lim_{x \to -1^+} F(x) \) = \<ans_rule(7)\>
91-
$SPACE
92-
93-
\( \displaystyle \lim_{x \to -1} F(x) \) = \<ans_rule(7)\>
94-
$SPACE
95-
96-
\( F(-1) \) = \<ans_rule(7)\>
97-
$PAR
98-
99-
b) \( \displaystyle \lim_{x \to 1^-} F(x) \) = \<ans_rule(8)\>
100-
$SPACE
101-
102-
\( \displaystyle \lim_{x \to 1^+} F(x) \) = \<ans_rule(8)\>
103-
$SPACE
104-
105-
\( \displaystyle \lim_{x \to 1} F(x) \) = \<ans_rule(8)\>
106-
$SPACE
107-
108-
\( F(1) \) = \<ans_rule(8)\>
109-
$PAR
110-
111-
c) \( \displaystyle \lim_{x \to 3^-} F(x) \) = \<ans_rule(8)\>
112-
$SPACE
113-
114-
\( \displaystyle \lim_{x \to 3^+} F(x) \) = \<ans_rule(8)\>
115-
$SPACE
116-
117-
\( \displaystyle \lim_{x \to 3} F(x) \) = \<ans_rule(8)\>
118-
$SPACE
119-
120-
\( F(3) \) = \<ans_rule(8)\>
121-
$PAR
122-
123-
EOT
124-
125-
$ap1 = 1 + $a;
126-
$bp1 = 1 + $b;
127-
128-
ANS(num_cmp($a, strings=>['DNE'])) ;
129-
ANS(num_cmp($a, strings=>['DNE'])) ;
130-
ANS(num_cmp($a, strings=>['DNE'])) ;
131-
ANS(num_cmp($ap1, strings=>['DNE']));
132-
ANS(num_cmp($b, strings=>['DNE'])) ;
133-
ANS(num_cmp($bp1, strings=>['DNE']));
134-
ANS(num_cmp('DNE', strings=>['DNE'])) ;
135-
ANS(num_cmp($bp1, strings=>['DNE']));
136-
ANS(num_cmp($c, strings=>['DNE'])) ;
137-
ANS(num_cmp($c, strings=>['DNE'])) ;
138-
ANS(num_cmp($c, strings=>['DNE'])) ;
139-
ANS(num_cmp('DNE', strings=>['DNE'])) ;
140-
141-
ENDDOCUMENT(); # This should be the last executable line in the problem.
71+
$plot->add_function(
72+
["${m1}*(x+1)+$a", 'x', -2, -1, start_mark=>'circle', end_mark=>'open_circle', color=>$color, weight=>2],
73+
["${m2}*(x-1)+$b", 'x', -1, 1, start_mark=>'open_circle', end_mark=>'open_circle', color=>$color, weight=>2],
74+
["${m3}*(x-3)+$c", 'x', 1, 3, start_mark=>'circle', end_mark=>'open_circle', color=>$color, weight=>2],
75+
["${m4}*(x-3)+$c", 'x', 3, 4, start_mark=>'open_circle', end_mark=>'circle', color=>$color, weight=>2]
76+
);
14277

78+
$plot->add_dataset([ -1, $ap1 ], color => $color, marks => 'circle');
79+
80+
$alttext =
81+
"A graph showing a line segment starting with a solid circle at the point (-2,$ystart) and ending with an open circle at the point (-1,$a). There is a solid circle at the point (-1,$ap1). There is a line segment starting with an open circle at the point (-1,$a) and ending with an open circle at the point (1,$b). There is a line segment starting with a solid circle at the point (1,$bp1) and ending with an open circle at the point (3,$c). There is a line segment starting with an open circle at the point (3,$c) and ending with a solid circle at the point (4,$yend).";
82+
83+
$ans1 = Compute($a);
84+
$ans2 = Compute($a);
85+
$ans3 = Compute($a);
86+
$ans4 = Compute($ap1);
87+
$ans5 = Compute($b);
88+
$ans6 = Compute($bp1);
89+
$ans7 = Compute('DNE');
90+
$ans8 = Compute($bp1);
91+
$ans9 = Compute($c);
92+
$ans10 = Compute($c);
93+
$ans11 = Compute($c);
94+
$ans12 = Compute('DNE');
95+
96+
BEGIN_PGML
97+
The graph of [`y=F(x)`] is given below.
98+
99+
If you are having a hard time seeing the picture clearly, click on the picture. It will expand to a larger picture on its own page so that you can inspect it more clearly.
100+
101+
[! $alttext !]{$plot}
102+
103+
Evaluate each of the following expressions.
104+
105+
Note: Enter 'DNE' if the limit does not exist or is not defined.
106+
[#
107+
[. a) .] [. [`` \lim_{x \to -1^-} F(x) ``] = [_]{$ans1}{5} .]
108+
[. [`` \lim_{x \to -1^+} F(x) ``] = [_]{$ans2}{5} .]
109+
[. [`` \lim_{x \to -1} F(x) ``] = [_]{$ans3}{5} .]
110+
[. [` F(-1) `] = [_]{$ans4}{5} .]*
111+
[. b) .] [. [`` \lim_{x \to 1^-} F(x) ``] = [_]{$ans5}{5} .]
112+
[. [`` \lim_{x \to 1^+} F(x) ``] = [_]{$ans6}{5} .]
113+
[. [`` \lim_{x \to 1} F(x) ``] = [_]{$ans7}{5} .]
114+
[. [` F(1) `] = [_]{$ans8}{5} .]*
115+
[. c) .] [. [`` \lim_{x \to 3^-} F(x) ``] = [_]{$ans9}{5} .]
116+
[. [`` \lim_{x \to 3^+} F(x) ``] = [_]{$ans10}{5} .]
117+
[. [`` \lim_{x \to 3} F(x) ``] = [_]{$ans11}{5} .]
118+
[. [` F(3) `] = [_]{$ans12}{5} .]*
119+
#]*
120+
END_PGML
121+
122+
ENDDOCUMENT();

OpenProblemLibrary/AlfredUniv/anton8e/chapter2/2.2/prob18.pg

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,33 @@
2727
DOCUMENT();
2828

2929
# Load whatever macros you need for the problem
30-
loadMacros(
31-
"PGstandard.pl",
32-
"PGchoicemacros.pl",
33-
"PGgraphmacros.pl",
34-
"MathObjects.pl",
35-
"PGcourse.pl"
36-
);
37-
38-
## Show partial correct answers
39-
$showPartialCorrectAnswers = 1;
40-
## Display the problem information
41-
TEXT(beginproblem());
42-
43-
## Declare Variables
44-
Context()->variables->are(x=>'Real',y=>'Real');
30+
loadMacros("PGstandard.pl", "PGML.pl", "PGcourse.pl");
4531

4632
## Function Definition
47-
$a = random(1,9);
33+
$a = random(1, 9);
4834

4935
$f = Formula("(sqrt(x+$a**2)-$a)/x")->reduce;
5036

51-
$ans1 = Formula("1/(2*$a)")->reduce;
52-
37+
$twoa = 2 * $a;
38+
$a2 = $a**2;
39+
$ans1 = Compute("1/($twoa)");
40+
$conj = Formula("sqrt(x+$a**2)+$a");
41+
BEGIN_PGML
42+
Let [`` f(x)= [$f]``].
5343

54-
Context()->texStrings;
55-
BEGIN_TEXT
56-
Let \(\> f(x)= $f\).
57-
$BR
58-
$BR
59-
Find \(\> \lim_{x \rightarrow 0} f(x) \>\) by first rationalizing the numerator.
60-
$BR
61-
$BR
62-
Enter $BBOLD I $EBOLD for \(\infty\), $BBOLD -I $EBOLD for \(-\infty\),
63-
and $BBOLD DNE $EBOLD if the limit does not exist.
64-
$BR
65-
$BR
66-
Answer: \{ans_rule(20)\}
67-
68-
END_TEXT
69-
Context()->normalStrings;
70-
ANS(num_cmp($ans1, strings=>["I", "-I", "DNE"]));
44+
Find [`` \lim_{x \rightarrow 0} f(x) ``] by first rationalizing the numerator (multiplying and dividing by the conjugate).
7145

46+
[`` \lim_{x \rightarrow 0} f(x) =``][_]{$ans1}{5}[@helpLink('limits')@]*
47+
END_PGML
7248

49+
BEGIN_PGML_SOLUTION
50+
[``\begin{array}{rl}\displaystyle \lim_{x \rightarrow 0} [$f] & = \displaystyle\lim_{x \rightarrow 0} [$f]\cdot\frac{[$conj]}{[$conj]}\\
51+
& =\displaystyle\lim_{x \rightarrow 0}\frac{(x+[$a2])-[$a2]}{x\left([$conj]\right)}\\
52+
& =\displaystyle\lim_{x \rightarrow 0}\frac{x}{x\left([$conj]\right)}\\
53+
& =\displaystyle\lim_{x \rightarrow 0}\frac{1}{[$conj]}\\
54+
& =\displaystyle\frac{1}{\sqrt{0+[$a2]}+[$a]}\\
55+
& =\displaystyle\frac{1}{[$twoa]}
56+
\end{array}``]
57+
END_PGML_SOLUTION
7358

7459
ENDDOCUMENT();
75-

0 commit comments

Comments
 (0)