WeBWorK Problems

Lists of Vectors answer checker

Lists of Vectors answer checker

by Alex Jordan -
Number of replies: 1
Hello community,
I would like an answer to be a list of vectors where it is acceptable to rescale any vector in the list and I do not give away how many vectors there are in the list. Is this possible with math objects?

For example:

doesn't meet my need for rescaled vectors to be counted as correct. I have tried

But the parallel=>1 option does not seem to do anything with a list of vectors. (If the answer were a single vector, this option works as expected.)

I could use multiple answer blanks and either use parserMultiAnswer or unorderedAnswer, but the number of answer blanks gives away the number of vectors. (Also, with parserMultiAnswer I would really need to learn a lot more about how math objects work internally. And I have found unorderedAnswer to be buggy, sometimes counting answers correct in one order but not in others.)

But anyway, is there a way to pass options to individual checkers of the objects within a List?

(Related - I may be dreaming here, but is there anything like
#Counts as correct any set that is also a basis for Span(<1,2,0>,<3,4,0>)
#Counts as correct any set that also spans Span(<1,2,0>,<3,4,0>)

In reply to Alex Jordan

Re: Lists of Vectors answer checker

by Davide Cervone -
You can use
    ANS(Compute(",")->cmp(checker => sub {
      my ($correct,$student,$ans) = @_;
      return $correct->isParallel($student);
to get a list of vectors where the student can enter parallel vectors. This uses a custom checker for the individual entries in the list which returns true when the student answer is parallel to the correct one.

I believe that there is a special basic_cmp in pg/macros/PGmorematrixmacros.pl that might do what you need, though it is not MathObject based. See the POD documentation for that macro file for details.