## WeBWorK Main Forum

### parserFormulaUpToConstant messages

by Louis Zulli -
Number of replies: 4
I haven't studied the code---does it generate the following behavior?

If a formula is correct but lacks the addition of an arbitrary constant, the answer is called incorrect and the message "Your answer is not the most general solution" appears.

If a formula is incorrect and lacks the addition of an arbitrary constant, the answer is called incorrect and the message "Note: there is always more than one possibility" appears.

If this is so, perhaps the second message could be improved? A colleague just reported students being confused by the message. Maybe no message at all would be better in this situation, since the real issue is not the lack of a constant but an incorrect formula?

Am I correct that a problem can be coded to suppress all these messages, but not to suppress just some of these messages (without fancy coding, that is)?

Thanks,
Louis

### Re: parserFormulaUpToConstant messages

by Davide Cervone -
That does look to be how it works. It has been a long time since I wrote that macro file (2006?), so I don't remember the details of why the messages are a they are. But it was at the request of another user (who prompted the creation of the file), and that was what he wanted it to say.

The message about being linear in the arbitrary constant can be individually controlled, but not the two you mention.

You could modify the error message using a post-filter, as in:

    ANS($f->cmp->withPostFilter(sub { my$ansHash = shift;
$ansHash->{ans_message} = "Did you forget the arbitrary constant?" if$ansHash->{ans_message} eq "Note: there is always more than one possibility";
return $ansHash; }));  I don't know if that constitutes "fancy coding" or not. If it is something you want to do a lot, you could make a macro file that contains the subroutine, say $MISSING_CONSTANT = sub {
my $ansHash = shift;$ansHash->{ans_message} = "Did you forget the arbitrary constant?"
if $ansHash->{ans_message} eq "Note: there is always more than one possibility"; return$ansHash;
};

and then use it in the problem as
    ANS($f->cmp->withPostFilter($MISSING_CONSTANT));

Hope that helps.

Davide

### Re: parserFormulaUpToConstant messages

by Louis Zulli -
Thanks, Davide.

What I don't want to do is edit existing .pg files individually to achieve the desired result.

I can certainly modify our local copy of your macro, I suppose.

I'm curious to hear what others think of the current behavior. I think I agree with my colleague: if the formula is simply incorrect, then whether or not it includes a +C is not the really the issue. Once the student has a correct formula, then the issue of the +C is central. In that case, the message about a lack of generality in the answer seems just right.

Thanks again for the swift reply.

### Re: parserFormulaUpToConstant messages

by Brittni Lorton -
I would like to revise this discussion again.

I am seeing the same issue as Louis did here in 2013.

Is there talk of fixing the message in this macro entirely so that we don't have to include a post-filter in all our problems that use FormulaUpToConstant?

The message "Note: there is always more than one possibility" shows up when a student enters an incorrect antiderivative and that can be misleading, they should just get marked incorrect.

Ideally I think the message "Note: there is always more than one possibility" should be entirely removed because when a student gets the correct antiderivative but misses the +C they already get the message "your answer is not the most general solution".

Thoughts?

Brittni