Cody

Solution 598321

Submitted on 18 Mar 2015 by Abdullah Caliskan
  • Size: 9
  • This is the leading solution.
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
%% x = rand(2,2,2); y = neg2(neg2(x)); y_correct = -x; assert(isequal(y,y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

4   Pass
%% What does a single call give? x = rand; disp(neg2(x))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In neg2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14] 1