Cody

Solution 671922

Submitted on 19 May 2015
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
%% N = 2; K = 7; assert(abs(sum_reciprocals(N,K)-2.01554407485016762)<1e-8)

j = 1 2 3 4 5 6 8 9 ans = 2.0155

Output argument "output" (and maybe others) not assigned during call to "sum_reciprocals".

2   Fail
%% N = 5; K = 7; assert(abs(sum_reciprocals(N,K)-1.440856832360981609753)<1e-8)

j = 1 2 3 4 5 6 8 9 ans = 1.4409

Output argument "output" (and maybe others) not assigned during call to "sum_reciprocals".

3   Fail
%% N = 8; K = 9; assert(abs(sum_reciprocals(N,K)-1.0714523172876426748)<1e-8)

j = 1 2 3 4 5 6 7 8 ans = 1.0715

Output argument "output" (and maybe others) not assigned during call to "sum_reciprocals".

4   Fail
%% N = 2:8; K = 9; M = arrayfun(@(x)sum_reciprocals(x,K),N); R = spline(N,M,[3.3 5.93]); assert(all(abs(R-[1.7588093884770861, 1.3325666476222477463])<1e-8))

j = 1 2 3 4 5 6 7 8 ans = 2.0540

Output argument "output" (and maybe others) not assigned during call to "sum_reciprocals".

Suggested Problems

More from this Author1