There are problems that arise naturally in, say, differential equations, in which the solution is an equation in a form such as "f(x,y)=0" or "f(x,y,z)=C", where the left-hand-side is only determined up to a constant multiple, and we would like the student to enter it. However, 0 is always such a constant multiple, and it should specifically be disallowed.

I'm trying to use adaptive parameters. I don't really want an adaptive parameter to show up in the correct answer, since it might be confusing to the student, and I would prefer to have an answer evaluator that anyone could simply drop into a problem and use without having to modify it or figure out how it works. Ideally it shouldn't be restricted to using a fixed set of variables either.

I've tried things like the following:

` Context("Numeric")->variables->add(y=>'Real',z=>'Real');`

BEGIN_TEXT

problem text

END_TEXT

$ans = Formula("x+y+z");#or any constant multiple

ANS($ans->cmp(checker=>~~&mychecker));

sub mychecker{

my ($correct, $student, $ans)=@_;

#

# **add an adaptive parameter "a" to the context**

#

$correct=Formula("a*$correct");

return 0 if Formula("$student") == Formula("0"); #don't allow student to enter 0

return $correct == Formula("$student");

}

The question is: how do I add the adaptive parameter to the context? The obvious thing (Context()->variables->add(a=>'Parameter')) doesn't seem to work for me. The only success I've had is by creating a new context inside the answer evaluator, e.g.,

` my $newcontext = Context("Numeric");`

$newcontext->variables->add(y=>'Real',z=>'Real',a=>'Parameter');

Note that this means I had to re-add the variables y and z. If an instructor used a different set of variables, the answer evaluator would need to be modified.

If I understood what was going on here, I think I would understand contexts a lot better.

Thanks,

Bob Byerly