## WeBWorK Problems

### Custom List Checker that ignores list-length

by Andrew Parker -
Number of replies: 4
I've been trying to create a customized answer checker for a problem requiring all solutions to a trig equation. I saw an old posting about this that recommended using adaptive parameters, but it was not robust enough to handle the possibility of students using "-2 pi n" instead of "+ 2 pi n". I worked on a version that used "->D('n')" but ultimately switched over to a different approach because of tangent equations and the potential for student answers to use pi as their period.

The answer checker generates a set of solutions from the provided formula ("+2pi n" by evaluating at n = -3..3), and generates a set of student "solutions" by evaluating at n = -10..10 (may be overkill, but needs to be at least twice the range because of the potential for "+ pi n" in the case of tangent). Each student value is checked as a solution to the given equation, and is also tested for overlap with the values from earlier expressions. Then, so long as the set of student values contains the set of actual solutions (and there are no incorrect values) the student should receive full-credit.

The issue that I'm still having is that even though my answer checker cleanly evaluates student responses for tangent equations, WeBWorK will complain if a student uses 1 formula (say pi/3 + pi n) instead of 2 (pi/3 + 2 pi n, 4 pi/3 + 2 pi n), or vice versa. Due to the inclusion of sine and cosine in the randomization of the problem, two formulas is the default for the list of correct answers.

TL;DR - can I override the requirement that the length of the student list match the length of the list provided as the answer?

see attached. (randomization to sine and cosine is disabled in the attached code for testing purposes)

### Re: Custom List Checker that ignores list-length

by Davide Cervone -
I suspect the way to think about this is that the score returned by the list_checker is the number of answers out of the correct answer list that are matched by the student answers, not the number of students answers that are correct. In most cases these are the same thing, but in your case, where one equation can match two or more correct ones, they are not.

In your problem, the number of entries in the correct list is $m, so when the student's answer covers all the correct ones (and nothing else, with no repeats), return $m as the score, otherwise return 0. The actual number of student answers used to do the covering of the correct answers is immaterial.