Algorithm 1:Determining stability of system \mathbf{\dot{x} }= A \mathbf{x} + \mathbf{g(x)}
1:
if system is linear, i.e. \mathbf{\dot{x} }= A \mathbf{x} then
2: determine eigenvalues \lambda _i of A by solving |A-\lambda I|=0
3: if all eigenvalues have real part smaller than zero then
4: return stable
5: else
6: if at least one eigenvalue have positive real part then
7: return not stable
8: else \triangleright we get here if at least one \lambda has zero real part
9: for all \lambda _i with zero real part do
10: M =\text{multiplicity of $\lambda _i$}
11: N =\text{number of linearly independent eigenvectors that $\lambda _i$ can generate}
12: if N<M then
13: return not stable
14: end if
15: end for
16: return stable
17: end if
18: end if
19: else \triangleright system not linear
20: will only consider case when origin is equilibrium point
21: determine the Jacobian matrix J
22: evaluate J at origin \mathbf{x}= \mathbf{0}
23: determine eigenvalues \lambda _i of J by solving |J-\lambda I|=0
24: if all eigenvalues have real part smaller than zero then
25: return stable
26: else
27: if at least one eigenvalue have positive real part then
28: return not stable
29: else \triangleright we get here if at least one \lambda has zero real part
30: return unable to decide
31: end if
32: end if
33: end if