Euler
Calculates Euler numbers by means of recurrent relation
You're viewing an older version of this page (#83). View the current version.
Interface
#include <codecogs/maths/discrete/number_theory/euler.h>
using namespace Maths::Discrete::Number_Theory;
Overview
Euler numbers, which are also called secant numbers or 'zig' numbers are defined for by
The Euler number give the number of odd alternating permutations and are related to Genocchi numbers.
A slightly different convention, which is also used here, defines
Thus, the Euler numbers and polynomials
are defined through equations
The relation between Euler polynomials and numbers:
References
- Higher Transcendental Functions, vol.1, (1.14) by H.Bateman and A.Erdelyi (Bateman Manuscript Project), 1953
- M.Abramowitz and I.A.Stegun, Handbook of Mathematical Functions, 1964 chapt.23
FUNCTION
EulerA
Calculates Euler numbers using the recurrent relation
Example 1
#include <stdio.h>
#include <codecogs/maths/discrete/number_theory/euler.h>
#define MAX_INDEX 16
int main()
{
double dEulerA[MAX_INDEX+1];
double dEulerB[MAX_INDEX+1];
// Table headings
printf( "%10s %20s %20s\n", "2n", "E_A(2n) (recurrent)", "E_B(2n) (series)" );
printf( "%8s", " " );
for( int i = 0; i < 52; i++ )
printf( "%c", '-' );
printf( "\n" );
// array calculation
Maths::NumberTheory::EulerA( MAX_INDEX, dEulerA );
Maths::NumberTheory::EulerB( MAX_INDEX, dEulerB );
// results output
for( int i = 0; i <= MAX_INDEX; i+=2 )
printf( "%10d %20.6f %20.6f\n", i, dEulerA[i], dEulerB[i]);
return 0;
}Output:
2n E_A(2n) (recurrent) E_B(2n) (series)
----------------------------------------------------
0 1.000000 1.000000
2 -1.000000 -1.000000
4 5.000000 5.000000
6 -61.000000 -61.000000
8 1385.000000 1385.000000
10 -50521.000000 -50521.000000
12 2702765.000000 2702765.000000
14 -199360981.000000 -199360981.000000
16 19391512145.000000 19391512145.000027Parameters
Returns
Anatoly Prognimack (Mar 19, 2005)
Developed & tested with: Borland C++ 3.1 for DOS Microsoft Visual C++ 5.0, 6.0
Updated by Will Bateman (March 2005)
FUNCTION
EulerB
Calculates Euler numbers using the recurrent series expansion
Parameters
Returns
Anatoly Prognimack (Mar 19, 2005)
Developed & tested with: Borland C++ 3.1 for DOS Microsoft Visual C++ 5.0, 6.0
Will Bateman (March 2005)