Cody

Solution 29518

Submitted on 5 Feb 2012 by Roger Stafford
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))
P = 0.5859 0.4844 L = 0.5714 0.4286
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))
P = 0.8084 0.3878 L = 0.5385 0.4615
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))
P = 0.6522 0.3588 L = 0.6451 0.3549
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))
P = 0.6664 0.3376 L = 0.6639 0.3361
5   Pass
%% [P,L] = my_spiral(3,eps); assert(all(abs(L-[1/2,1/2])<100*eps))
P = 1.0000 1.0000 L = 0.5000 0.5000
6   Pass
%% [P,L] = my_spiral(2,1-eps); assert(all(abs(L-[2/3,1/3])<100*eps))
P = 1.0000 1.0000 L = 0.6667 0.3333