Cody

# Problem 42987. Roots of a quadratic equation.

Solution 2656682

Submitted on 6 Jul 2020
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(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

Error using roots Too many input arguments. Error in quadRoots (line 2) y = roots(a,b, c ) ; Error in Test1 (line 5) assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

2   Fail
a=1; b=-5; c=6; y_correct = [2 3]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

Error using roots Too many input arguments. Error in quadRoots (line 2) y = roots(a,b, c ) ; Error in Test2 (line 5) assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

3   Fail
a=1; b=5; c=6; y_correct = [-3 -2]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

Error using roots Too many input arguments. Error in quadRoots (line 2) y = roots(a,b, c ) ; Error in Test3 (line 5) assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

4   Fail
a=2; b=10; c=12; y_correct = [-3 -2]; assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

Error using roots Too many input arguments. Error in quadRoots (line 2) y = roots(a,b, c ) ; Error in Test4 (line 5) assert(norm(quadRoots(a,b,c)-y_correct) < 10*eps)

5   Fail
a=1; b=19; c=90; y_correct = [-10 -9]; assert(norm(quadRoots(a,b,c)-y_correct) < 100*eps)

Error using roots Too many input arguments. Error in quadRoots (line 2) y = roots(a,b, c ) ; Error in Test5 (line 5) assert(norm(quadRoots(a,b,c)-y_correct) < 100*eps)