Does anyone know if there is a way to modify the Complex context so that a student could not get away with sqrt(-2) when I want them to enter sqrt(2)i?
The default counts either of these as correct solutions to say, x^2=-2.
In reply to Alex Jordan
Re: Negative numbers inside a radical in Complex context
by Davide Cervone -There is a flag that can be set to prevent that:
Context("Complex");
Context()->functions->set(
sqrt => {negativeIsComplex => 0},
);
There is a similar flag for log
. You may also want to do
$context->operators->set(
'^' => {negativeIsComplex => 0},
'**' => {negativeIsComplex => 0},
);
so that you can't use (-2)^.5
either.