Skip to article frontmatterSkip to article content

8.12Trapezoidal Rule - II

from pylab import *
from scipy.integrate import fixed_quad

8.12.1Bernoulli polynomials

The Bernoulli polynomial Bn(x)B_n(x), n0n \ge 0 is defined implicitly by the generating function

t(ext1)et1=j=1Bj(x)tjj!\frac{t(\ee^{xt}-1)}{\ee^t - 1} = \sum_{j=1}^\infty B_j(x) \frac{t^j}{j!}

The first few polynomials are[1]

B0(x)=1,B1(x)=x,B2(x)=x2xB_0(x)=1, \qquad B_1(x)=x, \qquad B_2(x) = x^2 - x
B3(x)=x332x2+12x,B4(x)=x2(1x)2B_3(x) = x^3 - \frac{3}{2} x^2 + \half x, \qquad B_4(x) = x^2(1-x)^2

Note that

Bk(0)=0,k1B_k(0)=0, \qquad k \ge 1

It can be shown that for all j>1j > 1

B2j(x)>0,0<x<1B_{2j}(x) > 0, \qquad 0 < x < 1

8.12.2Bernoulli numbers

These are defined implicitly by

tet1=j=0Bjtjj!\frac{t}{\ee^t - 1} = \sum_{j=0}^\infty B_j \frac{t^j}{j!}

The first few numbers are

B0=1,B1=12,B2=16B_0 = 1, \qquad B_1 = -\half, \qquad B_2 = \frac{1}{6}
B4=130,B6=142,B8=130B_4 = -\frac{1}{30}, \qquad B_6 = \frac{1}{42}, \qquad B_8 = -\frac{1}{30}
Bj=0,j is odd and j3B_j = 0, \qquad \textrm{$j$ is odd and $j \ge 3$}

8.12.3Connection

To obtain the relation between Bj(x)B_j(x) and BjB_j, integrate the generating function of Bernoulli polynomial on [0,1][0,1] to obtain

1tet1=j=1tjj!01Bj(x)dx1 - \frac{t}{\ee^t - 1} = \sum_{j=1}^\infty \frac{t^j}{j!} \int_0^1 B_j(x) \ud x

Hence

B0=1,Bj=01Bj(x)dx,j1B_0 = 1, \qquad B_j = -\int_0^1 B_j(x) \ud x, \quad j \ge 1

Next, define the periodic extension of Bj(x)B_j(x) by

Bˉj(x)={Bj(x)0x1Bˉj(x1)x>1\bar{B}_j(x) = \begin{cases} B_j(x) & 0 \le x \le 1 \\ \bar{B}_j(x-1) & x > 1 \end{cases}

8.12.4Error of trapezoid rule

In more detail, the error of trapezoid method can be written as

En(f)=h212[f(1)(a)f(1)(b)]h4720[f(3)(a)f(3)(b)]+h630240[f(5)(a)f(5)(b)]h81209600[f(7)(a)f(7)(b)]+\begin{align} E_n(f) &= \frac{h^2}{12} [ f^{(1)}(a) - f^{(1)}(b) ] - \frac{h^4}{720} [ f^{(3)}(a) - f^{(3)}(b) ] \\ & \qquad + \frac{h^6}{30240} [ f^{(5)}(a) - f^{(5)}(b) ] - \frac{h^8}{1209600} [ f^{(7)}(a) - f^{(7)}(b) ] + \ldots \end{align}
Footnotes
  1. B0(x)B_0(x) is defined to be one, it is not present in the definition of the generating function.

References
  1. Atkinson, K. E. (2004). An Introduction to Numerical Analysis (2nd ed.). Wiley.
  2. Fornberg, B. (2021). Improving the Accuracy of the Trapezoidal Rule. SIAM Review, 63(1), 167–180. 10.1137/18M1229353