code: def gegenbauer(n, alpha, monic=False):
      r"""Gegenbauer (ultraspherical) polynomial.
  
      Defined to be the solution of
  
      .. math::
          (1 - x^2)\frac{d^2}{dx^2}C_n^{(\alpha)}
            - (2\alpha + 1)x\frac{d}{dx}C_n^{(\alpha)}
            + n(n + 2\alpha)C_n^{(\alpha)} = 0
  
      for :math:`\alpha > -1/2`; :math:`C_n^{(\alpha)}` is a polynomial
      of degree :math:`n`.
  
      Parameters
      ----------
      n : int
          Degree of the polynomial.
      alpha : float
          Parameter, must be greater than -0.5.
      monic : bool, optional
          If `True`, scale the leading coefficient to be 1. Default is
          `False`.
  
      Returns
      -------
      C : orthopoly1d
          Gegenbauer polynomial.
  
      Notes
      -----
      The polynomials :math:`C_n^{(\alpha)}` are orthogonal over
      :math:`[-1,1]` with weight function :math:`(1 - x^2)^{(\alpha -
      1/2)}`.
  
      Examples
      --------
      >>> import numpy as np
      >>> from scipy import special
      >>> import matplotlib.pyplot as plt
  
      We can initialize a variable ``p`` as a Gegenbauer polynomial using the
      `gegenbauer` function and evaluate at a point ``x = 1``.
  
      >>> p = special.gegenbauer(3, 0.5, monic=False)
      >>> p
      poly1d([ 2.5,  0. , -1.5,  0. ])
      >>> p(1)
      1.0
  
      To evaluate ``p`` at various points ``x`` in the interval ``(-3, 3)``,
      simply pass an array ``x`` to ``p`` as follows:
  
      >>> x = np.linspace(-3, 3, 400)
      >>> y = p(x)
  
      We can then visualize ``x, y`` using `matplotlib.pyplot`.
  
      >>> fig, ax = plt.subplots()
      >>> ax.plot(x, y)
      >>> ax.set_title("Gegenbauer (ultraspherical) polynomial of degree 3")
      >>> ax.set_xlabel("x")
      >>> ax.set_ylabel("G_3(x)")
      >>> plt.show()
  
      """
      base = jacobi(n, alpha - 0.5, alpha - 0.5, monic=monic)
      if monic:
          return base
      #  Abrahmowitz and Stegan 22.5.20
      factor = (
          _gam(2 * alpha + n)
          * _gam(alpha + 0.5)
          / _gam(2 * alpha)
          / _gam(alpha + 0.5 + n)
      )
      base._scale(factor)
      base.__dict__["_eval_func"] = lambda x: _ufuncs.eval_gegenbauer(
          float(n), alpha, x
      )
      return base
  
imports: import numpy
  from numpy import exp, inf, pi, sqrt, floor, sin, cos, around, hstack, arccos, arange
  from scipy import linalg
  from scipy.special import airy
  from .None import _specfun
  from .None import _ufuncs
label_desc: Use image node_id 22 for calling a global function with example usage: gegenbauer(n, alpha, monic) and returns: base, base