I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 1.00
sub units 0.00
+
0

Bernoulli A

Calculates array of Bernoulli numbers using recurrent relations.
Controller: CodeCogs

Interface

C++

Bernoulli A

 
voidbernoulli_AintiMax
double*dB )
Given starting values with indices 0 and 1, this function calculates all numbers with indices up to some maximal index. The relations used are as follows:

First numbers are:

References:

  • Higher Transcendental Functions, vol.1, (1.13) by H.Bateman and A.Erdelyi (Bateman Manuscript Project), 1953
  • M.Abramowitz and I.A.Stegun, Handbook of Mathematical Functions, 1964 chapt.23
  • Yu.Luke, Mathematical functions and their approximations, 1975 chapt.14.2

Example 1

#include <stdio.h>
#include <codecogs/maths/discrete/number_theory/bernoulli_a.h>
 
#define MAX_INDEX 16
 
int main()
{
  double dBernoulli[MAX_INDEX+1];
 
  printf( "%8s%2c%20s\n", " ", 'n', "Bn" );
  printf( "%8s", " " );
  for(int i = 0; i < 22; i++ )
    printf( "%c", '-' );
  printf( "\n" );
 
  Maths::Discrete::NumberTheory::bernoulli_A( MAX_INDEX, dBernoulli );
 
  printf( "%10d%20.12f\n", 0, dBernoulli[0] );
  printf( "%10d%20.12f\n", 1, dBernoulli[1] );
  for(int i = 2; i <= MAX_INDEX; i += 2 )
    printf( "%10d%20.12f\n", i, dBernoulli[i] );
  return 0;
}
Output:
n           Bn
----------------------
  0      1.000000000000
  1     -0.500000000000
  2      0.166666666667
  4     -0.033333333333
  6      0.023809523810
  8     -0.033333333333
  10      0.075757575758
  12     -0.253113553114
  14      1.166666666667
  16     -7.092156862745

Parameters

iMaxinput maximal index requested
dBoutput pointer to the array of numbers declared in the calling module. Array dimension should be iMax+1 or greater

Authors

Anatoly Prognimack (Mar 13, 2005)
Developed & tested with: Borland C++ 3.1 for DOS and 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.