## WeBWorK Problems

### Transmit Complex number from Sage to WebWork

by Boxuan Zhong -
Number of replies: 0
If we have a complex number in Sage and want to evaluate it in WebWork. It will shows an error :
Variable 'I' is not defined in this context.
In sage complex number "i" is probably "I" but webwork cannot recognize I. I am not sure how to solve this problem．Thank you very much for your help!

"PGstandard.pl",
"MathObjects.pl",
"PGcourse.pl",
"sage.pl",
);

TEXT(beginproblem());
Context("Complex");

$p1 = 1+i;$SageCode1=<<END;
p1 = $p1; print p1 ### p1 is a complex number END$result = AskSage($SageCode1,{ accepted_tos=>true, });$K = Compute($result); ############################# # Main text Context()->texStrings; BEGIN_TEXT$BR
$$K =$$  \{ ans_rule(10)\}
$PAR END_TEXT Context()->normalStrings; ############################## # Answer evaluation$showPartialCorrectAnswers = 1;
ANS(\$K->cmp());

ENDDOCUMENT();