In revising some working problems that are written for rather stilted str_cmp
type answers I decided to try out contextLimitedPolynomial. I seem to have
done something quite wrong, but the warning message leaves me puzzled. In
particular, besides the error message, it gives me the answer of a number although I can't see anywhere that x is given a value.
Here is the code
#DESCRIPTION
##Type of
#ENDDESCRIPTION
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
#"PGgraphmacros.pl",
"MathObjects.pl",
# "compoundProblem.pl",
# "unionLists.pl",
#"unionMacros.pl",
"contextLimitedPolynomial.pl",
);
Context("Numeric");
Context()->variables->are(x=>'Real',y=>'Real');
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
$a = random(6,9,1);
$b = random(3,7,1);
$e=random(2,6,2);
$f=random(3,7,2);
BEGIN_TEXT
$PAR
Simplify each of the following expressions
$PAR
\(($a+$b x^2+$e x^3)($f x-12(x+1))\)= \{ans_rule(15)\}
$PAR
END_TEXT
Context("LimitedPolynomial")->flags->set(singlePowers=>1);
Context()->variables->are(x=>'Real',y=>'Real');
ANS(Formula(($a+$b*x**2+$e*x**3)*($f*x-12*(x+1)))->cmp);
ENDDOCUMENT()
Warning messages (note that line numbers no longer
correspond since I have edited out some irrelevant text The line nmber isreferred to is the answer line.
Operator or semicolon missing before *x at line 43 of (eval 154932)
Ambiguous use of * resolved as operator * at line 43 of (eval 154932)
Operator or semicolon missing before *x at line 43 of (eval 154932)
Ambiguous use of * resolved as operator * at line 43 of (eval 154932)
Operator or semicolon missing before *x at line 43 of (eval 154932)
Ambiguous use of * resolved as operator * at line 43 of (eval 154932)