<commit_before>using Iterators
import PyPlot

choose(n, k) = factorial(n) / (factorial(k) * factorial(n - k))

count_coef(d, mu, i) = (-1) ^ (d + mu - i) * choose(d - 1, d + mu - i)

slice_sqz(A, d, i) = squeeze(slicedim(A, d, i), d)


function m_i(i::Int)
    if i < 1
        error("DomainError: i must be positive")

    elseif i == 1
        return 1
    else
        return 2^(i - 1) + 1
    end
end


function chebychev(x, n)
    # Evaluates the first n Chebyshev polynomials of the first kind at x
    dim = size(x)
    results = zeros(n + 1, dim...)
    results[1, :] = 1.
    results[2, :] = x
    for i=3:n+1
        results[i, :] = (2 * x .* slice_sqz(results, 1, i-1) -
                         slice_sqz(results, 1, i-2))
    end
    return results
end

# def chebychev(x, n):
#     # computes the chebychev polynomials of the first kind
#     dim = x.shape
#     results = numpy.zeros((n+1,) + dim)
#     results[0,...] = numpy.ones(dim)
#     results[1,...] = x
#     for i in range(2,n+1):
#         results[i,...] = 2 * x * results[i-1,...] - results[i-2,...]
#     return results


function S_n(n::Int)
    # Compute the set S_n. All points are extrema of Chebyshev polynomials<commit_msg>CLN: Removed old code<commit_after>using Iterators
import PyPlot

choose(n, k) = factorial(n) / (factorial(k) * factorial(n - k))

count_coef(d, mu, i) = (-1) ^ (d + mu - i) * choose(d - 1, d + mu - i)

# takes the ith slice of A in the dth dimension and squeezes along d
slice_sqz(A, d, i) = squeeze(slicedim(A, d, i), d)


function m_i(i::Int)
    if i < 1
        error("DomainError: i must be positive")

    elseif i == 1
        return 1
    else
        return 2^(i - 1) + 1
    end
end


function chebychev(x, n)
    # Evaluates the first n Chebyshev polynomials of the first kind at x
    dim = size(x)
    results = zeros(n + 1, dim...)
    results[1, :] = 1.
    results[2, :] = x
    for i=3:n+1
        results[i, :] = (2 * x .* slice_sqz(results, 1, i-1) -
                         slice_sqz(results, 1, i-2))
    end
    return results
end


function S_n(n::Int)
    # Compute the set S_n. All points are extrema of Chebyshev polynomials
{'fraction_non_alphanumeric': 0.14775358962482632, 'fraction_numerical': 0.021306160259379342, 'mean_word_length': 2.2481203007518795, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1239353', 'n_tokens_mistral': 888, 'n_tokens_neox': 818, 'n_words': 255}