WeBWorK Problems

Negative numbers inside a radical in Complex context

Re: Negative numbers inside a radical in Complex context

by Davide Cervone -
Number of replies: 0

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.