$context->operators->clear();
$context->operators->set("A"=>{string=>"A",TeX=>"\wedge ",perl=>"*"});
$context->operators->set("V"=>{string=>"V",TeX=>"\vee ",perl=>"+"});
to my problem I get the following error
"
an't locate object method "weaken" via package "main" at [PG]/lib/Parser/BOP.pm line 33 Died within main::Formula called at line 93 of [PG]/macros/Parser.pl from within main::Compute called at line 33 of [TMPL]/1.5/StatementEval.pg "
I've also tried using $context->operators->set(add....
but that gave me another error. Any help would be greatly appreciated. Here's the full code for the problem:
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl", "answerCustom.pl", "contextLogic.pl", "symlogic.pl"
);
TEXT(beginproblem());
$context = Context("Numeric");
$context->variables->clear();
$context->variables->add(p=>'Real');
$context->variables->add(q=>'Real');
$context->variables->{patterns} = {'[^AaVv]'};
$context->operators->clear();
$context->operators->set("A"=>{string=>"A",TeX=>"\wedge ",perl=>"*"});
$context->operators->set("V"=>{string=>"V",TeX=>"\vee ",perl=>"+"});
#$context->operators->set("~"=>{string=>"~",TeX=>"\sim",perl=>"-"},type=>"unary");
#$context->strings->{patterns}{'^.*$'} = [-20,'str'];
$context->update;
$ans = 'pAq';
$val = cos($ans);
BEGIN_TEXT
Enter a value of \(x\) for which \(\cos(x) = $val\):
\($ans = \) \{ ans_rule(25) \}
END_TEXT
$statementChecker = sub {
my ($correct, $student, $ans ) = @_;
return statementChecker($correct, $student, $ans);
};
ANS( Compute($ans)->cmp( checker=>$statementChecker) );
ENDDOCUMENT();