From 621db75f7b68af65cd5871419f3e0683d39fedbe Mon Sep 17 00:00:00 2001 From: Jan Hlavacek Date: Fri, 6 Sep 2024 20:56:10 -0400 Subject: [PATCH 1/5] Rewrite using MathObjects and PGML The problem uses 'cmp_str' to check for answer 'infinity'. The `cmp_str` is deprecated, and does not work well with the MathQuill editor. In addition to rewriting in PGML, a solution was added as well. --- OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg | 46 ++++++++++---------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg index 4b5f5ce650..72244cbc83 100644 --- a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg +++ b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg @@ -20,35 +20,37 @@ 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); +$ans1 = Compute("-$a"); +$ans2 = Infinity; +$ans3 = Formula("sqrt(x)-$a"); + +BEGIN_PGML +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. + +The largest possible domain is [`\left[\strut\right.`][________]{$ans1},[________]{$ans2}[`\left.\strut\right)`]. + +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, [$ans1]]`] and [`[[$ans1], \infty)`]. +The second one contains the number 100. -TEXT(EV2(< Date: Fri, 20 Sep 2024 08:50:02 -0400 Subject: [PATCH 2/5] Change a to the as suggested by @dlglin --- OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg index 72244cbc83..75dcc1a7bf 100644 --- a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg +++ b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg @@ -35,7 +35,7 @@ $ans2 = Infinity; $ans3 = Formula("sqrt(x)-$a"); BEGIN_PGML -The function [`f(x)=(x+[$a])^2`] is not one-to-one. Choose a largest possible +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 [`\left[\strut\right.`][________]{$ans1},[________]{$ans2}[`\left.\strut\right)`]. From 1765ca6fb3811e460a887390995e208bb4cbcdd2 Mon Sep 17 00:00:00 2001 From: Jan Hlavacek Date: Fri, 20 Sep 2024 08:54:03 -0400 Subject: [PATCH 3/5] Change wording as suggested by @dlglin --- OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg index 75dcc1a7bf..f032072d8f 100644 --- a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg +++ b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg @@ -40,7 +40,7 @@ domain containing the number 100 so that the function restricted to the domain i The largest possible domain is [`\left[\strut\right.`][________]{$ans1},[________]{$ans2}[`\left.\strut\right)`]. -The inverse function is [`g(x)=`][_______________]{$ans3}. +If [`f`] is restricted to the above domain, then the inverse function is [`g(x)=`][_______________]{$ans3}. END_PGML BEGIN_PGML_SOLUTION From a5685a3532f04ea8dbc9c471561765d388517386 Mon Sep 17 00:00:00 2001 From: Jan Hlavacek Date: Sat, 21 Sep 2024 01:48:16 -0400 Subject: [PATCH 4/5] Use the Interval context for domain --- OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg index f032072d8f..2b401d1d70 100644 --- a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg +++ b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg @@ -30,15 +30,17 @@ $showPartialCorrectAnswers = 1; Context("Numeric"); $a = random(2,9,1); -$ans1 = Compute("-$a"); -$ans2 = Infinity; $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 [`\left[\strut\right.`][________]{$ans1},[________]{$ans2}[`\left.\strut\right)`]. +The largest possible domain is [_________________]{$ansInt} (use interval notation). If [`f`] is restricted to the above domain, then the inverse function is [`g(x)=`][_______________]{$ans3}. END_PGML From 86ac60e640bce5c063aa6cb17ebf711c875239c4 Mon Sep 17 00:00:00 2001 From: Jan Hlavacek Date: Sat, 21 Sep 2024 01:52:07 -0400 Subject: [PATCH 5/5] Fix solution after switching to Interval context --- OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg index 2b401d1d70..b3be206dcf 100644 --- a/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg +++ b/OpenProblemLibrary/ma117DB/set5/srw2_9_63.pg @@ -46,7 +46,7 @@ If [`f`] is restricted to the above domain, then the inverse function is [`g(x)= END_PGML BEGIN_PGML_SOLUTION -The function [`f(x)=(x+[$a])^2`] is one-to-one on the intervals [`(-\infty, [$ans1]]`] and [`[[$ans1], \infty)`]. +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. Solving the equation [`y=(x+[$a])^2`] for [`x`] will give us two solutions: [`x = \pm\sqrt{y} - [$a]`].