Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite using MathObjects and PGML #1178

Merged
merged 5 commits into from
Dec 18, 2024
Merged
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
48 changes: 26 additions & 22 deletions OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,39 @@ DOCUMENT(); # This should be the first executable line in the problem.

loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGML.pl",
"MathObjects.pl",
"PGcourse.pl"
);

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

Context("Numeric");

$a = random(2,9,1);
$ans3 = Formula("sqrt(x)-$a");

Context("Interval");

$ansInt = Compute("[-$a, infinity)");

BEGIN_PGML
The function [`f(x)=(x+[$a])^2`] is not one-to-one. Choose the largest possible
domain containing the number 100 so that the function restricted to the domain is one-to-one.

The largest possible domain is [_________________]{$ansInt} (use interval notation).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 43: replace "interval notation" with [@ helpLink("interval","interval notation") @]*
(including the star at the end!) This will create a link that points to instructions for entering intervals into webwork.


If [`f`] is restricted to the above domain, then the inverse function is [`g(x)=`][_______________]{$ans3}.
END_PGML

BEGIN_PGML_SOLUTION
The function [`f(x)=(x+[$a])^2`] is one-to-one on the intervals [`(-\infty, -[$a]]`] and [`[-[$a], \infty)`].
The second one contains the number 100.

TEXT(EV2(<<EOT));
The function \(f(x)=(x+$a)^2\) is not one-to-one. Choose a largest possible
domain containing the number 100 so that
the function restricted to the domain is one-to-one.
$BR
The largest possible domain is [\{ ans_rule(10) \},\{ ans_rule(10) \});
$BR
the inverse function is \(g(x)=\) \{ ans_rule(15) \}
$BR
$BBOLD
If your answer is \(\infty\), enter infinity.
$EBOLD
EOT

$ans1 = -$a;
$ans2 = "infinity";
$ans3 = "sqrt(x)-$a";
ANS(num_cmp($ans1));
ANS(str_cmp($ans2));
ANS(fun_cmp($ans3));
Solving the equation [`y=(x+[$a])^2`] for [`x`] will give us two solutions: [`x = \pm\sqrt{y} - [$a]`].
According to our domain choice, [`x \ge [$ans1]`], which means we have to choose the solution with [`+`].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 53: replace $ans1 with $a

gajennings marked this conversation as resolved.
Show resolved Hide resolved
Exchanging the [`x`] and [`y`] variables will give us the answer [`g(x) = [$ans3]`].
END_PGML_SOLUTION

ENDDOCUMENT(); # This should be the last executable line in the problem.