This site is supported by donations to The OEIS Foundation.

User:Peter Luschny/EulerianPolynomialsGeneralized

From OeisWiki
Jump to: navigation, search

Generalized Eulerian Polynomials

The Eulerian polynomials were introduced by Leonhard Euler in his Remarques sur un beau rapport entre les séries des puissances tant directes que réciproques in 1749 (first printed in 1765) where he describes a method of computing values of the zeta function at negative integers by a precursor of Abel's theorem applied to a divergent series. The Eulerian polynomials should not be confused with the Euler polynomials.

In this second part we look at an analytic generalization of the polynomials. The first part of this post can be found here. The full post (rendered with MathJax) is on the author's homepage.

The connection with cardinal B-splines

The cardinal B-spline of the first order is the characteristic function of the unit interval. The cardinal B-spline of order is . Then for

This representation of the Eulerian polynomials suggests to look also at the midpoint Eulerian polynomials

The midpoint Eulerian polynomials

Generating function

The midpoint Eulerian polynomials are defined by the generating function

which is the counterpart to the generating function of the standard Eulerian polynomials

Exponential generating function

Recurrence relation

The midpoint Eulerian polynomials can be computed by recurrence:


The expansion analogous to Euler's given above is

For instance we get for

Worpitzky-type identity

Roots of the polynomials

has zeros which are simple and negative.

The midpoint Eulerian numbers

The coefficients of the midpoint Eulerian polynomials are the midpoint Eulerian numbers

A060187        A000165
Mn,k 01234row sum
010000 1
111000 2
216100 8
31232310 48
4176230761 384

Note that the offset in our setup is which differs from the offset assumed in some of the formulas in A060187.

The combinatorial interpretation

Let denote the set of signed permutations of

such that for all . The descent number of is defined as

where . Then

The table below illustrates this representation for the case

Signed permutations
and descents
-2, -1, 1, 2 01, -2, 2, -1 1
-2, 1, -1, 2 11, 2, -2, -1 1
-1, -2, 2, 1 12, -1, 1, -2 1
-1, 2, -2, 1 12, 1, -1, -2 2

The connection with the Lerch transcendent

Since the Lerch transcendent (the analytic continuation is always implied) is related to the polylogarithm by the formula given above shows

Similarly one finds for the midpoint Eulerian polynomials

The Eulerian polynomials generalized

The formulas in the last section suggest to introduce the following generalization of the Eulerian polynomials .

Thus and .


Plugging into the left hand side of (*) times would set . On the other hand the row sums of the coefficients of are (the k-factorial numbers, A000142, A000165, A032031,…). But taking the limit will reconcile the two values

The most interesting point to evaluate these polynomials at is (this is what Euler did in the classical case).

A155585 1, 1, 0, -2, 0, 16, 0, -272, 0, 7936, 0,
A002436 1, 0, -4, 0, 80, 0, -3904, 0, 354560, 0,
A000810 1, -1, -8, 26, 352, -1936, -38528, 297296,
A079858 1, -2, -12, 88, 912, -11552, -176832,

(Note that in OEIS sequences are written zero-suppressed if every other term is and that we refer to a sequence in the database even if it has a different sign pattern.)

If is integer and is real then [1]

Thus with for some integer the generalized Eulerian polynomials can be written

Here the index is used for integer values of but it can also be seen as an arbitrary positive real. For example we get

A119881 1, 3, 8, 18, 32, 48, 128, 528, 512,
A225116 1, 5, 24, 110, 480, 2000, 8064, 32240,
A052841 1, 0, 2, 6, 38, 270, 2342, 23646,

Assorted values of the polynomials

A(n, k, I) *
k = 1 k = 2 k = 3 k = 4
 Re A000111 A001586 A007286 A006873
 Im A000007 A001586 A007289 A225109
A(n, k, I) *
k = 1 k = 2 k = 3 k = 4
 Re A155585 A188458 A000810 A000813
 Im A122045 A212435 A225147 A156201

Among other numbers we see the Euler (or up/down) numbers, the generalized Euler numbers (Springer numbers), the number of alternating k-signed permutations and two recent additions triggered by this exploration. (As always the references are modulo sign and suppressed zeros.)

How to compute Eulerian polynomials.

The definitions given above are not computer friendly. Maple for example makes errors when computing the Lerch transcendent (as far as I know in all versions throughout the years 1998--2012) and gives wrong values if formula (*) is used. A computation based on the polylogarithm is much better, still the polylogarithm is not a trivial function to implement.

To the rescue come the cardinal splines (see the Schoenberg reference; Schoenberg elucidates the cases and in detail).

Cardinal B-splines are easy to compute and the Eulerian polynomials can be based on them. Despite their modern name B-splines were first investigated by Nikolai Lobachevsky in the nineteenth century.


def B(n, x):   # Cardinal B-splines
    if n == 1: return 0 if (x < 0) or (x >= 1) else 1 
    return (x/(n-1))*B(n-1, x)+((n-x)/(n-1))*B(n-1, x-1)

def EulerianPolynomial(n, k, x):
    if n == 0: return 1
    return k^n*factorial(n)*add(B(n+1, m+1/k)*x^m for m in (0..n))

For example:

[EulerianPolynomial(n, 4, x) for n in (0..5)] 
[imag(-(1-I)^(1-n)*EulerianPolynomial(n,4,I)) for n in (0..17)] # A156201

No library functions besides the power and factorial function are used. And the factor can be integrated into the recurrence.

def EB(n, k, x):
    if n == 1: return 0 if (x < 0) or (x >= 1) else 1 
    return k*x*EB(n-1, k, x) + k*(n-x)*EB(n-1, k, x-1)
def EulerianPolynomial(n, k, x):
    if n == 0: return 1
    return add(EB(n+1, k, m+1/k)*x^m for m in (0..n))

Also the rational parameter can be eliminated.

def BB(n, k, x):  
    if n == 1: return 0 if (x < 0) or (x >= k) else 1 
    return x*BB(n-1, k, x) + (n*k-x)*BB(n-1, k, x-k) 

def EulerianPolynomial(n, k, x):
    if n == 0: return 1
    return add(BB(n+1, k, k*m+1)*x^m for m in (0..n))

Based on this recurrence a closed form can also be given if we use the signum function defined Then

def EulerianPolynomial(n, k, x) :
    if n == 0: return 1
    S = lambda m: add((-1)^j*binomial(n+1,j)*(k*(m-j)+1)^n*sgn(k*(m-j)+1) 
        for j in (0..n+1))
    return add(S(m)*x^m for m in (0..n))/2

Finally calling the coefficients of the (generalized) Eulerian polynomials (generalized) Eulerian numbers we arrive at the recurrence:

def EulerianNumber(n, k, m) :
    if n == 0: return 1 if m == 0 else 0
    return (k*(n-m+1)-1)*EulerianNumber(n-1,k,m-1)
               + (m*k+1)*EulerianNumber(n-1,k,m)

def EulerianPolynomial(n, k, x):
    return add(EulerianNumber(n, k, m)*x^m for m in (0..n))    

The generalized Eulerian polynomials can also be computed by a direct recurrence:

Generating function

The generating function for the generalized Eulerian polynomials is

Here is the coefficient of in .

This generating function immediately suggests a more symmetric generalization with two parameters:

Short table


a := proc(n, m) local k; # Eulerian numbers
     add((-1)^k*binomial(n+1, k)*(m+1-k)^n, k=0..m) 
A := proc(n, x) local k; # Eulerian polynomials
     add(a(n, k)*x^k, k=0..n) 
ma := proc (n, m) local k; # Midpoint Eulerian numbers
     add((-1)^(m-k)*binomial(n+1, m-k)*(2*k+1)^n, k=0..m)
mr := proc(n, k) option remember; # Recursive mid. Eul.num.
     if n = 0 then if k=0 then 1 else 0 fi else
     (2*(n-k)+1)*mr(n-1, k-1) + (2*k+1)*mr(n-1, k) fi 
MA := proc(n, x) local k; # Midpoint Eulerian polynomials
     add(mr(n, k)*x^k, k=0..n)
B := proc(n, u) option remember; # Cardinal B-splines
     if n = 1 then if (u < 0) or (u >= 1) then 0 else 1 fi
     else (u/(n-1))*B(n-1, u)+((n-u)/(n-1))*B(n-1, u-1) fi
# Generalized Eulerian polynomials based on polylog.
EulerianPolynomial := proc(n, k, x) local j;
     if x = 1 then k^n*n! else 
     simplify(expand(%)) fi 

# Generalized Eulerian polynomials based on direct recurrence.     
EulerianPolynomials := proc(n, k, t)
     if n = 0 then 1 else
     +EulerianPolynomials(n-1,k,t)*(1+(k*n-1)*t) fi; 
     sort(simplify(expand(%))) end:
# Generating function, general case
gf := proc(n, k) local f; 
     f := (x,t) -> x*exp(t*x/k)/(1-x*exp(t*x));
     series(f(x,t), t, n+2); ((1-x)/x)^(n+1)*k^n*n!*coeff(%, t, n); 
     collect(simplify(%), x) end:
     seq(print(gf(n, k)), n=0..4); # generates the table above
def a(n, m) :  # Eulerian numbers
    return add((-1)^k*binomial(n+1, k)*(m+1-k)^n for k in (0..m))
def A(n, x) :  # Eulerian polynomials
    return add(a(n, k)*x^k for k in (0..n))
def ma(n, m):  # Midpoint Eulerian numbers
    return add((-1)^(m-k)*binomial(n+1, m-k)*(2*k+1)^n for k in (0..m))

def mr(n, k) : # Recursive midpoint Eulerian numbers
    if n == 0: return 1 if k == 0 else 0
    return (2*(n-k)+1)*mr(n-1, k-1) + (2*k+1)*mr(n-1, k) 
def MA(n, x):  # Midpoint Eulerian polynomials
    return add(mr(n, k)*x^k for k in (0..n))

def B(n, x):   # Cardinal B-splines
    if n == 1: return 0 if (x < 0) or (x >= 1) else 1 
    return (x/(n-1))*B(n-1, x)+((n-x)/(n-1))*B(n-1, x-1)
def BB(n, k, x):  # Modified Cardinal B-splines
    if n == 1: return 0 if (x < 0) or (x >= k) else 1 
    return x*BB(n-1, k, x) + (n*k-x)*BB(n-1, k, x-k) 

# Generalized Eulerian polynomials based on recurrence.      
def EulerianPolynomial(n, k, x):
    if n == 0: return 1
    return add(BB(n+1, k, k*m+1)*x^m for m in (0..n))

# Generalized Eulerian polynomials based on direct recurrence.          
def EulerianPolynomials(n, k, t):
    if n == 0 : return 1
    return (k*t*(1-t)*diff(EulerianPolynomials(n-1,k,t),t)
     + EulerianPolynomials(n-1,k,t)*(1+(k*n-1)*t)).expand() 

# Generalized Eulerian polynomials based on polylog.    
from mpmath import *
mp.dps = 32; mp.pretty = True

def EulerianPolynomialLi(n, k, x):
    if x == 1: return k^n*factorial(n)
    return (1-x)^(1+n)*(1+add(binomial(n,j)*polylog(-j,x)*k^j 
           for j in (0..n)))       


  1. See the formula at Wolfram research.