from pylab import *
from scipy.integrate import fixed_quad
8.12.1Bernoulli polynomials¶
The Bernoulli polynomial Bn(x), n≥0 is defined implicitly by the generating function
et−1t(ext−1)=j=1∑∞Bj(x)j!tj The first few polynomials are[1]
B0(x)=1,B1(x)=x,B2(x)=x2−x B3(x)=x3−23x2+21x,B4(x)=x2(1−x)2 Note that
Bk(0)=0,k≥1 It can be shown that for all j>1
B2j(x)>0,0<x<1 8.12.2Bernoulli numbers¶
These are defined implicitly by
et−1t=j=0∑∞Bjj!tj The first few numbers are
B0=1,B1=−21,B2=61 B4=−301,B6=421,B8=−301 Bj=0,j is odd and j≥3 8.12.3Connection¶
To obtain the relation between Bj(x) and Bj, integrate the generating function of Bernoulli polynomial on [0,1] to obtain
1−et−1t=j=1∑∞j!tj∫01Bj(x)dx Hence
B0=1,Bj=−∫01Bj(x)dx,j≥1 Next, define the periodic extension of Bj(x) by
Bˉj(x)={Bj(x)Bˉj(x−1)0≤x≤1x>1 8.12.4Error of trapezoid rule¶
In more detail, the error of trapezoid method can be written as
En(f)=12h2[f(1)(a)−f(1)(b)]−720h4[f(3)(a)−f(3)(b)]+30240h6[f(5)(a)−f(5)(b)]−1209600h8[f(7)(a)−f(7)(b)]+…