{'fraction_non_alphanumeric': 0.04864585130239779, 'fraction_numerical': 0.012247714335000862, 'mean_word_length': 4.629126213592233, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, '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}}
The expansion in ultraspherical polynomials: a simple procedure for the fast computation of the ultraspherical coefficients

We present a simple and fast algorithm for the computation of the coefficients of the expansion of a function f(cos u) in ultraspherical (Gegenbauer) polynomials. We prove that these coefficients coincide with the Fourier coefficients of an Abel-type transform of the function f(cos u). This allows us to fully exploit the computational efficiency of the Fast Fourier Transform, computing the first N ultraspherical coefficients in just O (N log_2 N) operations.


Introduction
In this paper we investigate the generalization to ultraspherical polynomials (also known as Gegenbauer polynomials) of the results obtained in a previous paper [5] regarding the efficient computation of the coefficients of Legendre expansions.
Ultraspherical expansions play a relevant role in various subjects of applied and computational mathematics. These expansions have been used successfully for the solution of linear [8] and nonlinear [6,7,15] differential equations, of integral equation [16], and in spectral methods for partial differential equations [3,19]. Gegenbauer filtering (for the suppression of the Gibbs phenomenon) [10,11,12] has been proved to provide an exponentially convergent approximation (in the maximum norm) of a piecewise analytic function, starting from the Fourier partial sum of the function itself. The related Gegenbauer reconstruction method has found natural application in the image segmentation problem, in particular of MRI images [2,13].
One of the limits of the application of ultraspherical expansions is the high cost of computing the expansion coefficients, this question becoming particularly critical in the case of multivariate functions.
In this paper we give an efficient procedure for computing these coefficients. We first obtain a Dirichlet-Murphy-type integral representation of the ultraspherical polynomials P (d) n (cos u) of degree n and order d. Then we prove that the coefficients of the ultraspherical expansion of a function f (cos u) (u ∈ [0, π]) coincide with the Fourier coefficients (restricted to nonnegative index) of an Abel-type transform of the function f .
These results produce straightforwardly an algorithm for the computation of ultraspherical coefficients which is very simple and very fast. In fact, the first N ultraspherical coefficients are obtained in only O(N log 2 N ) operations by a single Fast Fourier Transform of the Abel-type integral function, the latter being easily computable by standard quadrature techniques [14].
Finally, in the Appendix the results obtained for the ultraspherical polynomials are given also in terms of Gegenbauer polynomials C

Connection between Ultraspherical expansions and Fourier series
In dimension d, the expansion in ultraspherical polynomials of a function f = f (cos u) (u ∈ [0, π]) reads: the coefficients a (d) n being defined by [4]: n (cos u) denotes the ultraspherical polynomial of degree n and order d, which is defined by the integral representation [9,18]: Our goal now is to show that the coefficients a (d) n are the Fourier coefficients of a suitable Abel-type transform of f . To this end, we first prove the following proposition (see also [4]). Proposition 1. The following integral representation of the ultraspherical polynomials P (d) n (cos u) holds: Proof. In the integral representation (2.3) of P (d) n (cos u) substitute to η the complex integration variable τ defined by (2.5) e iτ = cos u + i sin u cos η.
It can be checked that Now, since e iτ dτ = − sin u sin η dη, the integrand on the r.h.s. of Eq. (2.3) can be written as follows: dτ. (2.7) In order to determine the integration path, consider an intermediate step where e iτ is chosen as the integration variable; the original path (corresponding to η ∈ [0, π]) is the (oriented) linear segment δ 0 (u) starting at e iu and ending at e −iu . Since (as shown by (2.7)) the integrand is an analytic function of e iτ in the disk |e iτ | < 1 (since n ∈ N), the integration path δ 0 (u) can be replaced by the circular path Fig. 1). Moreover, by using the fact that is positive for e iτ ∈ δ 0 (u) ∪ R and therefore at e iτ = e iπ , we conclude from the left equality in (2.6) that in the r.h.s. of (2.7) the following specification holds (for τ = t; u t 2π − u): 2 . Finally, by taking into account the latter expression, the integral representation (2.3) can then be replaced by the integral representation (2.4).
We can now prove the following theorem (see also [4]).

Theorem 2. The ultraspherical coefficients {a
2)) coincide with the Fourier coefficients (restricted to the nonnegative integer) of the form: where: sin u du, ε(t) being the sign function.
It is easy to check that the 2π-periodic f (d) (t) function enjoys the following symmetry properties: and, consequently, Appendix A. From ultraspherical to Gegenbauer polynomials A.1. The Gegenbauer polynomials C (λ) n . For the convenience of the reader we summarize hereafter the main properties of the Gegenbauer polynomials C (λ) n (x), which are strictly related to the ultraspherical polynomials P (d) n (x) that we introduced in Section 2. The following formulae are listed in Ref.
The Gegenbauer polynomials of order λ can be defined in terms of their generating function: From (A.1) we see that the Legendre polynomials P n (x) are the particular case of Gegenbauer polynomials with λ = 1 2 , i.e.: C n (x) = P n (x). They satisfy the recurrence relation: In terms of Gaussian hypergeometric function they can be written as: They can be written explicitly as and have the following integral representation: π 0 (cos u + i sin u cos η) n (sin η) 2λ−1 dη.
We can now rewrite Theorem 2 in terms of Gegenbauer coefficients f