## WeBWorK Problems

### Simplified radical in complex context ### Simplified radical in complex context

by Brittni Lorton -
Number of replies: 2

I am working on a problem where a student needs to simplify various radicals. I would like a student to be given sqrt(-48) and they would need to enter 4sqrt(3)i only, and not sqrt(48)i.

I may be overthinking this but I am attempting to use both LimitedRadical Context and Complex Context and I cannot seem to get it right. Here is the current code. Any ideas?

DOCUMENT();

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"contextFraction.pl",

"PGcourse.pl",

"parserRoot.pl",

"contextLimitedComplex.pl"

);

######################################

Context("Numeric");

$a1 = random(2,7,1);$a2 = random(2,7,1);

$a3 = random(2,7,1);$nsqa1 = -$a1*$a1;

$nsqa2 = -$a2*$a2;$m2 = list_random(2,3);

$b =$nsqa2*$m2;$nsqa3 = -$a3*$a3;

$m3 = list_random(4,5);$c = $nsqa3*$m3;

$rad2 = Formula("$a2*sqrt($m2)");$rad3 = Formula("$a3*sqrt($m3)");

Context("Complex");

$ans2 = Complex("$rad2 i");

$ans3 = Complex("$rad3 i");

Context("LimitedComplex-strict");

$ans1 = Complex("$a1 i");

BEGIN_PGML

Simplify the following expressions.

a. [\sqrt{[$nsqa1]} = ][_______________]{$ans1}

b. [\sqrt{[$b]} = ][_______________]{$ans2}

c. [\sqrt{[$c]} = ][_______________]{$ans3}

END_PGML ### Re: Simplified radical in complex context

by Alex Jordan -

There is also contextLimitedRadicalComplex.pl in the PCC folder of the OPL macros. After loading that, you can have like: 