Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 82 additions & 102 deletions OpenProblemLibrary/ASU-topics/setLimitConcepts/3-2-36.pg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

## Tagged by LD


## DBsubject(Calculus - single variable)
## DBchapter(Limits and continuity)
## DBsection(Finding limits using graphs)
Expand Down Expand Up @@ -36,107 +35,88 @@
## Problem4('45')
## KEYWORDS('calculus','limits', 'derivatives','limit')

DOCUMENT(); # This should be the first executable line in the problem.

loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGgraphmacros.pl",
"PGcourse.pl"
DOCUMENT(); # This should be the first executable line in the problem.

loadMacros('PGstandard.pl', 'PGML.pl', 'plots.pl', 'PGcourse.pl');

$a = random(-3, 3, 1);
$b = random(-2, 3, 1);
$c = random(-3, 2, 1);
$ap1 = 1 + $a;
$bp1 = 1 + $b;
$m1 = random(-1, 1, 0.5);
$m2 = ($b - $a) / 2;
$m3 = ($c - $b - 1) / 2;
$m4 = random(-1, 1, 0.5);
$ystart = $a - $m1;
$yend = $c + $m4;

$color = list_random("blue", "red", "green");

$plot = Plot(
xmin => -3,
xmax => 5,
ymin => -6,
ymax => 6,
xtick_delta => 1,
xminor => 0,
ytick_delta => 1,
yminor => 0,
xlabel => '\(x\)',
ylabel => '\(y\)',
aria_label => 'The graph of the function y=F(x)',
axes_on_top => 1,
);

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;

$a=random(-3,3,1);
$b=random(-2,3,1);
$c=random(-3,2,1);
$m1=random(-1,1,0.5);
$m2=($b - $a)/2;
$m3=($c - $b - 1)/2;
$m4=random(-1,1,0.5);
@slice = NchooseK(3,3);

@colors = ("blue", "red", "green");
@sc = @colors[@slice]; #scrambled colors
@sa = ('A','B','C')[@slice];

$f1 = FEQ("${m1}*(x+1)+$a for x in [-2,-1) using color:$sc[0] and weight:2");
$f2 = FEQ("${m2}*(x-1)+$b for x in (-1,1) using color=$sc[0] and weight:2");
$f3 = FEQ("${m3}*(x-3)+$c for x in [1,3) using color=$sc[0] and weight=2");
$f4 = FEQ("1+$a for x in [-1,-1] using color=$sc[0] and weight=2");
$f5 = FEQ("${m4}*(x-3)+$c for x in (3,4] using color=$sc[0] and weight=2");

$graph = init_graph(-3,-6,5,6,'axes'=>[0,0],'grid'=>[8,12]);

($f1Ref,$f2Ref,$f3Ref,$f4Ref,$f5Ref) = plot_functions($graph,$f1,$f2,$f3,$f4,$f5);

TEXT(EV2(<<EOT));
Let F be the function below.$PAR
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
EOT

TEXT(image( insertGraph($graph) ));

TEXT(EV2(<<EOT));
$BR
$BR
Evaluate each of the following expressions. $PAR
Note: Enter 'DNE' if the limit does not exist or is not defined. $PAR

a) \( \displaystyle \lim_{x \to -1^-} F(x) \) = \<ans_rule(7)\>
$SPACE

\( \displaystyle \lim_{x \to -1^+} F(x) \) = \<ans_rule(7)\>
$SPACE

\( \displaystyle \lim_{x \to -1} F(x) \) = \<ans_rule(7)\>
$SPACE

\( F(-1) \) = \<ans_rule(7)\>
$PAR

b) \( \displaystyle \lim_{x \to 1^-} F(x) \) = \<ans_rule(8)\>
$SPACE

\( \displaystyle \lim_{x \to 1^+} F(x) \) = \<ans_rule(8)\>
$SPACE

\( \displaystyle \lim_{x \to 1} F(x) \) = \<ans_rule(8)\>
$SPACE

\( F(1) \) = \<ans_rule(8)\>
$PAR

c) \( \displaystyle \lim_{x \to 3^-} F(x) \) = \<ans_rule(8)\>
$SPACE

\( \displaystyle \lim_{x \to 3^+} F(x) \) = \<ans_rule(8)\>
$SPACE

\( \displaystyle \lim_{x \to 3} F(x) \) = \<ans_rule(8)\>
$SPACE

\( F(3) \) = \<ans_rule(8)\>
$PAR

EOT

$ap1 = 1 + $a;
$bp1 = 1 + $b;

ANS(num_cmp($a, strings=>['DNE'])) ;
ANS(num_cmp($a, strings=>['DNE'])) ;
ANS(num_cmp($a, strings=>['DNE'])) ;
ANS(num_cmp($ap1, strings=>['DNE']));
ANS(num_cmp($b, strings=>['DNE'])) ;
ANS(num_cmp($bp1, strings=>['DNE']));
ANS(num_cmp('DNE', strings=>['DNE'])) ;
ANS(num_cmp($bp1, strings=>['DNE']));
ANS(num_cmp($c, strings=>['DNE'])) ;
ANS(num_cmp($c, strings=>['DNE'])) ;
ANS(num_cmp($c, strings=>['DNE'])) ;
ANS(num_cmp('DNE', strings=>['DNE'])) ;

ENDDOCUMENT(); # This should be the last executable line in the problem.
$plot->add_function(
["${m1}*(x+1)+$a", 'x', -2, -1, start_mark=>'circle', end_mark=>'open_circle', color=>$color, weight=>2],
["${m2}*(x-1)+$b", 'x', -1, 1, start_mark=>'open_circle', end_mark=>'open_circle', color=>$color, weight=>2],
["${m3}*(x-3)+$c", 'x', 1, 3, start_mark=>'circle', end_mark=>'open_circle', color=>$color, weight=>2],
["${m4}*(x-3)+$c", 'x', 3, 4, start_mark=>'open_circle', end_mark=>'circle', color=>$color, weight=>2]
);

$plot->add_dataset([ -1, $ap1 ], color => $color, marks => 'circle');

$alttext =
"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).";

$ans1 = Compute($a);
$ans2 = Compute($a);
$ans3 = Compute($a);
$ans4 = Compute($ap1);
$ans5 = Compute($b);
$ans6 = Compute($bp1);
$ans7 = Compute('DNE');
$ans8 = Compute($bp1);
$ans9 = Compute($c);
$ans10 = Compute($c);
$ans11 = Compute($c);
$ans12 = Compute('DNE');

BEGIN_PGML
The graph of [`y=F(x)`] is given below.

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.

[! $alttext !]{$plot}

Evaluate each of the following expressions.

Note: Enter 'DNE' if the limit does not exist or is not defined.
[#
[. a) .] [. [`` \lim_{x \to -1^-} F(x) ``] = [_]{$ans1}{5} .]
[. [`` \lim_{x \to -1^+} F(x) ``] = [_]{$ans2}{5} .]
[. [`` \lim_{x \to -1} F(x) ``] = [_]{$ans3}{5} .]
[. [` F(-1) `] = [_]{$ans4}{5} .]*
[. b) .] [. [`` \lim_{x \to 1^-} F(x) ``] = [_]{$ans5}{5} .]
[. [`` \lim_{x \to 1^+} F(x) ``] = [_]{$ans6}{5} .]
[. [`` \lim_{x \to 1} F(x) ``] = [_]{$ans7}{5} .]
[. [` F(1) `] = [_]{$ans8}{5} .]*
[. c) .] [. [`` \lim_{x \to 3^-} F(x) ``] = [_]{$ans9}{5} .]
[. [`` \lim_{x \to 3^+} F(x) ``] = [_]{$ans10}{5} .]
[. [`` \lim_{x \to 3} F(x) ``] = [_]{$ans11}{5} .]
[. [` F(3) `] = [_]{$ans12}{5} .]*
#]*
END_PGML

ENDDOCUMENT();
56 changes: 20 additions & 36 deletions OpenProblemLibrary/AlfredUniv/anton8e/chapter2/2.2/prob18.pg
Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,33 @@
DOCUMENT();

# Load whatever macros you need for the problem
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGgraphmacros.pl",
"MathObjects.pl",
"PGcourse.pl"
);

## Show partial correct answers
$showPartialCorrectAnswers = 1;
## Display the problem information
TEXT(beginproblem());

## Declare Variables
Context()->variables->are(x=>'Real',y=>'Real');
loadMacros("PGstandard.pl", "PGML.pl", "PGcourse.pl");

## Function Definition
$a = random(1,9);
$a = random(1, 9);

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

$ans1 = Formula("1/(2*$a)")->reduce;

$twoa = 2 * $a;
$a2 = $a**2;
$ans1 = Compute("1/($twoa)");
$conj = Formula("sqrt(x+$a**2)+$a");
BEGIN_PGML
Let [`` f(x)= [$f]``].

Context()->texStrings;
BEGIN_TEXT
Let \(\> f(x)= $f\).
$BR
$BR
Find \(\> \lim_{x \rightarrow 0} f(x) \>\) by first rationalizing the numerator.
$BR
$BR
Enter $BBOLD I $EBOLD for \(\infty\), $BBOLD -I $EBOLD for \(-\infty\),
and $BBOLD DNE $EBOLD if the limit does not exist.
$BR
$BR
Answer: \{ans_rule(20)\}

END_TEXT
Context()->normalStrings;
ANS(num_cmp($ans1, strings=>["I", "-I", "DNE"]));
Find [`` \lim_{x \rightarrow 0} f(x) ``] by first rationalizing the numerator (multiplying and dividing by the conjugate).

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

BEGIN_PGML_SOLUTION
[``\begin{array}{rl}\displaystyle \lim_{x \rightarrow 0} [$f] & = \displaystyle\lim_{x \rightarrow 0} [$f]\cdot\frac{[$conj]}{[$conj]}\\
& =\displaystyle\lim_{x \rightarrow 0}\frac{(x+[$a2])-[$a2]}{x\left([$conj]\right)}\\
& =\displaystyle\lim_{x \rightarrow 0}\frac{x}{x\left([$conj]\right)}\\
& =\displaystyle\lim_{x \rightarrow 0}\frac{1}{[$conj]}\\
& =\displaystyle\frac{1}{\sqrt{0+[$a2]}+[$a]}\\
& =\displaystyle\frac{1}{[$twoa]}
\end{array}``]
END_PGML_SOLUTION

ENDDOCUMENT();

Loading