A slew of minor bugs

1. <subsetOfReals> does not handle both bounds at infinity

<subsetOfReals> appears unable to process sets whose lower and upper bounds are both infinite, whether entered using interval notation or set-builder notation.

Examples that do not appear to work:

<subsetOfReals>{x | -infinity < x < infinity}</subsetOfReals>

or

<subsetOfReals>(-infinity, infinity)</subsetOfReals>

It appears to work when only one endpoint is infinite, but not when both endpoints are.


2. \mathbb is consumed by MathQuill but has no visible effect

MathQuill accepts input such as:

\mathbb R

However, the command appears to consume and ignore the escaped portion and simply render a “R” without rendering a blackboard-bold character or producing any other visible output regarding the escaped command.


3. {} is not recognized as the empty set in answer validation

Using

\{\}

does not appear to be interpreted as the empty set for answer validation purposes.

Instead, {} is rendered as a set containing a blank entry:

\left\{ \_ \right\}

The only approaches I’ve found that validate successfully are:

\varnothing

or selecting the empty-set symbol from the virtual keyboard.


4. No CodeMirror autocomplete for renderMode

The renderMode attribute does not appear in CodeMirror autocomplete suggestions.


5. Inconsistent handling of empty intervals

The following boolean evaluates as true:

<boolean>
 <subsetOfReals>12<=x<=5</subsetOfReals>
 =
 <subsetOfReals>22<=x<=0</subsetOfReals>
</boolean>

which suggests both expressions are being interpreted as the empty set.

However, answer validation behaves differently:

<answer>
 <award>
 <subsetOfReals>12<=x<=5</subsetOfReals>
 </award>
</answer>

Entering

[12,5]

does not validate as correct, while entering

\emptyset

(or \varnothing) does.

This suggests an inconsistency between <boolean> set equality and <answer> validation when an interval represents the empty set.

Related: the component also fails to interpret degenerate closed intervals such as [3,3], but accepts \{3\} for something like

<answer>
 <subsetOfReals>3<=x<=3</subsetOfReals>
</answer>

Moved this to the Discussion category since it fits better there.

Could you give an example about how these don’t work? They both correct produce R, which is the real line. Is it the display of R rather than (-infinity, infinity) that is confusing, or do they not work correctly in comparisons? I assume it is the display; maybe showing R is unexpected.

I haven’t looked into the MathQuill aspect, but the math-expressions library underlying our <math> does not have support for representing mathbb R. This is probably related to the display of R being confusing for the set of reals. Using R was the best I could do given the current limitations of math-expressions.

If used in an <answer> tag, they do not appear to validate against (-infinity,infinity) as user input. It marks the answer as incorrect. For example:
<answer><subsetOfReals>(-infinity, infinity)</subsetOfReals></answer> does not accept (-infinity, infinity) as an answer [although based on your follow-up comment, it does accept a capital letter R, which I had not thought to try since it wouldn’t let me use the \mathbb tag]. If \mathbb is going to be ignored, I think it should just leave that input alone instead of digesting it. I think you have control over which \ commands are accepted?

This is a general flaw about <subsetOfReals>. For this example, the <subsetOfReals> gets converted to <math>R</math> and then compared to what the user’s response. It doesn’t automatically compare at the level of <subsetOfReals> only at the level of <math> (and <math> doesn’t contain the multiple representations that <subsetOfReals> does).

A workaround is to force the <answer> to make the comparison in terms of <subsetOfReals> explicitly by converting the user answer to a <subsetOfReals>:

<answer>
  <mathInput name="mi" />
  <award>
    <when>
      <subsetOfReals>$mi</subsetOfReals> =
      <subsetOfReals>(-infinity, infinity)</subsetOfReals>
    </when>
  </award>
</answer>

Then all of these would be correct: R, (-\infty,\infty), x \in R, x \in (-\infty, \infty), -\infty < x < \infty.

There should be an easier way; I’m just not sure what’s the right way and won’t just increase the confusion.

This works:

<answer matchBlanks>
  <mathInput name="mi"><label>Enter {}</label></mathInput>
  <award>{_}</award>
</answer>

When you type {} in a math input, it adds a “blank” placeholder in between. Typically, we don’t match blanks when evaluating the correctness of an answer, as they are a placeholder for errors. But, in this case, you can add matchBlanks to get it to accept that answer.

Same answer as above. With this notation, it converts <subsetOfReals>12<=x<=5</subsetOfReals> to the empty set. Since the user’s answer is not converted to a <subsetOfReals>, they have to enter and empty set. Above workaround to convert the user’s response to a <subsetOfReals> would work.

That’s a good question. I’m not sure what people would find more or less confusing. My thought is that \mathbb doesn’t do any harm so swallowing it would be a reasonable action.

I filled in this hole.