Cody

# Problem 42808. Sum of logarithms

Solution 2067743

Submitted on 23 Dec 2019 by Asif Newaz
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)

s = 0 s = 0.3010

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

s = 0 s = 0.3010 s = 0.7782 s = 1.3802 s = 2.0792 s = 2.8573 s = 3.7024 s = 4.6055 s = 5.5598 s = 6.5598 s = 7.6012 s = 8.6803 s = 9.7943 s = 10.9404 s = 12.1165 s = 13.3206 s = 14.5511 s = 15.8063 s = 17.0851 s = 18.3861

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

s = 0.4971 s = 1.1961 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)

s = 0 s = 0 s = 0.3010 s = 0.7782 s = 1.4771 s = 2.3802 s = 3.4942 s = 4.8164

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

s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0 s = 0

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

s = 0.9542 s = 2.0334 s = 3.2095 s = 4.4648 s = 5.7870 s = 7.1672 s = 8.5986 s = 10.0757 s = 11.5942 s = 13.1505 s = 14.7416 s = 16.3648 s = 18.0180 s = 19.6993 s = 21.4069 s = 23.1393 s = 24.8951 s = 26.6733 s = 28.4726 s = 30.2922 s = 32.1310 s = 33.9883 s = 35.8634 s = 37.7555 s = 39.6640 s = 41.5883 s = 43.5278 s = 45.4820 s = 47.4505 s = 49.4328 s = 51.4284

7   Pass