Closed pvskand closed 8 years ago
Woah, strange. I'm not sure how I managed to mis-type that test. I believe the answer to x^3 - 3x^2 + 3x - 1 = 0 is x = 1 and the answer to x^3 - 3x^2 + 3x - 16 = 0 is x = 1 + cuberoot(15) or 3.466 as you said. Please write a PR to fix this if you've already figured it out!
@nicolewhite okay! I am on it already!
I think there is some problem in solving the cubic equations (Also mentioned in issue #50 ). So I had changed the code of finding the roots to a cubic equation, but when I ran
npm test
, I had found some error and later after seeing the code I found that the test cases are wrong (I think so!).Line : 301 of equation-spec.js : It says that the equation is x^3 - 3x^2 + 3x - 1 = 0 but according to the code
var eq = new Equation(expr, 15);
the equation should be x^3 - 3x^2 + 3x - 16 = 0 and hence the root should be 3.46621207433047 instead of 2.823108086643085.I could also find some of the test cases wherein the cubic equation wouldn't return the correct roots. I have made some changes in the cubic equation code and I ran some of my test cases and found it to be correct! Should I change the equation-spec.js?
Please correct me if I am wrong!