PREP 2014 Question Authoring - Archived

Problems with highlighting and ans_array

by Mike Daven -
Number of replies: 1

I am finding a weird (?) behavior when using points and ans_array – at least part of the answer is not always highlighting correctly.

Here's a small example:

Context("Point");
$beta = random(1,9,1);$g = random(-9,9,1);
$h = random(-9,9,1);$x = Compute(" ($g -$beta + 1)/($beta) ")->reduce;$y = Compute(" ($h -$beta + 1)/$beta ")->reduce;$P = Point($x,$y);

BEGIN_TEXT
If $$beta\odot(x,y)=(g,h)$$, then $$(x,y)$$ = \{$P->ans_array(1)\} END_TEXT ANS($P->cmp);

For each part of the problem, the answer is an ordered pair “(x,y)” and you need to find the values for “x” and “y”.  I wanted the answer to be entered one coordinate at a time, not as a point, but the correct answer should be displayed as a point. I liked what I saw at the wiki: http://webwork.maa.org/wiki/Point_(MathObject_Class).

Everything works as planned except the way the answer is displayed -- the first answer box is highlighted correctly depending on the answer, the second answer box doesn’t highlight either way.  The message reports correctly if one or both coordinates is incorrect.

Any thoughts?