Cody

Solution 1609721

Submitted on 15 Aug 2018
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
v = [1 2]; s_correct = log10(2); assert(abs(logs(v)-s_correct)<.0001)

arr = 0 0.3010 sumi = 0 sumi = 0.3010 s = 0.3010

2   Pass
v = 1:20; s_correct = 18.3861; assert(abs(logs(v)-s_correct)<.0001)

arr = Columns 1 through 18 0 0.3010 0.4771 0.6021 0.6990 0.7782 0.8451 0.9031 0.9542 1.0000 1.0414 1.0792 1.1139 1.1461 1.1761 1.2041 1.2304 1.2553 Columns 19 through 20 1.2788 1.3010 sumi = 0 sumi = 0.3010 sumi = 0.7782 sumi = 1.3802 sumi = 2.0792 sumi = 2.8573 sumi = 3.7024 sumi = 4.6055 sumi = 5.5598 sumi = 6.5598 sumi = 7.6012 sumi = 8.6803 sumi = 9.7943 sumi = 10.9404 sumi = 12.1165 sumi = 13.3206 sumi = 14.5511 sumi = 15.8063 sumi = 17.0851 sumi = 18.3861 s = 18.3861

3   Pass
v = [pi 5 7]; s_correct = 2.0412; assert(abs(logs(v)-s_correct)<.0001)

arr = 0.4971 0.6990 0.8451 sumi = 0.4971 sumi = 1.1961 sumi = 2.0412 s = 2.0412

4   Pass
v = [1 1 2 3 5 8 13 21]; s_correct = 4.8164; assert(abs(logs(v)-s_correct)<.0001)

arr = 0 0 0.3010 0.4771 0.6990 0.9031 1.1139 1.3222 sumi = 0 sumi = 0 sumi = 0.3010 sumi = 0.7782 sumi = 1.4771 sumi = 2.3802 sumi = 3.4942 sumi = 4.8164 s = 4.8164

5   Pass
v = ones(1,400); s_correct = 0; assert(abs(logs(v)-s_correct)<.0001)

arr = Columns 1 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 31 through 60 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 61 through 90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 91 through 120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 121 through 150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 151 through 180 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 181 through 210 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 211 through 240 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 241 through 270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 271 through 300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 301 through 330 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 331 through 360 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 361 through 390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 391 through 400 0 0 0 0 0 0 0 0 0 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 sumi = 0 s = 0

6   Pass
v = 9:3:99; s_correct = 51.4284; assert(abs(logs(v)-s_correct)<.0001)

arr = Columns 1 through 18 0.9542 1.0792 1.1761 1.2553 1.3222 1.3802 1.4314 1.4771 1.5185 1.5563 1.5911 1.6232 1.6532 1.6812 1.7076 1.7324 1.7559 1.7782 Columns 19 through 31 1.7993 1.8195 1.8388 1.8573 1.8751 1.8921 1.9085 1.9243 1.9395 1.9542 1.9685 1.9823 1.9956 sumi = 0.9542 sumi = 2.0334 sumi = 3.2095 sumi = 4.4648 sumi = 5.7870 sumi = 7.1672 sumi = 8.5986 sumi = 10.0757 sumi = 11.5942 sumi = 13.1505 sumi = 14.7416 sumi = 16.3648 sumi = 18.0180 sumi = 19.6993 sumi = 21.4069 sumi = 23.1393 sumi = 24.8951 sumi = 26.6733 sumi = 28.4726 sumi = 30.2922 sumi = 32.1310 sumi = 33.9883 sumi = 35.8634 sumi = 37.7555 sumi = 39.6640 sumi = 41.5883 sumi = 43.5278 sumi = 45.4820 sumi = 47.4505 sumi = 49.4328 sumi = 51.4284 s = 51.4284

7   Fail
filetext = fileread('logs.m'); assert(isempty(strfind(filetext,'sum')))

Assertion failed.

Suggested Problems

More from this Author34