WeBWorK Main Forum

Turning off 'Messages' in Answer Checker

Turning off 'Messages' in Answer Checker

by Spyro Roubos -
Number of replies: 1
I am having difficulties with a Calculus I question:

Given a function, I ask the student:

On what interval(s) is the function increasing: ____?

On what interval(s) is the function decreasing: ____?

-where "NA" can be entered if there is no such interval of one type.

The issue is as follows:
(say the correct answer to the first blank is "(-inf,inf)" and the second is "NA"). If the student enters: "(1,2)" for the first blank, s/he receives the message "Your left endpoint is incorrect, Your right endpoint is incorrect". However, if the student enters "(1,2)" for the second blank, the answer checker is expecting to compare a string and will gives no message.

There is an added ambiguity in the situation of a student entering "(1,2) U (4,5)" in either blank, which also results in no message.

Is there a way of turning off messages? -or an easy way of editing the messages?

Here is the code:
---------------------------------------------------------
DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
# "PGcourse.pl",
"source.pl",
);

$showPartialCorrectAnswers = 1;

Context("Interval");
Context()->strings->add(NA=>{}, "Not Applicable"=>{alias=>'NA'});

$aa = non_zero_random(-10,10,1);

$Funct = Formula("e^x/($aa + e^x)");
$Deriv = $Funct->D;

if($aa > 0) {
$Interv1 = Interval("(-INF,INF)");
$Interv2 = String("NA"); }
else {
$Interv1 = String("NA");
$Interv2 = Interval("(-INF,log(-$aa))U(log(-$aa),INF)"); }

TEXT(beginproblem());

Context()->texStrings;
BEGIN_TEXT
Consider the function
\[f(x)=\frac{e^x}{$aa + e^x}\]
$BR

Then \(f'(x)\) = \{ ans_rule()\}
$PAR
The interval of increase for \(f(x)\) is: \{ ans_rule()\}
$PAR
The interval of decrease for \(f(x)\) is: \{ ans_rule()\}
$PAR

END_TEXT

ANS($Deriv->cmp);
ANS($Interv1->cmp(typeMatch=>Value::Interval));
ANS($Interv2->cmp(typeMatch=>Value::Interval));

ENDDOCUMENT();
-----------------------------------------------
Thanks,
Spyro Roubos
In reply to Spyro Roubos

Re: Turning off 'Messages' in Answer Checker

by Davide Cervone -
You can prevent the Interval checker from issuing its message by adding
      showEndpointHints => 0, showEndTypeHints => 0
to your cmp() calls.

In order to edit the messages you would need to install a post filter to the answer checker. (There is also another way to do it that uses a mechanism intended for allowing the error messages to be translated into another language. That could be used to convert the message to another form or to a blank message, but the *Hints flags above are probably your best choice.)

Davide