Another small issue from me today: I have a complex numbers question where I generate rec_form: -aa - bb*i and then ask students to convert this to polar form. My model answer is generated with ev(polarform(rec_form),simp), which produces answers of the form -(r*exp(i*atan(bb/aa))).
When I then use the complex_exponentialp to check whether the answer is in the correct form, it rejects this answer, because the leading operation is "-" rather than "" and there is no check for this. Simply removing the brackets and giving the answer `-rexp(iatan(bb/aa))fixes the problem (or even better, givingrexp(i*(atan(bb/aa) + pi))`), but I don't like that the brackets change the answer from correct to incorrect.
After some fiddling I came up with the solution to include the line if safe_op(ex)="-" then return(complex_exponentialp(first(ex))) after checking whether ex is real (i.e. after line 465 of assessment.mac), and this has worked fine.
I haven't made this a pull request because I'm not 100% convinced that this is a sensible approach, but it seems to work fine on the small handful of checks I ran locally. It feels vaguely correct to me that -(expr) must be in complex exponential form if and only if expr is in complex exponential form.
As an aside, is this the best place to make small suggestions/raise questions like this? I am aware I've posted lots of small issues the last couple of weeks, and I will happily move this to Zulip if that would be a better place.
Hi again,
Another small issue from me today: I have a complex numbers question where I generate
rec_form: -aa - bb*i
and then ask students to convert this to polar form. My model answer is generated withev(polarform(rec_form),simp)
, which produces answers of the form-(r*exp(i*atan(bb/aa)))
.When I then use the
complex_exponentialp
to check whether the answer is in the correct form, it rejects this answer, because the leading operation is "-" rather than "" and there is no check for this. Simply removing the brackets and giving the answer `-rexp(iatan(bb/aa))fixes the problem (or even better, giving
rexp(i*(atan(bb/aa) + pi))`), but I don't like that the brackets change the answer from correct to incorrect.After some fiddling I came up with the solution to include the line
if safe_op(ex)="-" then return(complex_exponentialp(first(ex)))
after checking whetherex
is real (i.e. after line 465 of assessment.mac), and this has worked fine.I haven't made this a pull request because I'm not 100% convinced that this is a sensible approach, but it seems to work fine on the small handful of checks I ran locally. It feels vaguely correct to me that
-(expr)
must be in complex exponential form if and only ifexpr
is in complex exponential form.As an aside, is this the best place to make small suggestions/raise questions like this? I am aware I've posted lots of small issues the last couple of weeks, and I will happily move this to Zulip if that would be a better place.