Cody

# Problem 1908. Equilibrium

Solution 439368

Submitted on 7 May 2014 by Alfonso Nieto-Castanon
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
%% x = [0 0.6]; assert(isequal(equilibrium(x),false))

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

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

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

5   Pass
%% 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))

6   Pass
%% 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))

7   Pass
%% 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))

8   Pass
%% 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))

9   Pass
%% 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))

10   Pass
%% 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))

11   Pass
%% 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));

12   Pass
%% 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));

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

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

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

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

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!