Cody

Solution 551858

Submitted on 3 Jan 2015 by Andrei Bobrov
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
%% Tests whether you have used det() assert(isempty(regexpi(evalc('type det2'),'det *(')))

2   Pass
%% A = 23; abserr=abs(det(A)-det2(A)); relerr=abserr/abs(det(A)); assert(abserr<1e-10 | relerr<1e-10)

3   Pass
%% A = magic(2); abserr=abs(det(A)-det2(A)); relerr=abserr/abs(det(A)); assert(abserr<1e-10 | relerr<1e-10)

[Warning: Principal matrix logarithm is not defined for A with nonpositive real eigenvalues. A non-principal matrix logarithm is returned.] [> In funm at 163 In logm at 24 In det2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

4   Pass
%% A = magic(5); abserr=abs(det(A)-det2(A)); relerr=abserr/abs(det(A)); assert(abserr<1e-10 | relerr<1e-10)

[Warning: Principal matrix logarithm is not defined for A with nonpositive real eigenvalues. A non-principal matrix logarithm is returned.] [> In funm at 163 In logm at 24 In det2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]

5   Pass
%% A = hilb(4); abserr=abs(det(A)-det2(A)); relerr=abserr/abs(det(A)); assert(abserr<1e-10 | relerr<1e-10)

6   Pass
%% A = [10 7 2 9; 10 1 1 8; 7 10 1 10; 3 7 6 7]; abserr=abs(det(A)-det2(A)); relerr=abserr/abs(det(A)); assert(abserr<1e-10 | relerr<1e-10)

7   Pass
%% A = [6 8 5 8 8 8 9 5; 3 8 3 8 8 5 1 3; 6 4 4 3 6 3 3 8; 6 4 1 3 3 3 7 8; 6 3 5 3 4 8 6 9; 5 7 4 7 5 6 4 3; 1 4 9 9 1 4 6 9; 7 1 5 6 4 1 1 1]; abserr=abs(det(A)-det2(A)); relerr=abserr/abs(det(A)); assert(abserr<1e-10 | relerr<1e-10)

[Warning: Principal matrix logarithm is not defined for A with nonpositive real eigenvalues. A non-principal matrix logarithm is returned.] [> In funm at 163 In logm at 24 In det2 at 2 In verifyCode>evaluateCode at 238 In verifyCode at 43 In fevalJSON at 14]