parameters: (roots)
docstring: Generate a Chebyshev series with the given roots.
  
      Return the array of coefficients for the C-series whose roots (a.k.a.
      "zeros") are given by *roots*.  The returned array of coefficients is
      ordered from lowest order "term" to highest, and zeros of multiplicity
      greater than one must be included in *roots* a number of times equal
      to their multiplicity (e.g., if `2` is a root of multiplicity three,
      then [2,2,2] must be in *roots*).
  
      Parameters
      ----------
      roots : array_like
          Sequence containing the roots.
  
      Returns
      -------
      out : ndarray
          1-d array of the C-series' coefficients, ordered from low to
          high.  If all roots are real, ``out.dtype`` is a float type;
          otherwise, ``out.dtype`` is a complex type, even if all the
          coefficients in the result are real (see Examples below).
  
      See Also
      --------
      polyfromroots
  
      Notes
      -----
      What is returned are the :math:`c_i` such that:
  
      .. math::
  
          \\sum_{i=0}^{n} c_i*T_i(x) = \\prod_{i=0}^{n} (x - roots[i])
  
      where ``n == len(roots)`` and :math:`T_i(x)` is the `i`-th Chebyshev
      (basis) polynomial over the domain `[-1,1]`.  Note that, unlike
      `polyfromroots`, due to the nature of the C-series basis set, the
      above identity *does not* imply :math:`c_n = 1` identically (see
      Examples).
  
      Examples
      --------
      >>> import numpy.polynomial.chebyshev as C
      >>> C.chebfromroots((-1,0,1)) # x^3 - x relative to the standard basis
      array([ 0.  , -0.25,  0.  ,  0.25])
      >>> j = complex(0,1)
      >>> C.chebfromroots((-j,j)) # x^2 + 1 relative to the standard basis
      array([ 1.5+0.j,  0.0+0.j,  0.5+0.j])
docstring_summary: Generate a Chebyshev series with the given roots.
docstring_tokens: Generate a Chebyshev series with the given roots .
function: def chebfromroots(roots) :
      """
      Generate a Chebyshev series with the given roots.
  
      Return the array of coefficients for the C-series whose roots (a.k.a.
      "zeros") are given by *roots*.  The returned array of coefficients is
      ordered from lowest order "term" to highest, and zeros of multiplicity
      greater than one must be included in *roots* a number of times equal
      to their multiplicity (e.g., if `2` is a root of multiplicity three,
      then [2,2,2] must be in *roots*).
  
      Parameters
      ----------
      roots : array_like
          Sequence containing the roots.
  
      Returns
      -------
      out : ndarray
          1-d array of the C-series' coefficients, ordered from low to
          high.  If all roots are real, ``out.dtype`` is a float type;
          otherwise, ``out.dtype`` is a complex type, even if all the
          coefficients in the result are real (see Examples below).
  
      See Also
      --------
      polyfromroots
  
      Notes
      -----
      What is returned are the :math:`c_i` such that:
  
      .. math::
  
          \\sum_{i=0}^{n} c_i*T_i(x) = \\prod_{i=0}^{n} (x - roots[i])
  
      where ``n == len(roots)`` and :math:`T_i(x)` is the `i`-th Chebyshev
      (basis) polynomial over the domain `[-1,1]`.  Note that, unlike
      `polyfromroots`, due to the nature of the C-series basis set, the
      above identity *does not* imply :math:`c_n = 1` identically (see
      Examples).
  
      Examples
      --------
      >>> import numpy.polynomial.chebyshev as C
      >>> C.chebfromroots((-1,0,1)) # x^3 - x relative to the standard basis
      array([ 0.  , -0.25,  0.  ,  0.25])
      >>> j = complex(0,1)
      >>> C.chebfromroots((-j,j)) # x^2 + 1 relative to the standard basis
      array([ 1.5+0.j,  0.0+0.j,  0.5+0.j])
  
      """
      if len(roots) == 0 :
          return np.ones(1)
      else :
          [roots] = pu.as_series([roots], trim=False)
          prd = np.array([1], dtype=roots.dtype)
          for r in roots:
              prd = chebsub(chebmulx(prd), r*prd)
          return prd
function_tokens: def chebfromroots ( roots ) : if len ( roots ) == 0 : return np . ones ( 1 ) else : [ roots ] = pu . as_series ( [ roots ] , trim = False ) prd = np . array ( [ 1 ] , dtype = roots . dtype ) for r in roots : prd = chebsub ( chebmulx ( prd ) , r * prd ) return prd