Cody

Solution 1992258

Submitted on 27 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
x = rand(2,2,2); y = neg2(neg2(x)); y_correct = -x; assert(isequal(y,y_correct))

y(:,:,1) = 0.6634 0.0917 0.7940 0.4603 y(:,:,2) = 0.8723 0.7680 0.6383 0.4553 y(:,:,1) = 0.6634 0.0917 0.7940 0.4603 y(:,:,2) = 0.8723 0.7680 0.6383 0.4553

Assertion failed.

2   Pass
x = []; y = neg2(neg2(x)); y_correct = -x; assert(isequal(y,y_correct))

y = [] y = []

3   Fail
x = sqrt(-5); y = neg2(neg2(x)); y_correct = -x; assert(isequal(y,y_correct))

y = 0.0000 + 2.2361i y = 0.0000 + 2.2361i

Assertion failed.

4   Pass
x = rand; disp(neg2(x))

y = 0.2194 0.2194