I have forgotten COST (GBP) 2.00 0.00 0

Euler

viewed 3024 times and licensed 45 times
Calculates Euler numbers by means of recurrent relation
Controller: CodeCogs   C++

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

Authors

Will Bateman (September 2005)

EulerA

 voidEulerA( int iMax double* daEuler )
Calculates Euler numbers using the recurrent relation

Example 1

#include <stdio.h>

#define MAX_INDEX 16
int main()
{
double dEulerA[MAX_INDEX+1];
double dEulerB[MAX_INDEX+1];

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.000027

Parameters

 iMax input maximal index requested. Must be a power of 2. daEuler array into which to place the result, with iMax parameters.

Returns

pointer on the resulting array of type double

Authors

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)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

EulerB

 voidEulerB( int iMax double* daEuler )
Calculates Euler numbers using the recurrent series expansion

Parameters

 iMax input maximal index requested. Must be a power of 2. daEuler array into which to place the result, with iMax parameters.

Returns

pointer on the resulting array of type double

Authors

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)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.