If I put it before I calculate the answers, then it won't let me use conj to calculate the answers. (error is :

Function 'conj' is not allowed in this context; see position 1 of formula at line 53 of (eval 22397) Died within main::Complex called at line 53 of (eval 22397) ) If I put the context after my calculations by before checking the answers, then WebWork allows conj(3-2i) as an answer but simply evaluates it and displays the student's answer as 3 + 2i. In this particular problem I can 'fix it' by specifically restricting the use of conj in the context, but I would like to know how to use LimitedComplex correctly. Thanks, ## DESCRIPTION ## Complex Variables ## ENDDESCRIPTION ## KEYWORDS('Complex') ## Tagged by mewaggoner ## Date('3Jul2014') ## Author('Murphy Waggoner') ## Institution('Simpson') DOCUMENT(); # This should be the first executable line in the problem. ###################################### # Preamble #"PGchoicemacros.pl", #"PGanswermacros.pl", loadMacros( "PG.pl", "PGbasicmacros.pl", "MathObjects.pl", "PGauxiliaryFunctions.pl", "PGcomplexmacros.pl", "unionLists.pl", "contextLimitedComplex.pl" ); TEXT(beginproblem()); ###################################### # Setup # if I use Context("LimitedComplex"); here the question won't compile Context("Complex"); # create four complex numbers $a = Complex( non_zero_random( -5, 5, 1 ), random( 1, 10, 1 )); $b = Complex( non_zero_random( -5, 5, 1 ), random( -10, -1, 1 )); $c = Complex( 0, non_zero_random( -5, 5, 1 )); $d = Complex( non_zero_random( -5, 5, 1 ), 0); # Create four real numbers $e = Real(non_zero_random(-5, 5, 1)); $f = Real(random(3, 7, 2)); $g = Real(non_zero_random(-5, 5, 1)); $h = Real(random(0, 9, 1)); # Create a list with the answers for checking later $answer[0] = Complex("conj($a)"); $answer[1] = Complex("conj($b)"); $answer[2] = Complex("conj($c)"); $answer[3] = Complex("conj($d)"); $answer[4] = Complex("conj($e + (1 - sqrt($f) ) i)"); $answer[5] = Complex("conj($g* i + $h)"); $num_ans = @answer; # If I put Context("LimitedComplex"); here the student can still # get the answer right by entering conj(a + bi) Context()->texStrings; BEGIN_TEXT The complex conjugate of a number \(z = a + bi\) is written with a bar over it and is \(\overline{z} = \overline{a + bi} = a - bi\). $PAR Find the complex conjugate of each of these numbers. $BR \{ BeginList('OL',type=>'a') \} $ITEM \( \overline{$a} = \) \{ans_rule(20)\} $ITEMSEP $ITEM \( \overline{$b} = \) \{ans_rule(20)\} $ITEMSEP $ITEM \( \overline{$c} = \) \{ans_rule(20)\} $ITEMSEP $ITEM \( \overline{$d} = \) \{ans_rule(20)\} $ITEMSEP $ITEM \( \overline{ $e + \left(1 - \sqrt{$f}\right)i} = \) \{ans_rule(20)\} $ITEMSEP $ITEM \( \overline{$g i + $h} = \) \{ans_rule(20)\} \{ EndList('OL') \} END_TEXT ###################################### # End game # Don't let the students enter complex functions # Context()->functions->disable('conj'); #Checking solutions for ( $n = 0; $n <= $num_ans-1; $n++ ) { ANS($answer[$n]->cmp); } #Show the students which answers were correct (...= 1) $showPartialCorrectAnswers = 1; ###################################### # Done ENDDOCUMENT(); # This should be the last executable line in the problem.