Skip to content

Commit 9c21554

Browse files
authored
Merge pull request #1021 from gajennings/main
Fix bug 4749. Require interval notation.
2 parents fbb87c2 + ac48e1c commit 9c21554

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

OpenProblemLibrary/CollegeOfIdaho/setAlgebra_04_02_CompoundIneq/42IntAlg_21_CompoundIneq.pg

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ loadMacros(
2323
"PGstandard.pl",
2424
"PGchoicemacros.pl",
2525
"MathObjects.pl",
26-
"contextInequalitiesAllowStrings.pl",
2726
"PGcourse.pl"
2827
);
2928

@@ -33,6 +32,8 @@ TEXT(beginproblem());
3332
# Setup
3433
#This is an (-infinity,a) or (b,infinity) problem:
3534

35+
Context("Interval");
36+
3637
$a = random(-5,4,1);
3738
do {$b = random(1,9,1);} while ($a==$b);
3839

@@ -42,19 +43,25 @@ do {$b = random(1,9,1);} while ($a==$b);
4243
######################################
4344
# Main text
4445

46+
Context()->texStrings;
4547
BEGIN_TEXT
46-
Solve the compound inequality.
48+
Solve the compound inequality. Write your answer in \{helpLink("interval","interval notation")\}.
4749
\[ $inequal[$slice[0]] \mbox{ or } $inequal[$slice[1]] \]
48-
Answer: \{ ans_rule(20) \}
50+
Answer: \(x \in \) \{ ans_rule(20) \}
4951
END_TEXT
52+
Context()->normalStrings;
5053

5154
######################################
5255
# Answer
5356

54-
Context("Inequalities-AllowStrings");
57+
# Require interval notation so answers don't just repeat the question.
5558

56-
$ans = Compute("$inequal[0] or $inequal[1]");
57-
if ($a>$b) {$ans = Compute("All real numbers");}
59+
if ($a<$b){
60+
$ans = Compute("(-infinity,$a) U ($b,infinity)");
61+
}
62+
else {
63+
$ans = Compute("(-infinity,infinity)");
64+
}
5865
ANS($ans->cmp);
5966

6067
$showPartialCorrectAnswers = 1;

0 commit comments

Comments
 (0)