# Euler Numbers

 Function Library Home Euler Numbers

### Description

There are several different definitions of the Euler numbers, En. The definition of the Euler numbers programmed here arises from the generating function
2 / (ex+e-x) = Σn=0En xn / n!.
This definition yields E0 = 1,  E1 = 0,  E2 = -1,  E3 = 0,  E4 = 5 etc.
Multiply both sides of the generating function for the Euler numbers by (ex + e -x) / 2
1 = (ex + e -x) / 2 Σn=0En xn / n!.
and expand (e x + e -x) / 2 in a Taylor series expansion
1 = Σk=0 x2k / (2k)! Σn=0En xn / n! = Σk=0 Σn=0En xn+2k / [n! (2k)!] .
Rearrange the terms
1 = Σj=0 x j Σ jn=0 En / [n! (j-n)!] δ2|(j-n).
Then equate like powers of x on both sides of the equation
1 = E0
and
0 = Σ (j-1)/2n=0 E2n+1 / [(2n+1)! (j-2n-1)!], for j ≥ 1, j odd
and
0 = Σ j/2n=0 E2n / [(2n)! (j-2n)!], for j ≥ 2, j even.

Solve for Ej for j ≥ 1, for j odd
0 = E1
Ej = - j! Σ (j-3)/2n=0 E2n+1 / [(2n+1)! (j-2n-1)!], j ≥ 3 .

By induction, Ej = 0 if j is odd.
Solve for Ej for j ≥ 1, for j even
Ej = - j! Σ j/2-1n=0 E2n / [(2n)! (j-2n)!]
set j = 2k, then
E2k = - (2k)! Σ k-1n=0 E2n / [(2n)! (2k-2n)!]
The even-indexed Euler numbers can be expressed in terms of the Catalan beta function as:
E2n = (-1)n [ 2 (2n)! (2 / π)2n+1 ] β(2n+1)
.

#### Function List

• double Euler_Number( int n )

This function returns En for n ≥ 0. If En ≤ -DBL_MAX, then -DBL_MAX is returned and if En ≥ DBL_MAX, then DBL_MAX is returned.

• void Euler_Number_Sequence( double *e, int start, int length )

This function returns En in the array e for n = start, start + 1, ... , start + length - 1 where start ≥ 0 and length ≥ 1. I.e. e[n] = Estart + n. If En ≤ -DBL_MAX, then -DBL_MAX is returned and if En ≥ DBL_MAX, then DBL_MAX is returned.

• void Euler_Even_Index_Sequence( double *e, int start, int length )

This function returns En in the array e for n = start, start + 2, ... , start + 2*length - 1 where start ≥ 0 and length ≥ 1. I.e. e[n] = Estart + 2n. If En ≤ -DBL_MAX, then -DBL_MAX is returned and if En ≥ DBL_MAX, then DBL_MAX is returned.

• int Max_Euler_Even_Number_Index( void )

This function returns the maximum even number index of the largest Euler representable as a type double. Note the Euler numbers with odd index vanish.

• long double xEuler_Number( int n )

This function returns En for n ≥ 0. If En ≤ -LDBL_MAX, then -LDBL_MAX is returned and if En ≥ LDBL_MAX, then LDBL_MAX is returned.

• void xEuler_Number_Sequence( long double *e, int start, int length )

This function returns En in the array e for n = start, start + 1, ... , start + length - 1 where start ≥ 0 and length ≥ 1. I.e. e[n] = Estart + n. If En ≤ -LDBL_MAX, then -LDBL_MAX is returned and if En ≥ LDBL_MAX, then LDBL_MAX is returned.

• void xEuler_Even_Index_Sequence( long double *e, int start, int length )

This function returns En in the array e for n = start, start + 2, ... , start + 2*length - 1 where start ≥ 0 and length ≥ 1. I.e. e[n] = Estart + 2n. If En ≤ -LDBL_MAX, then -LDBL_MAX is returned and if En ≥ LDBL_MAX, then LDBL_MAX is returned.

• int xMax_Euler_Even_Number_Index( void )

This function returns the maximum even number index of the largest Euler representable as a type long double. Note the Euler numbers with odd index vanish.

#### Source Code

C source code is available for these routines:
• The file, euler_numbers.c, contains the functions Euler_Number( ), Euler_Number_Sequence( ), Euler_Even_Index_Sequence( ), Max_Euler_Even_Number_Index, xEuler_Number( ), xEuler_Number_Sequence( ), xEuler_Even_Index_Sequence( ), and xMax_Euler_Even_Number_Index( ).

Dependencies: No external dependencies.