Cody

Solution 1816363

Submitted on 15 May 2019
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
v1 = [1 0]; v2 = [0 1]; [b1,b2] = bisectors(v1,v2); b1ok = [1 1]/sqrt(2); b2ok = [-1 1]/sqrt(2); % Tests performed t1 = (abs(norm(b1)-1)<1e-6); % Unit b1 t2 = (abs(norm(b2)-1)<1e-6); % Unit b2 t3 = (abs(b1*b2') < 1e-12); % b1 and b2 are perpendicular t4 = (abs(sum((b1-b1ok)))<1e-12); % b1 is equal to [1/sqrt(2) 1/sqrt(2)] t5 = (abs(sum((b1+b1ok)))<1e-12); % or its opposite t6 = (abs(sum((b2-b2ok)))<1e-12); % b2 is equal to [1/sqrt(2) -1/sqrt(2)] t7 = (abs(sum((b2+b2ok)))<1e-12); % or its opposite test = (t1 && t2 && t3 && xor(t4,t5) && xor(t6,t7));

Matrix dimensions must agree. Error in Test1 (line 12) t4 = (abs(sum((b1-b1ok)))<1e-12); % b1 is equal to [1/sqrt(2) 1/sqrt(2)]

2   Fail
v1 = [4 0 3]; v2 = [-2 2 1]; [b1,b2] = bisectors(v1,v2); b1ok=[0.2 1 1.4]/sqrt(3); b2ok=[2.2 -1 0.4]/sqrt(6); % Tests performed t1 = (abs(norm(b1)-1)<1e-6); % Unit b1 t2 = (abs(norm(b2)-1)<1e-6); % Unit b2 t3 = (abs(b1*b2') < 1e-12); % b1 and b2 are perpendicular t4 = (abs(sum((b1-b1ok)))<1e-12); % b1 is equal to [1/sqrt(2) 1/sqrt(2)] t5 = (abs(sum((b1+b1ok)))<1e-12); % or its opposite t6 = (abs(sum((b2-b2ok)))<1e-12); % b2 is equal to [1/sqrt(2) -1/sqrt(2)] t7 = (abs(sum((b2+b2ok)))<1e-12); % or its opposite assert(t1 && t2 && t3 && xor(t4,t5) && xor(t6,t7));

Assertion failed.