Features & Development

Error messages for contextInequalities

by Robin Cruz -
Number of replies: 1

I am working on a problem template that asks for the solution to a polynomial equation.  The answer may be entered as:

{1,2}

or

x=1 or x=2

This works when I use the Inequalities context since it recognizes both answers as sets.  Here's the code:

Context("Inequalities");

$ans = Compute("x=-$a or x=-$b")->reduce; ANS($ans->cmp);

However, when the first answer is used the student gets a nice answer hint if one of the answers is incorrrect.  For example, if the correct answer is {0,2}, then the student is told that the first number is incorrect.  In the second case, no hint is given.

Can this be changed so that either answer gets the helpful hint? OR is there a better context to use?

Thanks -- rac

In reply to Robin Cruz

Re: Error messages for contextInequalities

by Davide Cervone -
The reason for this difference is that {1,2} is a single set whereas x=1 or x=2 is treated as the union {1} U {2}, and the error messages for unions are different from those for sets (because unions can contain intervals, not just numbers).

I have updated things so that x=1 or x=2 will form a set rather than a union, so the messages should now be more like what you expect (when you have showHints=>1 specified). I've also added error messages for things like x=1 or x=1 where the student has entered redundant answers.

To get this, you will need to update your copies of: