code: def is_invertible(polynomial, threshold=1 - 1e-10):
      r"""
      Determine if a polynomial is invertible.
  
      Requires all roots of the polynomial lie inside the unit circle.
  
      Parameters
      ----------
      polynomial : array_like or tuple, list
          Coefficients of a polynomial, in order of increasing degree.
          For example, `polynomial=[1, -0.5]` corresponds to the polynomial
          :math:`1 - 0.5x` which has root :math:`2`. If it is a matrix
          polynomial (in which case the coefficients are coefficient matrices),
          a tuple or list of matrices should be passed.
      threshold : number
          Allowed threshold for `is_invertible` to return True. Default is 1.
  
      See Also
      --------
      companion_matrix
  
      Notes
      -----
  
      If the coefficients provided are scalars :math:`(c_0, c_1, \dots, c_n)`,
      then the corresponding polynomial is :math:`c_0 + c_1 L + \dots + c_n L^n`.
  
  
      If the coefficients provided are matrices :math:`(C_0, C_1, \dots, C_n)`,
      then the corresponding polynomial is :math:`C_0 + C_1 L + \dots + C_n L^n`.
  
      There are three equivalent methods of determining if the polynomial
      represented by the coefficients is invertible:
  
      The first method factorizes the polynomial into:
  
      .. math::
  
          C(L) & = c_0 + c_1 L + \dots + c_n L^n \\
               & = constant (1 - \lambda_1 L)
                   (1 - \lambda_2 L) \dots (1 - \lambda_n L)
  
      In order for :math:`C(L)` to be invertible, it must be that each factor
      :math:`(1 - \lambda_i L)` is invertible; the condition is then that
      :math:`|\lambda_i| < 1`, where :math:`\lambda_i` is a root of the
      polynomial.
  
      The second method factorizes the polynomial into:
  
      .. math::
  
          C(L) & = c_0 + c_1 L + \dots + c_n L^n \\
               & = constant (L - \zeta_1) (L - \zeta_2) \dots (L - \zeta_3)
  
      The condition is now :math:`|\zeta_i| > 1`, where :math:`\zeta_i` is a root
      of the polynomial with reversed coefficients and
      :math:`\lambda_i = \frac{1}{\zeta_i}`.
  
      Finally, a companion matrix can be formed using the coefficients of the
      polynomial. Then the eigenvalues of that matrix give the roots of the
      polynomial. This last method is the one actually used.
      """
      # First method:
      # np.all(np.abs(np.roots(np.r_[1, params])) < 1)
      # Second method:
      # np.all(np.abs(np.roots(np.r_[1, params][::-1])) > 1)
      # Final method:
      eigvals = np.linalg.eigvals(companion_matrix(polynomial))
      return np.all(np.abs(eigvals) < threshold)
  
imports: import numpy
  from scipy.linalg import solve_sylvester
  import pandas
  from statsmodels.compat.pandas import Appender
  from statsmodels.tools.data import _is_using_pandas
  from scipy.linalg.blas import find_best_blas_type
  from .None import _initialization, _representation, _kalman_filter, _kalman_smoother, _simulation_smoother, _cfa_simulation_smoother, _tools
label_desc: Use image node_id 5 for calling a global function with example usage: is_invertible(polynomial, threshold) and returns: np