If you run the code below, and supply similarly incorrect intervals (0,4) and (0,8), the message for the first is “The type of interval is incorrect”, but no similar message appears for the second interval, even though it is likewise incorrect. Is there some way this message can be made to appear?

As you can see in the code below, the first interval was defined in a single Interval statement (0,4], whereas the second interval is a result of a ‘reduced’ union of (0,4)U[4,8]. In the latter case, entering (0,4)U[4,8) as an answer leads to the message “Your union can be simplified by combining intervals”, but entering (0,8) does not produce the (desired) message “The type of interval is incorrect”.

Thanks,

Mary

######################### Initialization

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

);

TEXT(beginproblem());

#########################
Setup

Context("Interval");

$d[0] = Interval ( "(0, 4] ");

$d[1] = Interval ( "(4, 8] ");

Context()->flags->set(reduceUnions => 1);

$d2 = Union( $d[0], $d[1]);

Context()->flags->set(reduceUnions => 0);

$dlong = Union ( $d[0], $d[1] );

Context()->flags->set(reduceUnions => 1);

######################### Main Text

Context()->texStrings;

BEGIN_TEXT

Enter the following intervals:

defined as one interval \( $d[0] \) = \{ ans_rule(30) \} $

defined as a union of two intervals \( $d2 \) = \{ ans_rule(30) \}

END_TEXT

Context()->normalStrings;

########################## Evaluate

Context("Interval");

ANS( $d[0] ->
cmp (showEndTypeHints => 1,
showEndpointHints => 1) );

ANS( $d2 ->
cmp (showEndTypeHints => 1, showEndpointHints
=> 1) );

########################## Solution

Context()->texStrings;

BEGIN_SOLUTION

The domain is \(
$dlong \) which simplifies to
\( $d2 \) $BR

END_SOLUTION

Context()->normalStrings;

COMMENT('MathObject version');

ENDDOCUMENT();