Hi David,
I can't think of any changes that would make this start giving different answers. I've just checked out the last version of the code from 2017 and it gives the same answers.
I don't get just a real part for root(-4,3); I get 0.793700526 + 1.374729637*i.
The 'root' function returns the principal root, which means that root(x,n) is equivalent to x^(1/n). I think it's reasonable that it should return the real root, if there is one.
I've changed root(x,n) to return the negative real root if x is real and x<0.
I'm getting strange results when trying to take the cube root of a negative numbers, test case below.
When I use root(negative_cubic_number,3) Numbas appears to be returning the first complex root
root(-1,3) = 0.5 + 0.86i when I would only be interested in the real one eg -1.
On top of this however, if the question doesn't use a cubic number then it only returns the real part of the first complex root
root(-4,3) = 0.79
Is there any reason why this could only have happened recently? I ask as the full question I have is part of SCORM test that has deployed without this issue for 4 years. Whilst there is only a 1.4% chance of the question returning a negative to deal with, I'd estimate that in the region of 1000 students could have attempted this question over that period but errors have only surfaced in the last month.
--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/b81f20a3-2b9b-4f3f-87c2-4ec8560e308an%40googlegroups.com.