Cody

# Problem 1908. Equilibrium

Solution 1220744

Submitted on 26 Jun 2017
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
x = [0 0.6]; assert(isequal(equilibrium(x),false))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint1 (line 2) assert(isequal(equilibrium(x),false))

2   Fail
x = [0 0.4]; assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint2 (line 2) assert(isequal(equilibrium(x),true))

3   Fail
x = [0 1.5 0.6]; assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint3 (line 2) assert(isequal(equilibrium(x),true))

4   Fail
x = cumsum(fliplr(1./(1:16))/2); assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint4 (line 2) assert(isequal(equilibrium(x),true))

5   Fail
x = [1.5 2.5 1 0.25 5.5 3.5 -1.5 -0.25 -4 -1.75 6.25 -1.25 0.5 1 -0.5 4.75 -1.25 -1.5 0.5 1.5]; assert(isequal(equilibrium(x),false))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint5 (line 2) assert(isequal(equilibrium(x),false))

6   Fail
x = [-1.5 -0.25 -0.25 -1.75 1.75 -2 -5.25 2.25 0.75 -0 0.25 0 -1 -1.5 4.75 -1 4.75 -2.5 3.25 -1]; assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint6 (line 2) assert(isequal(equilibrium(x),true))

7   Fail
x = [1.25 -1.75 -0.75 2.75 -1.5 3.75 1.75 1.5 -0.25 -4 -0.5 -2 1.75 -3.5 -2 -3.75 0 -1.75 1.75 3.25 -1.5 -0.5 1.25 -2 1.5 3 -0.25 1.75 -0.5 2.75 0.5 -4.25 1.5 5.5 3 4.25 2.75 -0.75 0.5 3 3.5 3.25 1.75 1.5 3.25 2.5 5.5 -2 -3.75 -1 5 0.25 -3.75 5.5 1.75 2 1.75 0.5 -3.75 1.5 -0 2 0.5 0 -0.25 0.25 -9 1.75 -3.75 1.25 -3.75 -0 1.75 3.5 -3.75 3.75 -5.75 1.25 3.5 1.5 -2 2 -2.5 -1.5 3 1.75 -1.5 3.25 1.75 -1.5 1.25 -2.5 1.25 -4.25 3.25 -2.5 1.75 1.75 7.25 3.5]; assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint7 (line 2) assert(isequal(equilibrium(x),true))

8   Fail
x = [-0.5 1.5 3.5 0.5 -5.75 2 -1.5 0.25 -0.25 -3 -0.25 3 -3.5 -4.5 1.75 -0.25 0.75 3 0.25 -2.5 2.25 -0.25 1.75 -1.5 -5 -0 -0.5 -2 -0 4.75 -0 2 3.5 1.5 -2.25 3.5 -0.5 4.5 2.5 0.5 1.75 3.5 -0 -2.25 -0.25 -4.75 -2.5 -0.75 -6 2.75 -5 2.25 1 -2.25 -0.75 -0.25 -3.5 0.75 -0 -0.5 -0.5 -1.75 -2 -0.25 -0.25 5 -0.25 -0.75 -0.25 -5 -2 -0.25 -5.5 -5 -0.5 -2 1 -0.75 2 3.25 4.5 2.25 1.25 -0.25 -0.5 -0.25 -2.5 -5 2.25 -2 7.5 6.5 2.25 -0.25 -0.5 7.25 -2.5 1 -2.5 -4.75]; assert(isequal(equilibrium(x),false))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint8 (line 2) assert(isequal(equilibrium(x),false))

9   Fail
x = [0.1 0.1 -4.6 -0.4 -1.5 1.6 3 2.7 2.3 -2.7 0.1 -1.7 0 4.4 3.8 -0.4 -2 -0.6 3.3 2.5 -3 -1.7 3.1 2.7 2.7 3.1 -0.4 1.1 -0.2 -0.1 -0.3 2.7]; assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint9 (line 2) assert(isequal(equilibrium(x),true))

10   Fail
x = [0.1 0.1 -4.6 -0.4 -1.5 1.6 3 2.7 2.3 -2.7 0.1 -1.7 0 4.4 3.8 -0.4 -2 -0.6 3.3 2.5 -3 -1.7 3.1 2.7 2.7 3.1 -0.4 1.1 -0.2 -0.1 -0.3 2.7 -1.8 2.3]; assert(isequal(equilibrium(x),false))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint10 (line 2) assert(isequal(equilibrium(x),false))

11   Fail
x = [-3.5 2.6 -0.7 -1.1 -2.6 -2 0.8 -0.7 2.7 0.4 -5 3.7 -1.2 -1.3 2.8 0.8 -1.5 -1.8 0 -0 4.8 -1.4 -1.2 -1.5 1 0.2 2.6 1.7 1.6 -1.3 2.1 -1.5 -1.4 2 0.1 -0.1 -0.1 4.6 -3 -0.3 0.2 -1.9 -0 0.1 0 2.1 -1.7 -3.1 -0 0.2 -0.1 -0.5 4.7 -1.8 -0.1 -2.2]; assert(isequal(equilibrium(x),false));

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint11 (line 2) assert(isequal(equilibrium(x),false));

12   Fail
x = [-2.5 2.6 -0.7 -1.1 -2.6 -2 0.8 -0.7 2.7 0.4 -5 3.7 -1.2 -1.3 2.8 0.8 -1.5 -1.8 0 -0 4.8 -1.4 -1.2 -1.5 1 0.2 2.6 1.7 1.6 -1.3 2.1 -1.5 -1.4 2 0.1 -0.1 -0.1 4.6 -3 -0.3 0.2 -1.9 -0 0.1 0 2.1 -1.7 -3.1 -0 0.2 -0.1 -0.5 4.7 -1.8 -0.1 -2.2]; assert(isequal(equilibrium(x),true));

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint12 (line 2) assert(isequal(equilibrium(x),true));

13   Fail
x =[0 .9 -.9 zeros(1,8)]; assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint13 (line 2) assert(isequal(equilibrium(x),true))

14   Fail
x =[0 .9 -.9 zeros(1,6)]; assert(isequal(equilibrium(x),false))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint14 (line 2) assert(isequal(equilibrium(x),false))

15   Fail
x = repmat([0 .7 -.7 0],1,2); assert(isequal(equilibrium(x),false))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint15 (line 2) assert(isequal(equilibrium(x),false))

16   Fail
x = repmat([0 .6 -.6 0],1,2); assert(isequal(equilibrium(x),true))

Error using arrayfun matlab.graphics.primitive.Patch output type is not supported. Set 'UniformOutput' to false. Error in equilibrium (line 5) h=arrayfun(@(x,y)patch(x+[0,1,1,0],y+[0,0,1,1],rand(1,3)),x,y); Error in TestPoint16 (line 2) assert(isequal(equilibrium(x),true))