Cody

Solution 2050410

Submitted on 8 Dec 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 = orth(randn(3)); y_correct = true; assert(isequal(isOrthogonal(x),y_correct))

x_size = 3 x = -0.3051 0.9129 0.2712 0.5088 -0.0845 0.8567 0.8050 0.3994 -0.4387 ans = -0.3051 0.5088 0.8050 0.9129 -0.0845 0.3994 0.2712 0.8567 -0.4387 ans = 1.0000 0.0000 -0.0000 0.0000 1.0000 -0.0000 -0.0000 -0.0000 1.0000 ans = 1.0000 0.0000 -0.0000 0.0000 1.0000 0.0000 -0.0000 0.0000 1.0000

Assertion failed.

2   Fail
x = orth(randn(4)); y_correct = true; assert(isequal(isOrthogonal(x),y_correct))

x_size = 4 x = -0.4715 0.6142 -0.1664 0.6105 0.0803 -0.2585 0.7974 0.5394 -0.7830 -0.6124 -0.1076 -0.0179 0.3977 -0.4254 -0.5700 0.5797 ans = -0.4715 0.0803 -0.7830 0.3977 0.6142 -0.2585 -0.6124 -0.4254 -0.1664 0.7974 -0.1076 -0.5700 0.6105 0.5394 -0.0179 0.5797 ans = 1.0000 0 -0.0000 -0.0000 0 1.0000 -0.0000 0.0000 -0.0000 -0.0000 1.0000 0.0000 -0.0000 0.0000 0.0000 1.0000 ans = 1.0000 -0.0000 0.0000 0.0000 -0.0000 1.0000 0.0000 -0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 -0.0000 0.0000 1.0000

Assertion failed.

3   Fail
x = orth(randn(5)); y_correct = true; assert(isequal(isOrthogonal(x),y_correct))

x_size = 5 x = -0.8331 -0.2965 0.2831 0.2286 -0.2926 -0.3311 0.3571 -0.0405 0.3368 0.8048 0.1969 0.6202 0.4977 0.4488 -0.3569 0.2359 -0.3886 0.7946 -0.1512 0.3728 0.3191 -0.4989 -0.1975 0.7810 0.0158 ans = -0.8331 -0.3311 0.1969 0.2359 0.3191 -0.2965 0.3571 0.6202 -0.3886 -0.4989 0.2831 -0.0405 0.4977 0.7946 -0.1975 0.2286 0.3368 0.4488 -0.1512 0.7810 -0.2926 0.8048 -0.3569 0.3728 0.0158 ans = 1.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000 1.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 1.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000 1.0000 ans = 1.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000 1.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 1.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000 1.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 1.0000

Assertion failed.

4   Pass
x=sqrt([3,1;1,1]); y_correct = false; assert(isequal(isOrthogonal(x),y_correct))

x_size = 2 x = 1.7321 1.0000 1.0000 1.0000 ans = 1.7321 1.0000 1.0000 1.0000 ans = 4.0000 2.7321 2.7321 2.0000 ans = 4.0000 2.7321 2.7321 2.0000

5   Pass
x = magic(6); y_correct = false; assert(isequal(isOrthogonal(x),y_correct))

x_size = 6 x = 35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11 ans = 35 3 31 8 30 4 1 32 9 28 5 36 6 7 2 33 34 29 26 21 22 17 12 13 19 23 27 10 14 18 24 25 20 15 16 11 ans = 2875 1762 2671 1498 2221 1294 1762 2677 1978 2113 1462 2329 2671 1978 2659 1510 2005 1498 1498 2113 1510 2551 2086 2563 2221 1462 2005 2086 2677 1870 1294 2329 1498 2563 1870 2767 ans = 3175 928 1693 2203 2143 2179 928 3211 2386 1900 1996 1900 1693 2386 3175 1693 1657 1717 2203 1900 1693 2203 2143 2179 2143 1996 1657 2143 2239 2143 2179 1900 1717 2179 2143 2203

6   Pass
x = randn(2)+1; y_correct = false; assert(isequal(isOrthogonal(x),y_correct))

x_size = 2 x = 1.3968 1.4471 1.2241 -0.7688 ans = 1.3968 1.2241 1.4471 -0.7688 ans = 4.0452 0.5973 0.5973 2.0895 ans = 3.4495 1.0802 1.0802 2.6852