Cody

Solution 30690

Submitted on 6 Feb 2012 by Martijn
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
%% [P,L] = my_spiral(20,1/2); assert(all(abs(P-[0.5859375,0.484375])<100*eps)) assert(all(abs(L-[0.571428571428571,0.428571428571429])<100*eps))

x = 0 1 1 1 1 0 0 0

2   Pass
%% [P,L] = my_spiral(11,2/7); assert(all(abs(P-[0.80841316118284,0.387755102040816])<100*eps)) assert(all(abs(L-[0.538461538461538,0.461538461538462])<100*eps))

x = 0 1 1 1 1 0 0 0

3   Pass
%% [P,L] = my_spiral(88,9999/11111); assert(all(abs(P-[0.652150333541218,0.358838287231673])<100*eps)) assert(all(abs(L-[0.645144433154304,0.354855566845696])<100*eps))

x = 0 1 1 1 1 0 0 0

4   Pass
%% [P,L] = my_spiral(901,987654/1000000); assert(all(abs(P-[0.666383724185262,0.337637121736288])<100*eps)) assert(all(abs(L-[0.663934355482405,0.336065644517595])<100*eps))

x = 0 1 1 1 1 0 0 0

5   Pass
%% [P,L] = my_spiral(3,eps); assert(all(abs(L-[1/2,1/2])<100*eps))

x = 0 1 1 1 1 0 0 0

6   Pass
%% [P,L] = my_spiral(2,1-eps); assert(all(abs(L-[2/3,1/3])<100*eps))

x = 0 1 1 1 1 0 0 0

Suggested Problems

More from this Author6