Cody

# Problem 2510. Solving Quadratic Equations (Version 1)

Solution 1222238

Submitted on 28 Jun 2017
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
qe_correct1_1 = -1; qe_correct1_2 = -2; [qe_result1_1, qe_result1_2] = SolveQuadraticEquation(1, 3, 2); assert( (abs(qe_result1_1 - qe_correct1_1) < 0.0001 && ... abs(qe_result1_2 - qe_correct1_2) < 0.0001) || ... (abs(qe_result1_1 - qe_correct1_2) < 0.0001 && ... abs(qe_result1_2 - qe_correct1_1) < 0.0001) );

Error using roots Too many output arguments. Error in SolveQuadraticEquation (line 2) [x2, x1]=roots([a, b, c]) Error in TestPoint1 (line 3) [qe_result1_1, qe_result1_2] = SolveQuadraticEquation(1, 3, 2);

2   Fail
qe_correct2_1 = 0.224745; qe_correct2_2 = -2.22474; [qe_result2_1, qe_result2_2] = SolveQuadraticEquation(2, 4, -1); assert( (abs(qe_result2_1 - qe_correct2_1) < 0.0001 && ... abs(qe_result2_2 - qe_correct2_2) < 0.0001) || ... (abs(qe_result2_1 - qe_correct2_2) < 0.0001 && ... abs(qe_result2_2 - qe_correct2_1) < 0.0001) );

Error using roots Too many output arguments. Error in SolveQuadraticEquation (line 2) [x2, x1]=roots([a, b, c]) Error in TestPoint2 (line 3) [qe_result2_1, qe_result2_2] = SolveQuadraticEquation(2, 4, -1);

3   Fail
qe_correct3_1 = -1; qe_correct3_2 = -1; [qe_result3_1, qe_result3_2] = SolveQuadraticEquation(2, 4, 2); assert( (abs(qe_result3_1 - qe_correct3_1) < 0.0001 && ... abs(qe_result3_2 - qe_correct3_2) < 0.0001) || ... (abs(qe_result3_1 - qe_correct3_2) < 0.0001 && ... abs(qe_result3_2 - qe_correct3_1) < 0.0001) );

Error using roots Too many output arguments. Error in SolveQuadraticEquation (line 2) [x2, x1]=roots([a, b, c]) Error in TestPoint3 (line 3) [qe_result3_1, qe_result3_2] = SolveQuadraticEquation(2, 4, 2);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!