Cody

Solution 1973774

Submitted on 13 Oct 2019 by Nikolaos Nikolaou
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   Pass
a=1; b=3; c=3; d=1; y_correct = [-1 -1 -1]; assert(sum(abs(cubicRoots(a,b,c,d)-y_correct))<1e-3)

y = -1.0000 - 0.0000i -1.0000 + 0.0000i -1.0000 + 0.0000i

2   Pass
a=1; b=-6; c=11; d=-6; y_correct = [1 2 3]; assert(sum(abs(cubicRoots(a,b,c,d)-y_correct))<1e-3)

y = 1.0000 2.0000 3.0000

3   Pass
a=4; b=4; c=-1; d=-1; y_correct = [-1 -0.5 0.5]; assert(sum(abs(cubicRoots(a,b,c,d)-y_correct))<1e-3)

y = -1.0000 -0.5000 0.5000

Suggested Problems

More from this Author9