def recf_chebyshev_poly(basetensor, ind, x):
    """Implementation of the recursion formula for Chebyshev polynomials.

    Parameters
    ----------
    basetensor : numpy.ndarray
        The ``num_dims+1``-dimensional array considered, with samples
        along the first dimension. For each sample we have ``num_dims``
        -dimensional subarrays with non-zero values on the edges.
    ind : numpy.ndarray
        Instance of the class ``NDArrayManager`` created in the
        ``RecursiveExpansion.execute`` method and passed when
        calling this function.
    x : numpy.ndarray
        A two-dimensional numpy array passed to
        ``RecursiveExpansion.execute``. The recursion will be evaluated
        on the data contained. Observations of
        variables are stored in the rows of the array, individual variables
        are stored in the columns. This means that one row contains one
        particular observation/measurement of all variables, and one
        column contains all observations/measurements of one particular
        variable.


    Returns
    -------
    numpy.ndarray
        Array of shape ``(num_samples,)`` containing the evaluation of
        the most recent recursion step along the ``current_dim``.

    References
    ----------
    .. [4] Wikipedia, "Chebyshev polynomials of first kind",
        https://en.wikipedia.org/wiki/Chebyshev_polynomials#First_kind
    """
    return 2.0 * x[:, (ind.current_dim)] * basetensor[ind.all + ind.
        getPreceding(1)] - basetensor[ind.all + ind.getPreceding(2)]
