Cody

# Problem 42518. Roots of quadratic equation

Solution 1997917

Submitted on 31 Oct 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
a = 1; b = 2; c = 1; y_correct = [-1 -1]; assert(sum(abs(roots(a,b,c)-y_correct))<1e-3)

p = 1 2 1

Not enough input arguments. Error in roots (line 2) p=[a,b,c] Error in roots (line 3) y=roots(p) Error in Test1 (line 5) assert(sum(abs(roots(a,b,c)-y_correct))<1e-3)

2   Fail
a = 9; b = 42; c = 5; y_correct = [-4.5444 -0.1223]; assert(sum(abs(roots(a,b,c)-y_correct))<1e-3)

p = 9 42 5

Not enough input arguments. Error in roots (line 2) p=[a,b,c] Error in roots (line 3) y=roots(p) Error in Test2 (line 5) assert(sum(abs(roots(a,b,c)-y_correct))<1e-3)

3   Fail
a = 10; b = 42; c = 7; y_correct = [-4.0261 -0.1739]; assert(sum(abs(roots(a,b,c)-y_correct))<1e-3)

p = 10 42 7

Not enough input arguments. Error in roots (line 2) p=[a,b,c] Error in roots (line 3) y=roots(p) Error in Test3 (line 5) assert(sum(abs(roots(a,b,c)-y_correct))<1e-3)