code: def chebcompanion(c):
      """Return the scaled companion matrix of c.
  
      The basis polynomials are scaled so that the companion matrix is
      symmetric when `c` is a Chebyshev basis polynomial. This provides
      better eigenvalue estimates than the unscaled case and for basis
      polynomials the eigenvalues are guaranteed to be real if
      `numpy.linalg.eigvalsh` is used to obtain them.
  
      Parameters
      ----------
      c : array_like
          1-D array of Chebyshev series coefficients ordered from low to high
          degree.
  
      Returns
      -------
      mat : ndarray
          Scaled companion matrix of dimensions (deg, deg).
  
      Notes
      -----
  
      .. versionadded:: 1.7.0
  
      """
      # c is a trimmed copy
      [c] = pu.as_series([c])
      if len(c) < 2:
          raise ValueError(
              "Series must have maximum degree of at least 1."
          )
      if len(c) == 2:
          return np.array([[-c[0] / c[1]]])
  
      n = len(c) - 1
      mat = np.zeros((n, n), dtype=c.dtype)
      scl = np.array([1.0] + [np.sqrt(0.5)] * (n - 1))
      top = mat.reshape(-1)[1 :: n + 1]
      bot = mat.reshape(-1)[n :: n + 1]
      top[0] = np.sqrt(0.5)
      top[1:] = 1 / 2
      bot[...] = top
      mat[:, -1] -= (c[:-1] / c[-1]) * (scl / scl[-1]) * 0.5
      return mat
  
imports: from __future__ import division, absolute_import, print_function
  import warnings
  import numpy
  import numpy.linalg
  from numpy.core.multiarray import normalize_axis_index
  from .None import polyutils
  from ._polybase import ABCPolyBase
label_desc: Use image node_id 28 for calling a global function with example usage: chebcompanion(c) and returns: mat, np