University Calculus · Calculus II大学微积分 · 微积分 II

Unit B3: Improper Integrals and Numerical IntegrationB3 单元:反常积分与数值积分

When the interval runs to infinity, the integrand blows up, or no antiderivative exists, we still extract a number. This unit defines improper integrals as limits, tests their convergence, and approximates the rest with the trapezoidal and Simpson rules.当积分区间延伸至无穷,或被积函数在某点趋于无穷大,或原函数不存在时,我们仍然可以给积分赋予数值。本单元将反常积分(improper integral)定义为极限(limit),讨论其收敛(convergence)与发散(divergence),并在无法求出原函数(antiderivative)时用梯形法则(trapezoidal rule)与辛普森法则(Simpson's rule)进行数值逼近。

Calculus II微积分 II Single-Variable单变量 Integrals & Series积分与级数 MIT 18.01 / GT 1552 / Princeton MAT 104
Read me first.先读这里。 Two ideas drive this unit. First, an integral can be improper because the interval is infinite or the integrand is unbounded; in either case we define it as a limit of ordinary integrals and ask whether that limit exists. Second, when an antiderivative is out of reach, we approximate the integral numerically and bound the error. The comparison tests connect the two: they decide convergence without evaluation, just as the error bounds certify accuracy without the true value.本单元围绕两个核心思想展开。第一,当积分区间无穷或被积函数无界时,积分称为反常积分(improper integral),其定义为常义积分的极限,核心问题是该极限是否存在(即是否收敛)。第二,当原函数(antiderivative)无法用初等函数表示时,转而用数值方法逼近积分并对误差进行估计。比较判别法将两者联系起来:无需计算积分值便能判断收敛性,正如误差界在不知道真实值的情况下保证数值精度。

Infinite Intervals无穷区间

An ordinary definite integral $\int_a^b f(x)\,dx$ presumes a finite interval and a bounded integrand. An improper integral relaxes one of these conditions. The first kind extends the interval of integration to infinity. We give such an integral meaning not by a single limit of Riemann sums but by integrating over a finite piece and then letting that piece grow without bound.普通定积分 $\int_a^b f(x)\,dx$ 要求区间有界且被积函数有界。反常积分(improper integral)放宽了其中一个条件。第一类反常积分将积分区间延伸至无穷。其含义不是通过对黎曼和(Riemann sum)直接取极限给出,而是先在有限区间上积分,再令区间端点趋向无穷。

Key idea.核心思想。 An integral over an unbounded interval is defined as a limit of proper integrals. If the limit exists as a finite number the improper integral converges to that value; otherwise it diverges. Convergence is the assertion that the area, though spread over an infinite interval, accumulates to a finite total.无穷区间上的积分被定义为常义积分的极限。若极限存在且为有限数,则反常积分收敛converges)到该值;否则发散diverges)。收敛的含义是:面积虽然分布在无穷区间上,但最终累积到有限的总量。

Definition: infinite interval定义:无穷区间
$$\int_a^{\infty} f(x)\,dx = \lim_{t\to\infty}\int_a^{t} f(x)\,dx, \qquad \int_{-\infty}^{b} f(x)\,dx = \lim_{t\to-\infty}\int_{t}^{b} f(x)\,dx.$$

For an integral over the whole line we split at any convenient point $c$ and require both halves to converge separately:对于整条数轴上的积分,在任意方便的点 $c$ 处拆分,要求两段各自独立收敛:

Doubly infinite interval双向无穷区间
$$\int_{-\infty}^{\infty} f(x)\,dx = \int_{-\infty}^{c} f(x)\,dx + \int_{c}^{\infty} f(x)\,dx.$$

The doubly infinite integral diverges if either piece diverges. It is a common error to compute $\lim_{t\to\infty}\int_{-t}^{t} f$ instead; that symmetric limit (the Cauchy principal value) can exist even when the integral itself diverges, as for $f(x)=x$.若任意一段发散,则整个双向积分发散。常见错误是改用对称极限 $\lim_{t\to\infty}\int_{-t}^{t} f$;这个对称极限(柯西主值)即使在积分本身发散时也可能存在,例如 $f(x)=x$。

The $p$ test at infinity无穷处 $p$ 判别法
$$\int_{1}^{\infty}\frac{dx}{x^{p}} \text{ converges if } p>1 \text{ and diverges if } p\le 1.$$
Worked Example 1.1: a convergent and a divergent case例题 1.1:收敛与发散的对比

Evaluate $\int_{1}^{\infty}\dfrac{dx}{x^{2}}$. By definition,

$$\int_{1}^{\infty}\frac{dx}{x^{2}}=\lim_{t\to\infty}\int_{1}^{t}x^{-2}\,dx=\lim_{t\to\infty}\Big[-\frac{1}{x}\Big]_{1}^{t}=\lim_{t\to\infty}\Big(1-\frac{1}{t}\Big)=1.$$

The integral converges to $1$. Contrast $\int_{1}^{\infty}\dfrac{dx}{x}$:

$$\lim_{t\to\infty}\int_{1}^{t}\frac{dx}{x}=\lim_{t\to\infty}\big[\ln x\big]_{1}^{t}=\lim_{t\to\infty}\ln t=\infty,$$

so this one diverges. Both integrands tend to $0$, yet only the first encloses finite area. Decay must be fast enough, and $1/x$ is exactly on the boundary $p=1$.

计算 $\int_{1}^{\infty}\dfrac{dx}{x^{2}}$。按定义:

$$\int_{1}^{\infty}\frac{dx}{x^{2}}=\lim_{t\to\infty}\int_{1}^{t}x^{-2}\,dx=\lim_{t\to\infty}\Big[-\frac{1}{x}\Big]_{1}^{t}=\lim_{t\to\infty}\Big(1-\frac{1}{t}\Big)=1.$$

积分收敛到 $1$。与之对比,$\int_{1}^{\infty}\dfrac{dx}{x}$:

$$\lim_{t\to\infty}\int_{1}^{t}\frac{dx}{x}=\lim_{t\to\infty}\big[\ln x\big]_{1}^{t}=\lim_{t\to\infty}\ln t=\infty,$$

发散。两个被积函数都趋向 $0$,但只有第一个围出有限面积。衰减速度必须足够快,而 $1/x$ 恰好处于临界点 $p=1$ 处。

Worked Example 1.2: an exponential tail例题 1.2:指数衰减的尾部

Evaluate $\int_{0}^{\infty} e^{-x}\,dx$.

$$\int_{0}^{\infty} e^{-x}\,dx=\lim_{t\to\infty}\big[-e^{-x}\big]_{0}^{t}=\lim_{t\to\infty}\big(1-e^{-t}\big)=1.$$

Exponential decay always wins: $\int_{0}^{\infty}e^{-kx}\,dx=1/k$ for any $k>0$.

计算 $\int_{0}^{\infty} e^{-x}\,dx$:

$$\int_{0}^{\infty} e^{-x}\,dx=\lim_{t\to\infty}\big[-e^{-x}\big]_{0}^{t}=\lim_{t\to\infty}\big(1-e^{-t}\big)=1.$$

指数衰减总能保证收敛:对任意 $k>0$,$\int_{0}^{\infty}e^{-kx}\,dx=1/k$。

Worked Example 1.3: a doubly infinite integral, done correctly例题 1.3:双向无穷积分的正确处理

Evaluate $\int_{-\infty}^{\infty}\dfrac{dx}{1+x^{2}}$. Split at the convenient point $c=0$ and require each half to converge on its own:

$$\int_{0}^{\infty}\frac{dx}{1+x^{2}}=\lim_{t\to\infty}\big[\arctan x\big]_{0}^{t}=\lim_{t\to\infty}\arctan t=\frac{\pi}{2}.$$

By the evenness of the integrand the left half contributes the same amount,

$$\int_{-\infty}^{0}\frac{dx}{1+x^{2}}=\lim_{t\to-\infty}\big[\arctan x\big]_{t}^{0}=0-\Big(-\frac{\pi}{2}\Big)=\frac{\pi}{2}.$$

Both halves are finite, so the doubly infinite integral converges to $\tfrac{\pi}{2}+\tfrac{\pi}{2}=\pi$. The key discipline is that we evaluated two independent one-sided limits rather than a single symmetric limit.

计算 $\int_{-\infty}^{\infty}\dfrac{dx}{1+x^{2}}$。在 $c=0$ 处拆分,要求各段独立收敛:

$$\int_{0}^{\infty}\frac{dx}{1+x^{2}}=\lim_{t\to\infty}\big[\arctan x\big]_{0}^{t}=\lim_{t\to\infty}\arctan t=\frac{\pi}{2}.$$

由被积函数的偶函数性,左侧贡献相同:

$$\int_{-\infty}^{0}\frac{dx}{1+x^{2}}=\lim_{t\to-\infty}\big[\arctan x\big]_{t}^{0}=0-\Big(-\frac{\pi}{2}\Big)=\frac{\pi}{2}.$$

两段均有限,故积分收敛到 $\tfrac{\pi}{2}+\tfrac{\pi}{2}=\pi$。关键在于:我们计算了两个独立的单侧极限,而非一个对称极限。

Worked Example 1.4: a tail that decays yet still diverges例题 1.4:趋零但仍发散的尾部

Test $\int_{2}^{\infty}\dfrac{dx}{x\ln x}$. The integrand tends to $0$, yet the substitution $u=\ln x$, $du=dx/x$ exposes the truth:

$$\int_{2}^{\infty}\frac{dx}{x\ln x}=\lim_{t\to\infty}\int_{\ln 2}^{\ln t}\frac{du}{u}=\lim_{t\to\infty}\big[\ln u\big]_{\ln 2}^{\ln t}=\lim_{t\to\infty}\big(\ln\ln t-\ln\ln 2\big)=\infty.$$

The integral diverges. The lesson of Example 1.1 generalizes: an integrand vanishing at infinity is necessary but never sufficient for convergence. Here the decay is slower than every $1/x^{p}$ with $p>1$, so the area still accumulates without bound.

判断 $\int_{2}^{\infty}\dfrac{dx}{x\ln x}$。被积函数趋向 $0$,但换元 $u=\ln x$,$du=dx/x$ 揭示真相:

$$\int_{2}^{\infty}\frac{dx}{x\ln x}=\lim_{t\to\infty}\int_{\ln 2}^{\ln t}\frac{du}{u}=\lim_{t\to\infty}\big[\ln u\big]_{\ln 2}^{\ln t}=\lim_{t\to\infty}\big(\ln\ln t-\ln\ln 2\big)=\infty.$$

积分发散。这推广了例题 1.1 的结论:被积函数在无穷处趋零是收敛的必要条件,但远非充分条件。此处衰减比任何 $p>1$ 的 $1/x^p$ 都慢,故面积仍无限累积。

Common error.常见错误。 Students often "evaluate" $\int_{-\infty}^{\infty} x\,dx$ as $0$, reasoning that the integrand is odd. But $\int_{0}^{\infty} x\,dx=\lim_{t\to\infty}\tfrac{t^{2}}{2}=\infty$ diverges, so by the splitting rule the whole integral diverges and has no value. The symmetric limit $\lim_{t\to\infty}\int_{-t}^{t} x\,dx=0$ is the Cauchy principal value, a different and weaker notion. The correct procedure is always to split and demand each piece converge separately.学生常以被积函数为奇函数为由,"算出" $\int_{-\infty}^{\infty} x\,dx=0$。但 $\int_{0}^{\infty} x\,dx=\lim_{t\to\infty}\tfrac{t^{2}}{2}=\infty$ 发散,根据拆分规则,整个积分发散,没有值。对称极限 $\lim_{t\to\infty}\int_{-t}^{t} x\,dx=0$ 是柯西主值,是不同且更弱的概念。正确做法始终是拆分并要求每段各自收敛。
Going deeper: a clean proof of the $p$ test at infinity深入探讨:无穷处 $p$ 判别法的严格证明

We prove that $\int_{1}^{\infty} x^{-p}\,dx$ converges if and only if $p>1$. For $p\ne 1$, the antiderivative of $x^{-p}$ is $\dfrac{x^{1-p}}{1-p}$, so

$$\int_{1}^{t} x^{-p}\,dx=\frac{x^{1-p}}{1-p}\Big|_{1}^{t}=\frac{1}{1-p}\big(t^{1-p}-1\big).$$

As $t\to\infty$, the term $t^{1-p}$ tends to $0$ when the exponent $1-p<0$, that is $p>1$, and tends to $\infty$ when $1-p>0$, that is $p<1$. Hence

$$\int_{1}^{\infty} x^{-p}\,dx=\frac{1}{p-1}\quad(p>1),\qquad \text{and diverges for }p<1.$$

The remaining case $p=1$ is exactly Example 1.1: the antiderivative is $\ln t$, which diverges. So convergence holds precisely for $p>1$, and the boundary case $p=1$ falls on the divergent side. The mirror test at $0$ in the next section is proved the same way, with the limit taken as $t\to 0^{+}$ instead, which is why the inequality flips.

证明:$\int_{1}^{\infty} x^{-p}\,dx$ 收敛当且仅当 $p>1$。当 $p\ne 1$ 时,$x^{-p}$ 的原函数(antiderivative)为 $\dfrac{x^{1-p}}{1-p}$,故

$$\int_{1}^{t} x^{-p}\,dx=\frac{x^{1-p}}{1-p}\Big|_{1}^{t}=\frac{1}{1-p}\big(t^{1-p}-1\big).$$

令 $t\to\infty$:当指数 $1-p<0$(即 $p>1$)时,$t^{1-p}\to 0$;当 $1-p>0$(即 $p<1$)时,$t^{1-p}\to\infty$。故

$$\int_{1}^{\infty} x^{-p}\,dx=\frac{1}{p-1}\quad(p>1),\qquad \text{当 }p<1\text{ 时发散。}$$

剩余情形 $p=1$ 即例题 1.1:原函数为 $\ln t$,发散。因此收敛恰在 $p>1$ 时成立,临界情形 $p=1$ 属于发散一侧。下一节中零点处的镜像判别法采用完全相同的推导,只是极限方向改为 $t\to 0^{+}$,因此不等号方向翻转。

For which values of $p$ does $\int_{1}^{\infty} x^{-p}\,dx$ converge?对哪些 $p$ 值,$\int_{1}^{\infty} x^{-p}\,dx$ 收敛?
1.1
$p>1$
$p<1$
$p\ge 1$
all $p$所有 $p$
Correct. The antiderivative is $x^{1-p}/(1-p)$ for $p\ne 1$, whose limit at infinity is finite exactly when $1-p<0$, that is $p>1$. At $p=1$ the antiderivative is $\ln x$, which diverges.正确。当 $p\ne 1$ 时原函数为 $x^{1-p}/(1-p)$,其在无穷处极限有限当且仅当 $1-p<0$,即 $p>1$。当 $p=1$ 时原函数为 $\ln x$,发散。
Recall the antiderivative $x^{1-p}/(1-p)$. Its limit as $x\to\infty$ is finite only when the exponent $1-p$ is negative, so $p>1$. The case $p=1$ gives $\ln x$, which diverges.原函数为 $x^{1-p}/(1-p)$,其在 $x\to\infty$ 时极限有限,要求指数 $1-p$ 为负,即 $p>1$。$p=1$ 时得 $\ln x$,发散。

Discontinuous Integrands不连续被积函数

The second kind of improper integral has a finite interval but an integrand that blows up at an endpoint or at an interior point. The Riemann integral is undefined there, so again we retreat to a proper integral that stops short of the singularity and take a one-sided limit.第二类反常积分的区间有限,但被积函数在端点或内部某点趋于无穷大。黎曼积分在该处无定义,因此仍退回到在奇点前截止的常义积分,再取单侧极限。

Key idea.核心思想。 If $f$ has a vertical asymptote at an endpoint of $[a,b]$, integrate up to a point near it and let that point approach the singularity. If the bad point is interior, split the interval at it and treat the two halves independently; both must converge for the whole to converge.若 $f$ 在 $[a,b]$ 某端点处有铅直渐近线,则将积分上(下)限移近该点,再令其趋向奇点。若奇点在内部,在该点处拆分区间,分别处理两段;两段都收敛,整体才收敛。

Singularity at an endpoint端点处的奇点
$$\int_{a}^{b} f(x)\,dx=\lim_{t\to b^{-}}\int_{a}^{t} f(x)\,dx \quad(\text{bad point at }b),\qquad \int_{a}^{b} f(x)\,dx=\lim_{t\to a^{+}}\int_{t}^{b} f(x)\,dx \quad(\text{bad point at }a).$$
The $p$ test at $0$零点处 $p$ 判别法
$$\int_{0}^{1}\frac{dx}{x^{p}} \text{ converges if } p<1 \text{ and diverges if } p\ge 1.$$

Notice the inequality reverses relative to the test at infinity: near $0$ a mild singularity ($p<1$) is integrable, while near infinity mild decay ($p>1$) is needed. The two tests are mirror images.注意不等号方向与无穷处判别法相反:在 $0$ 处,较弱的奇性($p<1$)可积;在无穷处,需要足够快的衰减($p>1$)。两个判别法互为镜像。

Worked Example 2.1: integrable endpoint singularity例题 2.1:端点处可积的奇性

Evaluate $\int_{0}^{1}\dfrac{dx}{\sqrt{x}}$. The integrand is unbounded as $x\to 0^{+}$. Here $p=\tfrac12<1$, so we expect convergence.

$$\int_{0}^{1}x^{-1/2}\,dx=\lim_{t\to 0^{+}}\big[2\sqrt{x}\big]_{t}^{1}=\lim_{t\to 0^{+}}\big(2-2\sqrt{t}\big)=2.$$

The area is finite even though the curve climbs to infinity at the left edge.

计算 $\int_{0}^{1}\dfrac{dx}{\sqrt{x}}$。被积函数在 $x\to 0^{+}$ 时无界,此处 $p=\tfrac12<1$,预期收敛。

$$\int_{0}^{1}x^{-1/2}\,dx=\lim_{t\to 0^{+}}\big[2\sqrt{x}\big]_{t}^{1}=\lim_{t\to 0^{+}}\big(2-2\sqrt{t}\big)=2.$$

尽管曲线在左端点趋向无穷大,面积仍然有限。

Worked Example 2.2: an interior singularity that hides divergence例题 2.2:隐藏发散的内部奇点

Consider $\int_{-1}^{1}\dfrac{dx}{x^{2}}$. The integrand blows up at the interior point $x=0$, so we must split:

$$\int_{-1}^{1}\frac{dx}{x^{2}}=\int_{-1}^{0}\frac{dx}{x^{2}}+\int_{0}^{1}\frac{dx}{x^{2}}.$$

Each half is a $p=2$ integral at $0$, hence diverges:

$$\int_{0}^{1}x^{-2}\,dx=\lim_{t\to 0^{+}}\Big[-\frac{1}{x}\Big]_{t}^{1}=\lim_{t\to 0^{+}}\Big(-1+\frac{1}{t}\Big)=\infty.$$

The integral diverges. Naively applying the power rule across $x=0$ gives the absurd answer $-2$; this is exactly the trap that the split is designed to expose.

考虑 $\int_{-1}^{1}\dfrac{dx}{x^{2}}$。被积函数在内部点 $x=0$ 处爆炸,必须拆分:

$$\int_{-1}^{1}\frac{dx}{x^{2}}=\int_{-1}^{0}\frac{dx}{x^{2}}+\int_{0}^{1}\frac{dx}{x^{2}}.$$

每段都是零点处 $p=2$ 的反常积分(improper integral),故发散:

$$\int_{0}^{1}x^{-2}\,dx=\lim_{t\to 0^{+}}\Big[-\frac{1}{x}\Big]_{t}^{1}=\lim_{t\to 0^{+}}\Big(-1+\frac{1}{t}\Big)=\infty.$$

整个积分发散。直接跨越 $x=0$ 套用幂函数求导公式会得到荒谬答案 $-2$;拆分恰好是为了避开这一陷阱。

Worked Example 2.3: a borderline logarithmic singularity例题 2.3:对数型临界奇性

Evaluate $\int_{0}^{1}\ln x\,dx$. The integrand is unbounded as $x\to 0^{+}$ (it tends to $-\infty$), so this is improper at the left endpoint. Integrate by parts with $u=\ln x$, $dv=dx$:

$$\int_{t}^{1}\ln x\,dx=\big[x\ln x-x\big]_{t}^{1}=(0-1)-(t\ln t-t)=-1-t\ln t+t.$$

As $t\to 0^{+}$ the product $t\ln t\to 0$ (the linear factor beats the logarithm), so

$$\int_{0}^{1}\ln x\,dx=\lim_{t\to 0^{+}}\big(-1-t\ln t+t\big)=-1.$$

The integral converges even though the integrand is unbounded, because the singularity is only logarithmic, far milder than any power $x^{-p}$ with $p\ge 1$.

计算 $\int_{0}^{1}\ln x\,dx$。被积函数在 $x\to 0^{+}$ 时趋向 $-\infty$,故在左端点处为反常积分。用分部积分法,令 $u=\ln x$,$dv=dx$:

$$\int_{t}^{1}\ln x\,dx=\big[x\ln x-x\big]_{t}^{1}=(0-1)-(t\ln t-t)=-1-t\ln t+t.$$

当 $t\to 0^{+}$ 时,$t\ln t\to 0$(线性因子压过对数),故

$$\int_{0}^{1}\ln x\,dx=\lim_{t\to 0^{+}}\big(-1-t\ln t+t\big)=-1.$$

虽然被积函数无界,积分仍收敛,因为此处奇性仅为对数级,远弱于任何 $p\ge 1$ 的 $x^{-p}$。

Worked Example 2.4: singular and infinite at once例题 2.4:同时含奇点与无穷区间

Some integrals are improper for both reasons. Consider $\int_{0}^{\infty}\dfrac{dx}{\sqrt{x}\,(1+x)}$, unbounded at $x=0$ and over an infinite interval. Split at $x=1$ to isolate the two defects:

$$\int_{0}^{\infty}\frac{dx}{\sqrt{x}\,(1+x)}=\int_{0}^{1}\frac{dx}{\sqrt{x}\,(1+x)}+\int_{1}^{\infty}\frac{dx}{\sqrt{x}\,(1+x)}.$$

Near $0$ the integrand behaves like $x^{-1/2}$, an integrable singularity ($p=\tfrac12<1$); near infinity it behaves like $x^{-3/2}$, a convergent tail ($p=\tfrac32>1$). Both pieces converge, so the whole does. The substitution $x=u^{2}$, $dx=2u\,du$ even gives the exact value:

$$\int_{0}^{\infty}\frac{2u\,du}{u\,(1+u^{2})}=2\int_{0}^{\infty}\frac{du}{1+u^{2}}=2\cdot\frac{\pi}{2}=\pi.$$

有些积分同时具有两种反常性。考虑 $\int_{0}^{\infty}\dfrac{dx}{\sqrt{x}\,(1+x)}$,在 $x=0$ 处无界且区间无穷。在 $x=1$ 处拆分,分离两处"缺陷":

$$\int_{0}^{\infty}\frac{dx}{\sqrt{x}\,(1+x)}=\int_{0}^{1}\frac{dx}{\sqrt{x}\,(1+x)}+\int_{1}^{\infty}\frac{dx}{\sqrt{x}\,(1+x)}.$$

在 $0$ 附近被积函数行为如 $x^{-1/2}$,可积奇性($p=\tfrac12<1$);在无穷远处行为如 $x^{-3/2}$,收敛尾部($p=\tfrac32>1$)。两段均收敛,整体收敛。令 $x=u^{2}$,$dx=2u\,du$ 还可得到精确值:

$$\int_{0}^{\infty}\frac{2u\,du}{u\,(1+u^{2})}=2\int_{0}^{\infty}\frac{du}{1+u^{2}}=2\cdot\frac{\pi}{2}=\pi.$$
Common error.常见错误。 Applying the Fundamental Theorem of Calculus across an interior singularity gives nonsense. For $\int_{-1}^{1} x^{-2}\,dx$, writing $[-x^{-1}]_{-1}^{1}=-1-1=-2$ ignores that the antiderivative is undefined at $x=0$; the integral in fact diverges. Always scan the interval for points where the integrand is unbounded before you antidifferentiate, and split there.跨越内部奇点直接套用微积分基本定理(FTC)会得到错误结果。对 $\int_{-1}^{1} x^{-2}\,dx$,写成 $[-x^{-1}]_{-1}^{1}=-1-1=-2$ 忽略了原函数在 $x=0$ 处无定义;实际上该积分发散。在求原函数之前,始终要扫查区间内被积函数无界的点,并在该处拆分。
Going deeper: the $p$ test at $0$, and why the inequality flips深入探讨:零点处 $p$ 判别法与不等号翻转的原因

We show $\int_{0}^{1} x^{-p}\,dx$ converges if and only if $p<1$. For $p\ne 1$,

$$\int_{t}^{1} x^{-p}\,dx=\frac{x^{1-p}}{1-p}\Big|_{t}^{1}=\frac{1}{1-p}\big(1-t^{1-p}\big).$$

Now let $t\to 0^{+}$. The term $t^{1-p}$ tends to $0$ when the exponent $1-p>0$, that is $p<1$, and blows up when $1-p<0$, that is $p>1$. Therefore

$$\int_{0}^{1} x^{-p}\,dx=\frac{1}{1-p}\quad(p<1),\qquad\text{and diverges for }p>1.$$

The case $p=1$ gives $[\ln x]_{t}^{1}=-\ln t\to\infty$, divergent. Compare with the test at infinity: there we needed $t^{1-p}\to 0$ as $t\to\infty$, which forced $1-p<0$. Near $0$ we need $t^{1-p}\to 0$ as $t\to 0^{+}$, which forces $1-p>0$. The same algebra, evaluated at opposite ends of the real line, flips the inequality. This duality is worth memorizing: small $p$ tames a singularity at $0$, large $p$ tames a tail at infinity.

证明:$\int_{0}^{1} x^{-p}\,dx$ 收敛当且仅当 $p<1$。当 $p\ne 1$ 时,

$$\int_{t}^{1} x^{-p}\,dx=\frac{x^{1-p}}{1-p}\Big|_{t}^{1}=\frac{1}{1-p}\big(1-t^{1-p}\big).$$

令 $t\to 0^{+}$:当 $1-p>0$(即 $p<1$)时,$t^{1-p}\to 0$;当 $1-p<0$(即 $p>1$)时,$t^{1-p}$ 爆炸。因此

$$\int_{0}^{1} x^{-p}\,dx=\frac{1}{1-p}\quad(p<1),\qquad p>1\text{ 时发散。}$$

$p=1$ 时得 $[\ln x]_{t}^{1}=-\ln t\to\infty$,发散。与无穷处判别法对比:在那里需要 $t^{1-p}\to 0$($t\to\infty$),迫使 $1-p<0$;在零点处需要 $t^{1-p}\to 0$($t\to 0^{+}$),迫使 $1-p>0$。同一套代数,在数轴两端求极限,不等号方向翻转。值得记住:小 $p$ 驯服零点处的奇性,大 $p$ 驯服无穷处的尾部。

The integral $\displaystyle\int_{-1}^{1}\frac{dx}{x^{2}}$:积分 $\displaystyle\int_{-1}^{1}\frac{dx}{x^{2}}$:
2.1
equals $-2$等于 $-2$
equals $2$等于 $2$
equals $0$ by symmetry由对称性等于 $0$
diverges发散
Correct. The integrand is unbounded at the interior point $x=0$. Splitting there, each half is a $p=2$ integral at $0$ and diverges, so the whole integral diverges. Applying the power rule blindly gives the false value $-2$.正确。被积函数在内部点 $x=0$ 处无界。在该处拆分,每段都是零点处 $p=2$ 的反常积分,发散,故整个积分发散。盲目套用幂函数规则给出错误值 $-2$。
The integrand has a singularity at the interior point $x=0$, so you must split the interval there before integrating. Each piece is a $p=2$ improper integral at $0$, which diverges, so the full integral diverges.被积函数在内部点 $x=0$ 处有奇点,必须在该处拆分区间再积分。每段都是零点处 $p=2$ 的反常积分,发散,故整个积分发散。

The Comparison Test比较判别法

Many improper integrals cannot be evaluated in closed form, yet we still wish to know whether they converge. The comparison test settles convergence by bounding the integrand between functions whose integrals we already understand. It is the integral analogue of the comparison test for series.许多反常积分无法用初等函数写出封闭表达式,但我们仍想知道它们是否收敛。比较判别法(comparison test)通过将被积函数夹在已知积分的函数之间来判断收敛性,是级数比较判别法在积分中的对应版本。

Key idea.核心思想。 Convergence is governed by the size of the integrand near the trouble spot. If a nonnegative integrand is dominated by a convergent one, it converges; if it dominates a divergent one, it diverges. A smaller nonnegative area cannot escape to infinity, and a larger one cannot be tamed.收敛性由被积函数在"问题点"附近的大小决定。若一个非负被积函数被某个收敛积分的被积函数控制,则它收敛;若它控制某个发散积分的被积函数,则它发散。较小的非负面积不能逃至无穷,较大的面积也无法被约束。

Direct Comparison Test直接比较判别法
$$\text{If } 0\le f(x)\le g(x) \text{ on } [a,\infty): \quad \int_a^{\infty} g \text{ converges} \Rightarrow \int_a^{\infty} f \text{ converges}; \quad \int_a^{\infty} f \text{ diverges} \Rightarrow \int_a^{\infty} g \text{ diverges}.$$
Limit Comparison Test极限比较判别法
$$\text{If } f,g>0 \text{ and } \lim_{x\to\infty}\frac{f(x)}{g(x)}=L \text{ with } 0

The direct test needs a clean inequality; the limit test needs only matching growth rates, so it is often easier in practice. Pair either with the $p$ tests, which supply the standard yardsticks $1/x^p$.直接比较需要明确的不等式;极限比较只需要增长率相当,实践中往往更易操作。两者都可与 $p$ 判别法配合,后者提供标准参照 $1/x^p$。

Worked Example 3.1: convergence by direct comparison例题 3.1:用直接比较证明收敛

Show that $\int_{1}^{\infty}\dfrac{dx}{x^{2}+1}$ converges. For $x\ge 1$ we have $x^{2}+1>x^{2}$, so

$$0<\frac{1}{x^{2}+1}<\frac{1}{x^{2}}.$$

Since $\int_{1}^{\infty}x^{-2}\,dx$ converges (a $p=2$ integral), the smaller integral converges as well. We need not evaluate it, though in this case the exact value is $\arctan(\infty)-\arctan(1)=\tfrac{\pi}{2}-\tfrac{\pi}{4}=\tfrac{\pi}{4}$.

证明 $\int_{1}^{\infty}\dfrac{dx}{x^{2}+1}$ 收敛。对 $x\ge 1$ 有 $x^{2}+1>x^{2}$,故

$$0<\frac{1}{x^{2}+1}<\frac{1}{x^{2}}.$$

由于 $\int_{1}^{\infty}x^{-2}\,dx$ 收敛($p=2$ 积分),较小的积分也收敛。无需求出其值,但此处精确值为 $\arctan(\infty)-\arctan(1)=\tfrac{\pi}{2}-\tfrac{\pi}{4}=\tfrac{\pi}{4}$。

Worked Example 3.2: divergence by limit comparison例题 3.2:用极限比较证明发散

Decide whether $\int_{2}^{\infty}\dfrac{x}{\sqrt{x^{4}-1}}\,dx$ converges. For large $x$ the integrand behaves like $x/\sqrt{x^{4}}=1/x$, so compare with $g(x)=1/x$:

$$\lim_{x\to\infty}\frac{x/\sqrt{x^{4}-1}}{1/x}=\lim_{x\to\infty}\frac{x^{2}}{\sqrt{x^{4}-1}}=\lim_{x\to\infty}\frac{1}{\sqrt{1-x^{-4}}}=1.$$

The limit is finite and positive, so the given integral behaves like $\int_2^{\infty}dx/x$, which diverges. Hence the given integral diverges.

判断 $\int_{2}^{\infty}\dfrac{x}{\sqrt{x^{4}-1}}\,dx$ 是否收敛。对大 $x$,被积函数行为如 $x/\sqrt{x^{4}}=1/x$,取 $g(x)=1/x$ 进行极限比较:

$$\lim_{x\to\infty}\frac{x/\sqrt{x^{4}-1}}{1/x}=\lim_{x\to\infty}\frac{x^{2}}{\sqrt{x^{4}-1}}=\lim_{x\to\infty}\frac{1}{\sqrt{1-x^{-4}}}=1.$$

极限有限且为正,故所给积分与 $\int_2^{\infty}dx/x$ 同命运,后者发散,故所给积分发散。

Worked Example 3.3: a trigonometric numerator bounded by comparison例题 3.3:用比较控制三角函数分子

Show that $\int_{1}^{\infty}\dfrac{2+\sin x}{x^{2}}\,dx$ converges. The numerator oscillates but stays bounded: $1\le 2+\sin x\le 3$ for all $x$. Hence

$$0<\frac{2+\sin x}{x^{2}}\le \frac{3}{x^{2}}.$$

Since $\int_{1}^{\infty} 3x^{-2}\,dx=3$ converges, the direct comparison test forces the smaller integral to converge as well. Notice the integrand is not monotone and has no elementary antiderivative, yet comparison settles convergence cleanly without any evaluation.

证明 $\int_{1}^{\infty}\dfrac{2+\sin x}{x^{2}}\,dx$ 收敛。分子振荡但有界:对所有 $x$,$1\le 2+\sin x\le 3$。故

$$0<\frac{2+\sin x}{x^{2}}\le \frac{3}{x^{2}}.$$

由于 $\int_{1}^{\infty} 3x^{-2}\,dx=3$ 收敛,直接比较判别法保证较小积分也收敛。注意被积函数不单调,也没有初等原函数,但比较法干净地解决了收敛问题,无需任何计算。

Worked Example 3.4: comparison at a singular endpoint例题 3.4:奇异端点处的比较

The comparison test works equally well for integrands singular at a finite endpoint. Decide whether $\int_{0}^{1}\dfrac{dx}{\sqrt{x+x^{3}}}$ converges. Near $x=0$ the cube term is negligible, so the integrand behaves like $x^{-1/2}$. Use limit comparison with $g(x)=x^{-1/2}$:

$$\lim_{x\to 0^{+}}\frac{1/\sqrt{x+x^{3}}}{1/\sqrt{x}}=\lim_{x\to 0^{+}}\sqrt{\frac{x}{x+x^{3}}}=\lim_{x\to 0^{+}}\frac{1}{\sqrt{1+x^{2}}}=1.$$

The limit is finite and positive, and $\int_{0}^{1} x^{-1/2}\,dx$ converges ($p=\tfrac12<1$), so the given integral converges too. The limit comparison test reads off convergence from leading behavior at the trouble spot, whether that spot is $\infty$ or a finite singularity.

比较判别法同样适用于有限端点处的奇点。判断 $\int_{0}^{1}\dfrac{dx}{\sqrt{x+x^{3}}}$ 是否收敛。在 $x=0$ 附近,三次项可忽略,被积函数行为如 $x^{-1/2}$。用 $g(x)=x^{-1/2}$ 做极限比较:

$$\lim_{x\to 0^{+}}\frac{1/\sqrt{x+x^{3}}}{1/\sqrt{x}}=\lim_{x\to 0^{+}}\sqrt{\frac{x}{x+x^{3}}}=\lim_{x\to 0^{+}}\frac{1}{\sqrt{1+x^{2}}}=1.$$

极限有限且为正,而 $\int_{0}^{1} x^{-1/2}\,dx$ 收敛($p=\tfrac12<1$),故所给积分也收敛。极限比较判别法从"问题点"处的主项行为直接读出收敛性,无论该点在无穷处还是有限奇点处。

Common error.常见错误。 The comparison test for integrals requires the integrand to be nonnegative (or eventually of one sign). Applying direct comparison to a sign-changing integrand such as $\frac{\sin x}{x}$ is invalid: $\big|\frac{\sin x}{x}\big|\le\frac1x$ does not prove convergence because $\int_1^{\infty}\frac{dx}{x}$ diverges, and in fact $\int_1^{\infty}\frac{\sin x}{x}\,dx$ converges only conditionally. For signed integrands, test absolute convergence or use a sharper tool; a one-sided bound alone decides nothing.积分的比较判别法要求被积函数非负(或最终同号)。对变号被积函数如 $\frac{\sin x}{x}$ 直接套用比较法无效:$\big|\frac{\sin x}{x}\big|\le\frac1x$ 不能证明收敛,因为 $\int_1^{\infty}\frac{dx}{x}$ 发散,事实上 $\int_1^{\infty}\frac{\sin x}{x}\,dx$ 只是条件收敛。对有正有负的被积函数,应检验绝对收敛性或使用更精细的工具;单侧估计不足以作出任何判断。
Going deeper: proof of the direct comparison test深入探讨:直接比较判别法的证明

Suppose $0\le f(x)\le g(x)$ for $x\ge a$ and $\int_a^{\infty} g$ converges. Define the tail-area function $F(t)=\int_a^{t} f(x)\,dx$. Because $f\ge 0$, $F$ is nondecreasing in $t$. Because $f\le g$,

$$F(t)=\int_a^{t} f\le \int_a^{t} g\le \int_a^{\infty} g=:M<\infty.$$

So $F$ is nondecreasing and bounded above by $M$. A monotone function bounded above has a finite limit (the monotone convergence property of the real numbers), hence $\lim_{t\to\infty} F(t)$ exists and is at most $M$. That limit is exactly $\int_a^{\infty} f$, which therefore converges. The divergence half is the contrapositive: if $\int_a^{\infty} f$ diverged while $f\le g$, then $\int_a^{\infty} g$ would have to diverge as well. The argument is the integral twin of the comparison test for series, with "bounded monotone partial sums" replaced by "bounded monotone partial areas."

设对 $x\ge a$ 有 $0\le f(x)\le g(x)$,且 $\int_a^{\infty} g$ 收敛。定义尾部面积函数 $F(t)=\int_a^{t} f(x)\,dx$。因 $f\ge 0$,$F$ 关于 $t$ 单调不减。因 $f\le g$,

$$F(t)=\int_a^{t} f\le \int_a^{t} g\le \int_a^{\infty} g=:M<\infty.$$

故 $F$ 单调不减且有上界 $M$。有上界的单调函数有有限极限(实数的单调收敛性质),因此 $\lim_{t\to\infty} F(t)$ 存在且不超过 $M$。该极限即为 $\int_a^{\infty} f$,故其收敛。发散的部分为逆否命题:若 $\int_a^{\infty} f$ 发散而 $f\le g$,则 $\int_a^{\infty} g$ 也必然发散。这一论证是级数比较判别法在积分中的对应,只是将"有界单调部分和"换成了"有界单调部分面积"。

To test $\displaystyle\int_{1}^{\infty}\frac{dx}{x^{3}+x}$ by limit comparison, the natural comparison function is:用极限比较判别法检验 $\displaystyle\int_{1}^{\infty}\frac{dx}{x^{3}+x}$,最自然的比较函数是:
3.1
$1/x$
$1/x^{3}$
$1/x^{2}$
$e^{-x}$
Correct. For large $x$ the dominant term in the denominator is $x^{3}$, so the integrand behaves like $1/x^{3}$. The limit of the ratio is $1$, and since $\int_1^{\infty}x^{-3}\,dx$ converges ($p=3$), so does the original.正确。对大 $x$,分母的主项为 $x^{3}$,故被积函数行为如 $1/x^{3}$。比值的极限为 $1$,由于 $\int_1^{\infty}x^{-3}\,dx$ 收敛($p=3$),原积分也收敛。
Match the leading behavior of the denominator for large $x$. Here $x^{3}+x\approx x^{3}$, so the integrand is asymptotic to $1/x^{3}$, which is the right yardstick.匹配大 $x$ 时分母的主项:$x^{3}+x\approx x^{3}$,故被积函数渐近于 $1/x^{3}$,这才是正确的参照。

The Trapezoidal Rule梯形法则

When an antiderivative is unavailable or the integrand is known only at sample points, we approximate $\int_a^b f(x)\,dx$ numerically. Partition $[a,b]$ into $n$ subintervals of equal width $h=(b-a)/n$ with nodes $x_i=a+ih$. The trapezoidal rule replaces $f$ on each subinterval by the straight line through its endpoints and sums the resulting trapezoid areas.当原函数(antiderivative)无法求出,或被积函数只在离散采样点处已知时,我们对 $\int_a^b f(x)\,dx$ 进行数值逼近。将 $[a,b]$ 等分为 $n$ 段,步长 $h=(b-a)/n$,节点 $x_i=a+ih$。梯形法则(trapezoidal rule)用每段两端点确定的直线代替 $f$,累加所有梯形面积。

Key idea.核心思想。 The trapezoidal rule approximates the curve by a piecewise linear interpolant. Each trapezoid has area $\tfrac{h}{2}(f(x_{i-1})+f(x_i))$; summing telescopes the interior weights to $2$, giving the familiar $1,2,2,\dots,2,1$ pattern.梯形法则用分段线性插值逼近曲线。每个梯形面积为 $\tfrac{h}{2}(f(x_{i-1})+f(x_i))$;求和后内部节点权重叠加为 $2$,形成熟悉的 $1,2,2,\dots,2,1$ 权重模式。

Trapezoidal Rule梯形法则公式
$$T_n=\frac{h}{2}\Big[f(x_0)+2f(x_1)+2f(x_2)+\cdots+2f(x_{n-1})+f(x_n)\Big],\qquad h=\frac{b-a}{n}.$$

The endpoints carry weight $1$ because each contributes to a single trapezoid; every interior node is shared by two trapezoids and so carries weight $2$. For a concave-down integrand the chords lie below the curve, so $T_n$ underestimates; for concave-up, $T_n$ overestimates.端点权重为 $1$,因为各自只属于一个梯形;每个内部节点被两个梯形共享,故权重为 $2$。对凹(上凸)的被积函数,弦在曲线下方,$T_n$ 低估;对凸(下凸)函数,$T_n$ 高估。

Worked Example 4.1: estimating $\int_0^1 e^{-x^2}\,dx$ with $n=4$例题 4.1:用 $n=4$ 估计 $\int_0^1 e^{-x^2}\,dx$

This integrand has no elementary antiderivative, so numerical methods are essential. With $n=4$, $h=0.25$ and nodes $0,0.25,0.5,0.75,1$:

$$f(0)=1,\ f(0.25)=0.9394,\ f(0.5)=0.7788,\ f(0.75)=0.5698,\ f(1)=0.3679.$$ $$T_4=\frac{0.25}{2}\big[1+2(0.9394)+2(0.7788)+2(0.5698)+0.3679\big]=0.125\,(5.9439)=0.7430.$$

The true value is about $0.7468$, so the error is roughly $0.0038$. Doubling $n$ would cut the error by about a factor of four.

此被积函数无初等原函数,数值方法必不可少。取 $n=4$,$h=0.25$,节点 $0,0.25,0.5,0.75,1$:

$$f(0)=1,\ f(0.25)=0.9394,\ f(0.5)=0.7788,\ f(0.75)=0.5698,\ f(1)=0.3679.$$ $$T_4=\frac{0.25}{2}\big[1+2(0.9394)+2(0.7788)+2(0.5698)+0.3679\big]=0.125\,(5.9439)=0.7430.$$

真实值约为 $0.7468$,误差约 $0.0038$。将 $n$ 加倍,误差大约减小四倍。

Worked Example 4.2: trapezoidal rule from a table of data例题 4.2:从数据表格应用梯形法则

Numerical rules shine when $f$ is known only at sample points. A sensor reports a flow rate $f(t)$ (in liters per second) at five equally spaced times over $[0,4]$ seconds, $h=1$:

$$f(0)=0,\ f(1)=3,\ f(2)=5,\ f(3)=4,\ f(4)=2.$$

The total volume is $\int_0^4 f\,dt$, estimated by

$$T_4=\frac{1}{2}\big[f(0)+2f(1)+2f(2)+2f(3)+f(4)\big]=\frac12\big[0+6+10+8+2\big]=\frac12(26)=13\ \text{liters}.$$

No formula for $f$ is needed; the trapezoidal rule only consumes the sampled values, which is why it is the workhorse of experimental data reduction.

当 $f$ 只在采样点处已知时,数值法大显身手。一个传感器在 $[0,4]$ 秒内五个等间距时刻报告流量 $f(t)$(升/秒),$h=1$:

$$f(0)=0,\ f(1)=3,\ f(2)=5,\ f(3)=4,\ f(4)=2.$$

总体积为 $\int_0^4 f\,dt$,估计为

$$T_4=\frac{1}{2}\big[f(0)+2f(1)+2f(2)+2f(3)+f(4)\big]=\frac12\big[0+6+10+8+2\big]=\frac12(26)=13\ \text{升}.$$

无需知道 $f$ 的解析式;梯形法则只消耗采样值,这正是它成为实验数据处理主力工具的原因。

Worked Example 4.3: over- or under-estimate from concavity例题 4.3:由凹凸性判断高估或低估

Estimate $\int_0^1 e^{x}\,dx$ with $n=2$, $h=0.5$, and decide whether the estimate is high or low. Nodes $0,0.5,1$ give $f=1,\ e^{0.5}\approx1.6487,\ e\approx2.7183$:

$$T_2=\frac{0.5}{2}\big[1+2(1.6487)+2.7183\big]=0.25\,(7.0157)=1.7539.$$

The exact value is $e-1\approx1.7183$, so $T_2$ overestimates. That is expected: $e^{x}$ is concave up, so each chord lies above the curve and every trapezoid overshoots. For a concave-up integrand the trapezoidal rule always overestimates, and for concave-down it always underestimates, a fact worth using as a sanity check.

用 $n=2$,$h=0.5$ 估计 $\int_0^1 e^{x}\,dx$,并判断结果偏高还是偏低。节点 $0,0.5,1$ 给出 $f=1,\ e^{0.5}\approx1.6487,\ e\approx2.7183$:

$$T_2=\frac{0.5}{2}\big[1+2(1.6487)+2.7183\big]=0.25\,(7.0157)=1.7539.$$

精确值为 $e-1\approx1.7183$,$T_2$ 高估。这是预料之中的:$e^{x}$ 下凸(函数图像向上弯曲),每段弦在曲线上方,梯形偏大。对下凸函数,梯形法则总是高估;对上凸函数,总是低估,此规律可用于合理性验证。

Common error.常见错误。 A frequent slip is to multiply by $h/2$ but forget to double the interior values, computing $\frac{h}{2}[f(x_0)+f(x_1)+\cdots+f(x_n)]$. That formula is wrong: only the two endpoints carry weight $1$, while every interior node, shared by two trapezoids, carries weight $2$. A quick check is that the weights must sum to $2n$ before the $h/2$ factor, since $\frac{h}{2}\cdot 2n=nh=b-a$ reproduces the area of a constant function $f\equiv 1$.常见失误是乘以 $h/2$ 时忘记将内部值乘以 $2$,算成 $\frac{h}{2}[f(x_0)+f(x_1)+\cdots+f(x_n)]$。该公式错误:只有两个端点权重为 $1$,每个内部节点被两个梯形共享,权重为 $2$。快速验证:在乘以 $h/2$ 之前,权重之和必须为 $2n$,因为 $\frac{h}{2}\cdot 2n=nh=b-a$ 正好再现常值函数 $f\equiv 1$ 的面积。
Going deeper: deriving the rule by summing trapezoid areas深入探讨:由梯形面积求和推导公式

On the subinterval $[x_{i-1},x_i]$, replace $f$ by the chord joining $(x_{i-1},f(x_{i-1}))$ and $(x_i,f(x_i))$. The region under that chord is a trapezoid of parallel sides $f(x_{i-1})$ and $f(x_i)$ and width $h$, so its area is $\tfrac{h}{2}\big(f(x_{i-1})+f(x_i)\big)$. Summing over all $n$ subintervals,

$$T_n=\sum_{i=1}^{n}\frac{h}{2}\big(f(x_{i-1})+f(x_i)\big)=\frac{h}{2}\sum_{i=1}^{n}\big(f(x_{i-1})+f(x_i)\big).$$

In this telescoped sum, $f(x_0)$ and $f(x_n)$ each appear once (only one trapezoid touches each endpoint), whereas every interior $f(x_k)$ appears twice (it is the right end of one trapezoid and the left end of the next). Collecting like terms,

$$T_n=\frac{h}{2}\Big[f(x_0)+2f(x_1)+\cdots+2f(x_{n-1})+f(x_n)\Big],$$

which is precisely the boxed formula. The $1,2,2,\dots,2,1$ weight pattern is not a convention to memorize; it is forced by how many trapezoids share each node.

在子区间 $[x_{i-1},x_i]$ 上,用连接 $(x_{i-1},f(x_{i-1}))$ 和 $(x_i,f(x_i))$ 的弦替代 $f$。弦下方的区域是宽为 $h$、两平行边分别为 $f(x_{i-1})$ 和 $f(x_i)$ 的梯形,面积为 $\tfrac{h}{2}\big(f(x_{i-1})+f(x_i)\big)$。对所有 $n$ 段求和,

$$T_n=\sum_{i=1}^{n}\frac{h}{2}\big(f(x_{i-1})+f(x_i)\big)=\frac{h}{2}\sum_{i=1}^{n}\big(f(x_{i-1})+f(x_i)\big).$$

在这个叠缩求和中,$f(x_0)$ 和 $f(x_n)$ 各出现一次(各端点只属于一个梯形),而每个内部 $f(x_k)$ 出现两次(它既是一个梯形的右端,也是下一个梯形的左端)。合并同类项,

$$T_n=\frac{h}{2}\Big[f(x_0)+2f(x_1)+\cdots+2f(x_{n-1})+f(x_n)\Big],$$

正是方框中的公式。$1,2,2,\dots,2,1$ 权重模式不是需要记忆的约定,而是由每个节点被多少个梯形共享所决定的。

In the trapezoidal rule, the interior nodes carry weight:在梯形法则中,内部节点的权重为:
4.1
$1$
$4$
$2$
alternating $1$ and $2$交替 $1$ 和 $2$
Correct. Each interior node is shared by two adjacent trapezoids, so its contributions add to weight $2$. Only the two endpoints, belonging to a single trapezoid each, carry weight $1$.正确。每个内部节点被两个相邻梯形共享,权重叠加为 $2$。只有两个端点各属于一个梯形,权重为 $1$。
Interior nodes are shared by two adjacent trapezoids, so their weights add to $2$. The alternating $1,4,2,4$ pattern belongs to Simpson's rule, not the trapezoidal rule.内部节点被两个相邻梯形共享,权重叠加为 $2$。交替 $1,4,2,4$ 模式属于辛普森法则,不属于梯形法则。

Simpson's Rule辛普森法则

Simpson's rule improves on the trapezoidal rule by fitting parabolas rather than lines. Over each pair of adjacent subintervals it interpolates $f$ at three nodes with a quadratic and integrates that quadratic exactly. Because two subintervals are consumed per parabola, $n$ must be even.辛普森法则(Simpson's rule)通过拟合抛物线(而非直线)改进梯形法则。在每两段相邻子区间上,用三个节点确定一条二次曲线,并对该二次曲线精确积分。由于每条抛物线覆盖两段子区间,$n$ 必须为偶数。

Key idea.核心思想。 Simpson's rule replaces the curve by piecewise parabolas through consecutive triples of nodes. Integrating a parabola through $x_{i-1},x_i,x_{i+1}$ yields the weights $1,4,1$ scaled by $h/3$; assembling the pieces gives the global pattern $1,4,2,4,2,\dots,4,1$.辛普森法则用通过连续三节点的分段抛物线代替曲线。对过 $x_{i-1},x_i,x_{i+1}$ 的抛物线积分,得到权重 $1,4,1$,系数 $h/3$;将各段拼合,形成全局模式 $1,4,2,4,2,\dots,4,1$。

Simpson's Rule ($n$ even)辛普森法则($n$ 为偶数)
$$S_n=\frac{h}{3}\Big[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+\cdots+2f(x_{n-2})+4f(x_{n-1})+f(x_n)\Big].$$

The weight $4$ falls on odd-indexed (interior) nodes and $2$ on even-indexed interior nodes; the endpoints keep weight $1$. A useful identity links the two rules: $S_{2n}=\tfrac{1}{3}(4T_{2n}-T_n)$, so Simpson's rule is a weighted average that cancels the leading trapezoidal error.奇数索引内部节点权重为 $4$,偶数索引内部节点权重为 $2$,端点权重为 $1$。两个法则有实用联系:$S_{2n}=\tfrac{1}{3}(4T_{2n}-T_n)$,辛普森法则是消去主要梯形误差的加权平均。

Worked Example 5.1: Simpson on $\int_0^1 e^{-x^2}\,dx$ with $n=4$例题 5.1:辛普森法则估计 $\int_0^1 e^{-x^2}\,dx$,$n=4$

Reusing the nodes from Example 4.1 with $h=0.25$:

$$S_4=\frac{0.25}{3}\big[1+4(0.9394)+2(0.7788)+4(0.5698)+0.3679\big].$$ $$S_4=\frac{0.25}{3}\big[1+3.7576+1.5576+2.2792+0.3679\big]=\frac{0.25}{3}(8.9623)=0.74686.$$

This matches the true value $0.74682$ to four decimals, far better than the trapezoidal estimate $0.7430$ at the same cost in function evaluations. Parabolic pieces capture the curvature that chords miss.

复用例题 4.1 的节点,$h=0.25$:

$$S_4=\frac{0.25}{3}\big[1+4(0.9394)+2(0.7788)+4(0.5698)+0.3679\big].$$ $$S_4=\frac{0.25}{3}\big[1+3.7576+1.5576+2.2792+0.3679\big]=\frac{0.25}{3}(8.9623)=0.74686.$$

与真实值 $0.74682$ 吻合到四位小数,远优于相同函数评估代价下梯形估计的 $0.7430$。抛物线能捕捉到弦所忽略的曲率。

Going deeper: why Simpson's rule integrates cubics exactly深入探讨:辛普森法则对三次多项式精确的原因

On $[-h,h]$ Simpson's rule reads $\tfrac{h}{3}\big(f(-h)+4f(0)+f(h)\big)$. Test it on $f(x)=x^3$. The exact integral is $\int_{-h}^{h}x^3\,dx=0$ by oddness. The rule gives

$$\frac{h}{3}\big((-h)^3+4\cdot 0+h^3\big)=\frac{h}{3}(0)=0,$$

which is exact. More generally the rule is built to be exact on quadratics (three nodes determine a parabola), and the cubic term integrates to zero on the symmetric interval and is also reproduced exactly. This extra degree of exactness is why Simpson's error scales like $h^4$ rather than $h^2$.

在 $[-h,h]$ 上,辛普森法则为 $\tfrac{h}{3}\big(f(-h)+4f(0)+f(h)\big)$。用 $f(x)=x^3$ 验证。精确积分由奇函数性质得 $\int_{-h}^{h}x^3\,dx=0$。法则给出

$$\frac{h}{3}\big((-h)^3+4\cdot 0+h^3\big)=\frac{h}{3}(0)=0,$$

精确。更一般地,辛普森法则对二次多项式精确(三点确定一条抛物线),而三次项在对称区间上积分为零,同样被精确再现。这一额外精度的度是辛普森误差按 $h^4$ 而非 $h^2$ 缩减的原因。

Worked Example 5.2: Simpson with $n=2$ on $\int_1^3 \tfrac1x\,dx$例题 5.2:$n=2$ 辛普森法则估计 $\int_1^3 \tfrac1x\,dx$

Approximate $\int_1^3\dfrac{dx}{x}$, whose exact value is $\ln 3\approx1.0986$. With $n=2$, $h=1$, nodes $1,2,3$ and $f=1,\tfrac12,\tfrac13$:

$$S_2=\frac{1}{3}\Big[f(1)+4f(2)+f(3)\Big]=\frac13\Big[1+4\cdot\tfrac12+\tfrac13\Big]=\frac13\Big[1+2+\tfrac13\Big]=\frac13\cdot\frac{10}{3}=\frac{10}{9}\approx1.1111.$$

Even with a single parabola the estimate is within about $0.013$ of $\ln 3$. The trapezoidal rule at the same two nodes would give $\tfrac12[1+2\cdot\tfrac12+\tfrac13]\cdot\dots$ a coarser $1.1667$, so Simpson's curvature correction already buys an order of magnitude.

近似 $\int_1^3\dfrac{dx}{x}$,精确值为 $\ln 3\approx1.0986$。取 $n=2$,$h=1$,节点 $1,2,3$,函数值 $f=1,\tfrac12,\tfrac13$:

$$S_2=\frac{1}{3}\Big[f(1)+4f(2)+f(3)\Big]=\frac13\Big[1+4\cdot\tfrac12+\tfrac13\Big]=\frac13\Big[1+2+\tfrac13\Big]=\frac13\cdot\frac{10}{3}=\frac{10}{9}\approx1.1111.$$

仅用一条抛物线,估计值与 $\ln 3$ 的误差约为 $0.013$。相同两段的梯形法则给出粗糙的 $1.1667$,辛普森的曲率修正已带来一个量级的改善。

Worked Example 5.3: Simpson's rule is exact on a quadratic例题 5.3:辛普森法则对二次多项式精确

Apply Simpson's rule to $\int_0^2 x^{2}\,dx$ with $n=2$, $h=1$. Nodes $0,1,2$ give $f=0,1,4$:

$$S_2=\frac{1}{3}\big[0+4(1)+4\big]=\frac{1}{3}(8)=\frac{8}{3}.$$

The exact value is $\int_0^2 x^2\,dx=\tfrac{8}{3}$, so Simpson's rule is exact, as it must be: the rule integrates the interpolating parabola exactly, and for a quadratic integrand the parabola is the function itself. This is the qualitative content of the error bound to come, whose $f^{(4)}$ factor vanishes for any cubic.

用 $n=2$,$h=1$ 对 $\int_0^2 x^{2}\,dx$ 应用辛普森法则。节点 $0,1,2$ 给出 $f=0,1,4$:

$$S_2=\frac{1}{3}\big[0+4(1)+4\big]=\frac{1}{3}(8)=\frac{8}{3}.$$

精确值为 $\int_0^2 x^2\,dx=\tfrac{8}{3}$,辛普森法则精确,这是必然的:该法则对插值抛物线精确积分,对二次被积函数,抛物线就是函数本身。这是下文误差界的定性内容,其 $f^{(4)}$ 因子对任意三次多项式均为零。

Common error.常见错误。 A common mistake is to apply Simpson's rule with an odd number of subintervals, or to scramble the weight pattern. The weights run $1,4,2,4,2,\dots,4,1$: a $4$ on every odd-indexed node and a $2$ on every even-indexed interior node, with $h/3$ (not $h/2$) out front. If $n$ is odd the parabolas cannot pair up the subintervals, and the formula simply does not apply; use $n$ even, or pair Simpson on the first $n-1$ pieces with a separate rule on the last one.常见错误是用奇数段应用辛普森法则,或将权重模式搞乱。权重序列为 $1,4,2,4,2,\dots,4,1$:奇数索引节点权重为 $4$,偶数索引内部节点权重为 $2$,前置系数为 $h/3$(不是 $h/2$)。若 $n$ 为奇数,抛物线无法成对覆盖所有子区间,公式根本不适用;请使用偶数 $n$,或对前 $n-1$ 段用辛普森,最后一段用别的方法。
Going deeper: deriving the $1,4,1$ weights from a parabola深入探讨:从抛物线推导 $1,4,1$ 权重

Fit a parabola $p(x)=Ax^{2}+Bx+C$ through three equally spaced nodes, taken as $-h,0,h$ for convenience. Then $p(-h)=Ah^{2}-Bh+C$, $p(0)=C$, $p(h)=Ah^{2}+Bh+C$. Integrate the parabola exactly:

$$\int_{-h}^{h} p(x)\,dx=\Big[\frac{A}{3}x^{3}+\frac{B}{2}x^{2}+Cx\Big]_{-h}^{h}=\frac{2A}{3}h^{3}+2Ch.$$

Now express this in terms of the three sampled values. A short computation gives

$$\frac{h}{3}\big[p(-h)+4p(0)+p(h)\big]=\frac{h}{3}\big[(Ah^{2}-Bh+C)+4C+(Ah^{2}+Bh+C)\big]=\frac{h}{3}\big[2Ah^{2}+6C\big]=\frac{2A}{3}h^{3}+2Ch.$$

The two expressions agree exactly, so $\tfrac{h}{3}(1,4,1)$ reproduces the integral of any parabola through the three nodes. Patching one such formula over each consecutive pair of subintervals and adding, the shared interior nodes (counted once on each side) acquire weight $2$, while the strictly interior odd nodes keep weight $4$. That assembly produces the global pattern $1,4,2,4,2,\dots,4,1$.

用三个等间距节点(取为 $-h,0,h$ 方便起见)拟合抛物线 $p(x)=Ax^{2}+Bx+C$。则 $p(-h)=Ah^{2}-Bh+C$,$p(0)=C$,$p(h)=Ah^{2}+Bh+C$。精确积分抛物线:

$$\int_{-h}^{h} p(x)\,dx=\Big[\frac{A}{3}x^{3}+\frac{B}{2}x^{2}+Cx\Big]_{-h}^{h}=\frac{2A}{3}h^{3}+2Ch.$$

用三个采样值表示这一结果,简单计算给出

$$\frac{h}{3}\big[p(-h)+4p(0)+p(h)\big]=\frac{h}{3}\big[2Ah^{2}+6C\big]=\frac{2A}{3}h^{3}+2Ch.$$

两式完全吻合,$\tfrac{h}{3}(1,4,1)$ 精确再现了三节点抛物线的积分。将该公式覆盖每两段连续子区间并求和,共享的内部节点(两侧各计一次)权重变为 $2$,而严格内部的奇数索引节点保持权重 $4$。组合后产生全局模式 $1,4,2,4,2,\dots,4,1$。

Simpson's rule requires that the number of subintervals $n$ be:辛普森法则要求子区间数 $n$ 为:
5.1
even偶数
odd奇数
a multiple of $3$$3$ 的倍数
prime质数
Correct. Each parabola spans two adjacent subintervals, so the subintervals must pair up evenly. An odd $n$ would leave one subinterval without a partner, breaking the construction.正确。每条抛物线覆盖两段相邻子区间,所以子区间必须成对出现。奇数 $n$ 会留下一个无配对的子区间,破坏构造。
Each parabolic arc covers two subintervals at once, so they must pair up. That forces $n$ to be even; an odd $n$ would leave a leftover subinterval.每条抛物线弧覆盖两段子区间,它们必须成对出现,迫使 $n$ 为偶数;奇数 $n$ 会留下多余的子区间。

Error Bounds误差界

An approximation is only as useful as our control over its error. For both rules the error can be bounded a priori using a bound on a derivative of the integrand. These bounds tell us how many subintervals guarantee a target accuracy, without ever computing the true value.近似值的价值在于我们对误差的掌控。对两种法则,均可用被积函数某阶导数的上界对误差进行先验估计。这些误差界告诉我们:在不知道真实值的情况下,需要多少段才能保证达到目标精度。

Key idea.核心思想。 The trapezoidal error is controlled by the second derivative and decays like $1/n^2$; Simpson's error is controlled by the fourth derivative and decays like $1/n^4$. Doubling $n$ cuts trapezoidal error by about $4$ and Simpson's by about $16$. Smoother integrands and finer partitions both shrink the error.梯形误差由二阶导数控制,按 $1/n^2$ 衰减;辛普森误差由四阶导数控制,按 $1/n^4$ 衰减。将 $n$ 翻倍,梯形误差减小约 $4$ 倍,辛普森误差减小约 $16$ 倍。被积函数越光滑、分割越细,误差越小。

Trapezoidal error bound梯形误差界
$$|E_T|\le \frac{K_2\,(b-a)^3}{12\,n^{2}},\qquad K_2=\max_{[a,b]}|f''(x)|.$$
Simpson error bound辛普森误差界
$$|E_S|\le \frac{K_4\,(b-a)^5}{180\,n^{4}},\qquad K_4=\max_{[a,b]}\big|f^{(4)}(x)\big|.$$

Because $E_S$ depends on $f^{(4)}$, Simpson's rule is exact for any polynomial of degree three or less (its fourth derivative is zero). This is the quantitative version of the exactness observed in the previous section.由于 $E_S$ 依赖 $f^{(4)}$,辛普森法则对任意三次或更低次多项式精确(其四阶导数为零)。这是上一节精确性的定量版本。

Worked Example 6.1: choosing $n$ for a target accuracy例题 6.1:为目标精度选择 $n$

How large must $n$ be so the trapezoidal rule approximates $\int_1^2 \tfrac{1}{x}\,dx$ within $0.0001$? Here $f(x)=1/x$, $f''(x)=2/x^3$, and on $[1,2]$ the maximum of $|f''|$ is at $x=1$, giving $K_2=2$. With $b-a=1$:

$$|E_T|\le \frac{2\cdot 1}{12\,n^2}=\frac{1}{6n^2}\le 0.0001 \iff n^2\ge \frac{1}{0.0006}\approx 1666.7 \iff n\ge 41.$$

So $n=41$ subintervals suffice (round up). Simpson's rule, with its $n^4$ denominator, would need only a handful of subintervals for the same accuracy.

梯形法则估计 $\int_1^2 \tfrac{1}{x}\,dx$ 误差在 $0.0001$ 以内,$n$ 至少需要多大?$f(x)=1/x$,$f''(x)=2/x^3$,在 $[1,2]$ 上 $|f''|$ 的最大值在 $x=1$ 处取到,$K_2=2$。$b-a=1$:

$$|E_T|\le \frac{2\cdot 1}{12\,n^2}=\frac{1}{6n^2}\le 0.0001 \iff n^2\ge \frac{1}{0.0006}\approx 1666.7 \iff n\ge 41.$$

$n=41$ 段已足够(向上取整)。辛普森法则的误差界含 $n^4$,达到相同精度只需几段。

Going deeper: where the $1/12$ comes from深入探讨:$1/12$ 的来源

On a single subinterval $[x_{i-1},x_i]$ of width $h$, Taylor-expanding $f$ about the midpoint and integrating shows the local trapezoidal error is $-\tfrac{h^3}{12}f''(\xi_i)$ for some $\xi_i$ in the subinterval. Summing over the $n$ subintervals and using $nh=b-a$:

$$E_T=-\frac{h^3}{12}\sum_{i=1}^{n} f''(\xi_i)=-\frac{h^2}{12}\,(b-a)\,\overline{f''},$$

where $\overline{f''}$ is an average of second derivatives. Bounding $|\overline{f''}|\le K_2$ and writing $h=(b-a)/n$ gives the stated bound with its $1/12$ and $1/n^2$. The same Taylor bookkeeping, carried to fourth order with the cubic terms cancelling, produces Simpson's $1/180$ and $1/n^4$.

在宽度为 $h$ 的单段子区间 $[x_{i-1},x_i]$ 上,对 $f$ 在中点展开泰勒级数并积分,可得局部梯形误差为 $-\tfrac{h^3}{12}f''(\xi_i)$,其中 $\xi_i$ 在子区间内。对 $n$ 段求和,用 $nh=b-a$:

$$E_T=-\frac{h^3}{12}\sum_{i=1}^{n} f''(\xi_i)=-\frac{h^2}{12}\,(b-a)\,\overline{f''},$$

其中 $\overline{f''}$ 是二阶导数的平均值。用 $|\overline{f''}|\le K_2$ 估计,代入 $h=(b-a)/n$,即得含 $1/12$ 和 $1/n^2$ 的误差界。同样的泰勒计账法推至四阶(三次项相消),产生辛普森的 $1/180$ 和 $1/n^4$。

Worked Example 6.2: a guaranteed Simpson error bound例题 6.2:辛普森法则的误差保证

Bound the error of Simpson's rule with $n=4$ for $\int_0^1 e^{x}\,dx$. Here $f(x)=e^{x}$ so $f^{(4)}(x)=e^{x}$, and on $[0,1]$ the maximum is $K_4=e^{1}=e\approx2.7183$. With $b-a=1$,

$$|E_S|\le\frac{K_4\,(b-a)^{5}}{180\,n^{4}}=\frac{e\cdot 1}{180\cdot 4^{4}}=\frac{2.7183}{180\cdot 256}=\frac{2.7183}{46080}\approx 5.9\times 10^{-5}.$$

So Simpson's rule with just four subintervals is guaranteed accurate to within about $0.00006$. The actual error is even smaller; the bound is a worst-case guarantee, not the realized error.

给出 $n=4$ 时辛普森法则估计 $\int_0^1 e^{x}\,dx$ 的误差界。$f(x)=e^{x}$,故 $f^{(4)}(x)=e^{x}$,在 $[0,1]$ 上最大值 $K_4=e\approx2.7183$。$b-a=1$,

$$|E_S|\le\frac{K_4\,(b-a)^{5}}{180\,n^{4}}=\frac{e\cdot 1}{180\cdot 4^{4}}=\frac{2.7183}{46080}\approx 5.9\times 10^{-5}.$$

仅四段的辛普森法则精度有保证,误差在约 $0.00006$ 以内。实际误差更小;该界是最坏情况的保证,不是实际误差。

Worked Example 6.3: comparing the two rules at fixed cost例题 6.3:相同计算量下两种法则的比较

For $\int_0^{\pi} \sin x\,dx=2$, compare the worst-case errors of the two rules with $n=10$. Here $|f''|\le 1$ and $|f^{(4)}|\le 1$, with $b-a=\pi$. The trapezoidal bound is

$$|E_T|\le\frac{1\cdot\pi^{3}}{12\cdot 10^{2}}=\frac{\pi^{3}}{1200}\approx 0.0258,$$

while Simpson's bound is

$$|E_S|\le\frac{1\cdot\pi^{5}}{180\cdot 10^{4}}=\frac{\pi^{5}}{1.8\times 10^{6}}\approx 1.70\times 10^{-4}.$$

At identical cost (eleven function evaluations) Simpson's bound is roughly $150$ times smaller. The gap widens as $n$ grows, because the bounds scale like $1/n^{2}$ versus $1/n^{4}$.

对 $\int_0^{\pi} \sin x\,dx=2$,比较 $n=10$ 时两种法则的最坏误差界。$|f''|\le 1$,$|f^{(4)}|\le 1$,$b-a=\pi$。梯形误差界:

$$|E_T|\le\frac{1\cdot\pi^{3}}{12\cdot 10^{2}}=\frac{\pi^{3}}{1200}\approx 0.0258,$$

辛普森误差界:

$$|E_S|\le\frac{1\cdot\pi^{5}}{180\cdot 10^{4}}=\frac{\pi^{5}}{1.8\times 10^{6}}\approx 1.70\times 10^{-4}.$$

相同计算量(11 次函数求值)下,辛普森误差界约小 $150$ 倍。随着 $n$ 增大,差距继续扩大,因为两个界分别按 $1/n^{2}$ 和 $1/n^{4}$ 缩减。

Common error.常见错误。 The constant $K_2$ (or $K_4$) is the maximum of $|f''|$ (or $|f^{(4)}|$) over the whole interval, not its value at one endpoint or at the midpoint. Plugging in a single point can drastically understate the bound. Find the extreme value of the relevant derivative across all of $[a,b]$; if the derivative is monotone, that maximum sits at an endpoint, but in general you must check critical points too.常数 $K_2$(或 $K_4$)是 $|f''|$(或 $|f^{(4)}|$)在整个区间上的最大值,而非某一端点或中点处的值。在单点代入可能严重低估误差界。应在整个 $[a,b]$ 上求相关导数的极值;若该导数单调,最大值在端点取到,但一般情况下还需检查临界点。
Going deeper: a local trapezoidal error term by Taylor expansion深入探讨:用泰勒展开推导局部梯形误差项

On one subinterval $[0,h]$, compare the exact integral with one trapezoid. Write the antiderivative $F$ with $F'=f$ and Taylor-expand about $0$. The exact integral is $\int_0^h f=F(h)-F(0)$. Expanding $F(h)=F(0)+hf(0)+\tfrac{h^{2}}{2}f'(0)+\tfrac{h^{3}}{6}f''(0)+O(h^{4})$ gives

$$\int_0^h f=hf(0)+\frac{h^{2}}{2}f'(0)+\frac{h^{3}}{6}f''(0)+O(h^{4}).$$

The trapezoid uses $\tfrac{h}{2}\big(f(0)+f(h)\big)$; expanding $f(h)=f(0)+hf'(0)+\tfrac{h^{2}}{2}f''(0)+O(h^{3})$,

$$\frac{h}{2}\big(f(0)+f(h)\big)=hf(0)+\frac{h^{2}}{2}f'(0)+\frac{h^{3}}{4}f''(0)+O(h^{4}).$$

Subtracting, the $f(0)$ and $f'(0)$ terms cancel and the local error is

$$\int_0^h f-\frac{h}{2}\big(f(0)+f(h)\big)=\Big(\frac16-\frac14\Big)h^{3}f''(0)+O(h^{4})=-\frac{h^{3}}{12}f''(0)+O(h^{4}).$$

So each subinterval contributes a local error of size $\tfrac{h^{3}}{12}|f''|$. Summing $n$ of these and using $nh=b-a$ converts the local $h^{3}$ into the global $\tfrac{(b-a)^{3}}{12n^{2}}K_2$ of the boxed bound. The factor $\tfrac16-\tfrac14=-\tfrac{1}{12}$ is the origin of the mysterious $1/12$.

在一段子区间 $[0,h]$ 上,比较精确积分与单个梯形。设原函数 $F$,$F'=f$,在 $0$ 处做泰勒展开。精确积分为 $\int_0^h f=F(h)-F(0)$。展开 $F(h)=F(0)+hf(0)+\tfrac{h^{2}}{2}f'(0)+\tfrac{h^{3}}{6}f''(0)+O(h^{4})$,得

$$\int_0^h f=hf(0)+\frac{h^{2}}{2}f'(0)+\frac{h^{3}}{6}f''(0)+O(h^{4}).$$

梯形使用 $\tfrac{h}{2}\big(f(0)+f(h)\big)$;展开 $f(h)=f(0)+hf'(0)+\tfrac{h^{2}}{2}f''(0)+O(h^{3})$,

$$\frac{h}{2}\big(f(0)+f(h)\big)=hf(0)+\frac{h^{2}}{2}f'(0)+\frac{h^{3}}{4}f''(0)+O(h^{4}).$$

相减,$f(0)$ 和 $f'(0)$ 项消去,局部误差为

$$\int_0^h f-\frac{h}{2}\big(f(0)+f(h)\big)=\Big(\frac16-\frac14\Big)h^{3}f''(0)+O(h^{4})=-\frac{h^{3}}{12}f''(0)+O(h^{4}).$$

每段子区间贡献局部误差 $\tfrac{h^{3}}{12}|f''|$。对 $n$ 段求和,用 $nh=b-a$,将局部 $h^{3}$ 转化为方框公式中全局的 $\tfrac{(b-a)^{3}}{12n^{2}}K_2$。因子 $\tfrac16-\tfrac14=-\tfrac{1}{12}$ 正是神秘 $1/12$ 的来源。

If you double $n$ in Simpson's rule, the error bound is reduced by approximately a factor of:在辛普森法则中将 $n$ 翻倍,误差界约缩减:
6.1
$2$
$4$
$8$
$16$
Correct. Simpson's error bound scales like $1/n^4$. Replacing $n$ by $2n$ multiplies the bound by $1/2^4=1/16$, so the error drops by about a factor of $16$.正确。辛普森误差界按 $1/n^4$ 缩放。将 $n$ 换成 $2n$,误差界乘以 $1/2^4=1/16$,故误差约缩减 $16$ 倍。
Simpson's bound carries $n^4$ in the denominator. Doubling $n$ multiplies the denominator by $2^4=16$, so the error falls by roughly that factor. The factor of $4$ is the trapezoidal rule, whose bound goes like $1/n^2$.辛普森误差界的分母含 $n^4$。将 $n$ 翻倍,分母乘以 $2^4=16$,误差约缩减该倍数。缩减 $4$ 倍的是梯形法则,其误差界按 $1/n^2$ 缩放。

Going Deeper深入探讨

Improper integrals and numerical integration meet in the real world: many integrals that matter in probability, physics, and engineering are improper, lack closed forms, or both. This closing section collects connections that reward a second look.

反常积分(improper integral)与数值积分在实际应用中相遇:概率、物理和工程中许多重要积分既是反常积分,又没有封闭形式。本节汇集了值得深入思考的联系。

Key idea.核心思想。 A convergent improper integral assigns a finite number to an infinite process, and that number is often best obtained by combining a change of variables (to tame the infinite or singular part) with a numerical rule on the resulting finite, smooth piece. Theory tells us a value exists; computation delivers it.收敛的反常积分(improper integral)将一个无限过程对应到一个有限数值,而该数值通常最好通过换元(驯化无穷或奇异部分)与数值方法结合来求得。理论告诉我们值存在;计算将其算出。
A famous convergent integral一个著名的收敛积分
$$\int_{0}^{\infty} e^{-x^{2}}\,dx=\frac{\sqrt{\pi}}{2}.$$

This integral converges by comparison with $e^{-x}$ for $x\ge 1$, yet its value cannot be found by elementary antidifferentiation; it is computed by a clever double-integral trick or, in practice, numerically. It underlies the normalization of the normal distribution.

这个积分通过与 $e^{-x}$($x\ge 1$)比较可证其收敛(converges),但其值无法通过初等原函数(antiderivative)得出;实际上借助巧妙的二重积分技巧或数值方法来计算。它是正态分布归一化的基础。

Worked Example 7.1: the gamma function at a half-integer例题 7.1:半整数处的伽玛函数

The gamma function $\Gamma(s)=\int_{0}^{\infty} x^{s-1}e^{-x}\,dx$ converges for $s>0$: near $0$ the factor $x^{s-1}$ is an integrable singularity when $s>0$, and at infinity $e^{-x}$ forces convergence. The substitution $x=u^2$ connects it to the Gaussian:

$$\Gamma\!\Big(\tfrac12\Big)=\int_{0}^{\infty} x^{-1/2}e^{-x}\,dx=\int_{0}^{\infty}\frac{e^{-u^{2}}}{u}\,2u\,du=2\int_{0}^{\infty} e^{-u^{2}}\,du=\sqrt{\pi}.$$

So a single substitution turns the half-integer gamma value into the Gaussian integral above.

伽玛函数 $\Gamma(s)=\int_{0}^{\infty} x^{s-1}e^{-x}\,dx$ 在 $s>0$ 时收敛:当 $s>0$ 时,因子 $x^{s-1}$ 在 $0$ 附近是可积奇点,而在无穷远处 $e^{-x}$ 保证收敛(convergence)。换元 $x=u^2$ 将其与高斯积分联系起来:

$$\Gamma\!\Big(\tfrac12\Big)=\int_{0}^{\infty} x^{-1/2}e^{-x}\,dx=\int_{0}^{\infty}\frac{e^{-u^{2}}}{u}\,2u\,du=2\int_{0}^{\infty} e^{-u^{2}}\,du=\sqrt{\pi}.$$

一次换元即将半整数伽玛值转化为上述高斯积分。

Going deeper: when comparison fails and substitution saves the day深入探讨:比较法失效时换元法解围

Consider $\int_{0}^{1}\dfrac{\ln x}{\sqrt{x}}\,dx$. The integrand is singular at $0$ and negative there, so a crude comparison is awkward. Substitute $x=t^2$, $dx=2t\,dt$:

$$\int_{0}^{1}\frac{\ln x}{\sqrt{x}}\,dx=\int_{0}^{1}\frac{2\ln t}{t}\,(2t)\,dt=4\int_{0}^{1}\ln t\,dt.$$

Now $\int_0^1 \ln t\,dt=\big[t\ln t-t\big]_0^1=-1$ (the boundary term $t\ln t\to 0$ as $t\to 0^+$), so the original integral equals $-4$. The substitution converted a singular integrand into one with a removable boundary term, after which an elementary antiderivative finished the job.

考虑 $\int_{0}^{1}\dfrac{\ln x}{\sqrt{x}}\,dx$。被积函数在 $0$ 处奇异且为负,直接比较法不便操作。令 $x=t^2$,$dx=2t\,dt$:

$$\int_{0}^{1}\frac{\ln x}{\sqrt{x}}\,dx=\int_{0}^{1}\frac{2\ln t}{t}\,(2t)\,dt=4\int_{0}^{1}\ln t\,dt.$$

现在 $\int_0^1 \ln t\,dt=\big[t\ln t-t\big]_0^1=-1$(边界项 $t\ln t\to 0$,当 $t\to 0^+$),故原积分等于 $-4$。换元将奇异被积函数转化为只含可去边界项的形式,再用初等原函数(antiderivative)完成计算。

Worked Example 7.2: a Laplace transform as an improper integral例题 7.2:作为反常积分的拉普拉斯变换

Many transforms used in engineering are improper integrals. Compute the Laplace transform of $f(t)=1$, namely $\int_0^{\infty} e^{-st}\,dt$ for $s>0$:

$$\int_0^{\infty} e^{-st}\,dt=\lim_{b\to\infty}\Big[-\frac{1}{s}e^{-st}\Big]_0^{b}=\lim_{b\to\infty}\frac{1}{s}\big(1-e^{-sb}\big)=\frac{1}{s}.$$

The integral converges precisely because $s>0$ makes the exponential decay; for $s\le 0$ it diverges. The convergence condition $s>0$ is exactly the region of definition of the transform, a recurring theme: an improper integral is a function of its parameters, defined only where it converges.

工程中许多变换都是反常积分(improper integral)。计算 $f(t)=1$ 的拉普拉斯变换,即 $\int_0^{\infty} e^{-st}\,dt$($s>0$):

$$\int_0^{\infty} e^{-st}\,dt=\lim_{b\to\infty}\Big[-\frac{1}{s}e^{-st}\Big]_0^{b}=\lim_{b\to\infty}\frac{1}{s}\big(1-e^{-sb}\big)=\frac{1}{s}.$$

积分收敛(converges)恰因 $s>0$ 使指数衰减;$s\le 0$ 时发散(diverges)。收敛条件 $s>0$ 正是变换的定义域,这是一个反复出现的主题:反常积分是其参数的函数,仅在收敛之处有定义。

Worked Example 7.3: substitution tames an infinite interval before quadrature例题 7.3:数值积分前用换元驯化无穷区间

To evaluate $\int_1^{\infty}\dfrac{dx}{x^{2}\sqrt{1+x}}$ numerically, the infinite interval is inconvenient. The substitution $x=1/u$, $dx=-u^{-2}\,du$ maps $[1,\infty)$ to the finite interval $(0,1]$:

$$\int_1^{\infty}\frac{dx}{x^{2}\sqrt{1+x}}=\int_{1}^{0}\frac{-u^{-2}\,du}{u^{-2}\sqrt{1+1/u}}=\int_0^{1}\frac{du}{\sqrt{1+1/u}}=\int_0^{1}\frac{\sqrt{u}\,du}{\sqrt{u+1}}.$$

The transformed integrand is bounded and smooth on $[0,1]$, so Simpson's rule converges rapidly on it. This is the standard recipe for numerical work with improper integrals: change variables so the infinite tail or the singularity becomes a tame finite interval, then apply a quadrature rule whose error bounds you can trust.

对 $\int_1^{\infty}\dfrac{dx}{x^{2}\sqrt{1+x}}$ 进行数值计算时,无穷区间不便处理。换元 $x=1/u$,$dx=-u^{-2}\,du$ 将 $[1,\infty)$ 映射到有限区间 $(0,1]$:

$$\int_1^{\infty}\frac{dx}{x^{2}\sqrt{1+x}}=\int_{1}^{0}\frac{-u^{-2}\,du}{u^{-2}\sqrt{1+1/u}}=\int_0^{1}\frac{du}{\sqrt{1+1/u}}=\int_0^{1}\frac{\sqrt{u}\,du}{\sqrt{u+1}}.$$

变换后的被积函数在 $[0,1]$ 上有界光滑,辛普森法则快速收敛。这是处理反常积分(improper integral)数值计算的标准方法:换元使无穷尾部或奇异性变为可控的有限区间,再应用误差界可信赖的数值积分规则。

Common error.常见错误。 Do not hand a textbook error bound to a numerical rule applied directly to an improper integral. The trapezoidal and Simpson bounds assume $f$ (and its derivatives up to fourth order) are bounded on $[a,b]$. If the integrand is unbounded at an endpoint, or the interval is infinite, those derivatives are unbounded and the bounds are vacuous. First convert the improper integral into a proper one by a limit, a split, or a substitution; only then is numerical integration with its error estimates legitimate.不要将教材中的误差界直接用于针对反常积分(improper integral)的数值方法。梯形和辛普森误差界假设 $f$ 及其四阶以内导数在 $[a,b]$ 上有界。若被积函数在端点无界,或区间无穷,则相关导数无界,误差界失效。应先通过极限(limit)、分拆或换元将反常积分转化为正常积分,再进行数值积分及误差估计。
Going deeper: the integral test, linking series and improper integrals深入探讨:积分判别法——级数与反常积分的桥梁

The same machinery decides convergence of series. Let $f$ be positive, continuous, and decreasing on $[1,\infty)$ with $a_n=f(n)$. Because $f$ decreases, on each subinterval $[n,n+1]$ we have $f(n+1)\le f(x)\le f(n)$, so integrating across $[n,n+1]$ traps the term:

$$f(n+1)\le\int_n^{n+1} f(x)\,dx\le f(n).$$

Summing the right inequality from $n=1$ to $N-1$ and the left from $n=1$ to $N-1$ gives

$$\sum_{n=2}^{N} a_n\le\int_1^{N} f(x)\,dx\le\sum_{n=1}^{N-1} a_n.$$

Letting $N\to\infty$, the partial sums and the improper integral are squeezed together: $\sum a_n$ converges if and only if $\int_1^{\infty} f$ converges. Applied to $f(x)=x^{-p}$ this recovers the $p$ series test from the $p$ integral test, the cleanest possible bridge between the two halves of this unit. The harmonic series $\sum 1/n$ diverges for exactly the reason $\int_1^{\infty}dx/x$ does.

同样的机制也能判断级数收敛(convergence)。设 $f$ 在 $[1,\infty)$ 上正值、连续、递减,且 $a_n=f(n)$。由于 $f$ 递减,在每段 $[n,n+1]$ 上有 $f(n+1)\le f(x)\le f(n)$,对 $[n,n+1]$ 积分可夹住各项:

$$f(n+1)\le\int_n^{n+1} f(x)\,dx\le f(n).$$

将右侧不等式从 $n=1$ 到 $N-1$ 求和,左侧同理:

$$\sum_{n=2}^{N} a_n\le\int_1^{N} f(x)\,dx\le\sum_{n=1}^{N-1} a_n.$$

令 $N\to\infty$,部分和与反常积分被夹紧:$\sum a_n$ 收敛当且仅当 $\int_1^{\infty} f$ 收敛。对 $f(x)=x^{-p}$ 应用此结论,可从 $p$ 积分判别法导出 $p$ 级数判别法,这是本单元两个主题之间最简洁的桥梁。调和级数 $\sum 1/n$ 发散,恰因 $\int_1^{\infty}dx/x$ 发散。

The integral $\displaystyle\int_{0}^{\infty} e^{-x^{2}}\,dx$ converges because, for large $x$, the integrand is dominated by:积分 $\displaystyle\int_{0}^{\infty} e^{-x^{2}}\,dx$ 收敛,因为当 $x$ 很大时,被积函数被以下哪项控制:
7.1
$1/x^{2}$
$e^{-x}$
$1/x$
a constant一个常数
Correct. For $x\ge 1$ we have $x^2\ge x$, so $e^{-x^2}\le e^{-x}$. Since $\int_1^{\infty} e^{-x}\,dx$ converges, the direct comparison test gives convergence of the Gaussian integral.正确。当 $x\ge 1$ 时,$x^2\ge x$,故 $e^{-x^2}\le e^{-x}$。由于 $\int_1^{\infty} e^{-x}\,dx$ 收敛,直接比较判别法给出高斯积分的收敛性。
For $x\ge 1$, $x^2\ge x$ forces $e^{-x^2}\le e^{-x}$, and $\int_1^{\infty}e^{-x}\,dx$ converges. That exponential bound, not a power of $x$, is what controls the tail.当 $x\ge 1$ 时,$x^2\ge x$ 迫使 $e^{-x^2}\le e^{-x}$,而 $\int_1^{\infty}e^{-x}\,dx$ 收敛。控制尾部的是指数上界,而非 $x$ 的幂次。

Flashcards闪卡

0 / 12 flipped已翻 0 / 12
Definition of $\int_a^{\infty} f\,dx$$\int_a^{\infty} f\,dx$ 的定义
$\displaystyle\lim_{t\to\infty}\int_a^{t} f(x)\,dx$, when this limit exists (finite).$\displaystyle\lim_{t\to\infty}\int_a^{t} f(x)\,dx$,当此极限(limit)存在(有限)时。
$p$ test at infinity: $\int_1^{\infty} x^{-p}\,dx$无穷远处的 $p$ 判别法:$\int_1^{\infty} x^{-p}\,dx$
Converges iff $p>1$; diverges iff $p\le 1$.当且仅当 $p>1$ 时收敛(converges);$p\le 1$ 时发散(diverges)。
$p$ test at $0$: $\int_0^1 x^{-p}\,dx$$0$ 处的 $p$ 判别法:$\int_0^1 x^{-p}\,dx$
Converges iff $p<1$; diverges iff $p\ge 1$. The inequality is reversed from the test at infinity.当且仅当 $p<1$ 时收敛;$p\ge 1$ 时发散。不等号方向与无穷远处的判别法相反。
Singularity at endpoint $b$端点 $b$ 处的奇点
$\displaystyle\int_a^b f\,dx=\lim_{t\to b^-}\int_a^t f\,dx$; for an interior singularity, split there and require both halves to converge.$\displaystyle\int_a^b f\,dx=\lim_{t\to b^-}\int_a^t f\,dx$;若奇点在内部,则在该处分拆,要求两半均收敛
Direct comparison test直接比较判别法
If $0\le f\le g$ and $\int g$ converges, then $\int f$ converges; if $\int f$ diverges, then $\int g$ diverges.若 $0\le f\le g$ 且 $\int g$ 收敛,则 $\int f$ 收敛;若 $\int f$ 发散,则 $\int g$ 发散。
Limit comparison test极限比较判别法
If $f,g>0$ and $\lim f/g=L$ with $0若 $f,g>0$ 且 $\lim f/g=L$,$0
Trapezoidal rule梯形法则
$\displaystyle T_n=\frac{h}{2}\big[f_0+2f_1+\cdots+2f_{n-1}+f_n\big]$, weights $1,2,\dots,2,1$.$\displaystyle T_n=\frac{h}{2}\big[f_0+2f_1+\cdots+2f_{n-1}+f_n\big]$,权重 $1,2,\dots,2,1$。
Simpson's rule ($n$ even)辛普森法则($n$ 为偶数)
$\displaystyle S_n=\frac{h}{3}\big[f_0+4f_1+2f_2+\cdots+4f_{n-1}+f_n\big]$, weights $1,4,2,\dots,4,1$.$\displaystyle S_n=\frac{h}{3}\big[f_0+4f_1+2f_2+\cdots+4f_{n-1}+f_n\big]$,权重 $1,4,2,\dots,4,1$。
Trapezoidal error bound梯形误差界
$\displaystyle |E_T|\le \frac{K_2(b-a)^3}{12\,n^2}$, $K_2=\max|f''|$. Scales like $1/n^2$.$\displaystyle |E_T|\le \frac{K_2(b-a)^3}{12\,n^2}$,$K_2=\max|f''|$。按 $1/n^2$ 缩放。
Simpson error bound辛普森误差界
$\displaystyle |E_S|\le \frac{K_4(b-a)^5}{180\,n^4}$, $K_4=\max|f^{(4)}|$. Scales like $1/n^4$; exact on cubics.$\displaystyle |E_S|\le \frac{K_4(b-a)^5}{180\,n^4}$,$K_4=\max|f^{(4)}|$。按 $1/n^4$ 缩放;对三次多项式精确。
Gaussian integral高斯积分
$\displaystyle\int_0^{\infty} e^{-x^2}\,dx=\frac{\sqrt{\pi}}{2}$; convergent (compare $e^{-x}$) but has no elementary antiderivative.$\displaystyle\int_0^{\infty} e^{-x^2}\,dx=\frac{\sqrt{\pi}}{2}$;收敛(与 $e^{-x}$ 比较),但没有初等原函数(antiderivative)。
Cauchy principal value warning柯西主值警告
$\int_{-\infty}^{\infty} f$ requires both halves to converge separately; the symmetric limit can exist even when the integral diverges.$\int_{-\infty}^{\infty} f$ 要求两半分别收敛;即使积分发散,对称极限也可能存在。

Unit Quiz单元测验

The integral $\displaystyle\int_{1}^{\infty}\frac{dx}{x^{0.5}}$:积分 $\displaystyle\int_{1}^{\infty}\frac{dx}{x^{0.5}}$:
Q1
converges to $2$收敛到 $2$
converges to $1$收敛到 $1$
diverges发散
equals $0$等于 $0$
Correct. This is a $p$ integral at infinity with $p=0.5\le 1$, so it diverges. The antiderivative $2\sqrt{x}$ grows without bound.正确。这是无穷远处的 $p$ 积分,$p=0.5\le 1$,故发散原函数 $2\sqrt{x}$ 无界增长。
At infinity, $\int_1^{\infty}x^{-p}\,dx$ converges only for $p>1$. Here $p=0.5$, so it diverges.在无穷远处,$\int_1^{\infty}x^{-p}\,dx$ 仅在 $p>1$ 时收敛。此处 $p=0.5$,故发散。
The integral $\displaystyle\int_{0}^{1}\frac{dx}{x^{0.5}}$:积分 $\displaystyle\int_{0}^{1}\frac{dx}{x^{0.5}}$:
Q2
converges to $2$收敛到 $2$
diverges发散
converges to $1$收敛到 $1$
equals $0$等于 $0$
Correct. This is a $p$ integral at $0$ with $p=0.5<1$, so it converges; its value is $\big[2\sqrt{x}\big]_0^1=2$. Note the inequality is reversed relative to the test at infinity.正确。这是 $0$ 处的 $p$ 积分,$p=0.5<1$,故收敛;其值为 $\big[2\sqrt{x}\big]_0^1=2$。注意不等号方向与无穷远处判别法相反。
Near $0$, $\int_0^1 x^{-p}\,dx$ converges when $p<1$. Here $p=0.5<1$, and the value is $2\sqrt{x}$ evaluated from $0$ to $1$, namely $2$.在 $0$ 附近,$\int_0^1 x^{-p}\,dx$ 当 $p<1$ 时收敛。此处 $p=0.5<1$,值为 $2\sqrt{x}$ 在 $0$ 到 $1$ 处的计算,即 $2$。
By the limit comparison test, $\displaystyle\int_{1}^{\infty}\frac{2x+3}{x^{3}+5}\,dx$:用极限比较判别法,$\displaystyle\int_{1}^{\infty}\frac{2x+3}{x^{3}+5}\,dx$:
Q3
diverges, like $1/x$发散,类比 $1/x$
cannot be decided by comparison比较法无法判断
diverges, like $1/x^{3}$发散,类比 $1/x^{3}$
converges, like $1/x^{2}$收敛,类比 $1/x^{2}$
Correct. For large $x$ the integrand behaves like $2x/x^3=2/x^2$, so compare with $1/x^2$. The ratio tends to $2$, a finite positive number, and $\int_1^{\infty}x^{-2}\,dx$ converges, so the integral converges.正确。当 $x$ 很大时,被积函数近似 $2x/x^3=2/x^2$,故与 $1/x^2$ 比较。比值趋近 $2$(有限正数),而 $\int_1^{\infty}x^{-2}\,dx$ 收敛,故积分收敛。
Match leading powers: $(2x+3)/(x^3+5)\approx 2x/x^3=2/x^2$. Comparison with the convergent $\int_1^{\infty}x^{-2}\,dx$ gives convergence.匹配主导幂次:$(2x+3)/(x^3+5)\approx 2x/x^3=2/x^2$。与收敛的 $\int_1^{\infty}x^{-2}\,dx$ 比较得出收敛性。
For the trapezoidal rule on $[0,2]$ with $n=4$, the weight pattern on the five nodes is:对 $[0,2]$ 上 $n=4$ 的梯形法则,五个节点的权重模式为:
Q4
$1,4,2,4,1$
$1,2,2,2,1$
$1,1,1,1,1$
$1,3,3,3,1$
Correct. The trapezoidal rule weights endpoints by $1$ and all interior nodes by $2$, giving $1,2,2,2,1$ scaled by $h/2$. The $1,4,2,4,1$ pattern is Simpson's rule.正确。梯形法则端点权重为 $1$,内部节点权重均为 $2$,乘以 $h/2$ 后得 $1,2,2,2,1$。$1,4,2,4,1$ 的模式是辛普森法则。
The trapezoidal rule uses endpoint weights $1$ and interior weights $2$: $1,2,2,2,1$. The $1,4,2,4,1$ pattern is Simpson's rule.梯形法则端点权重为 $1$,内部权重为 $2$:$1,2,2,2,1$。$1,4,2,4,1$ 模式属于辛普森法则。
Simpson's rule applied to a polynomial of degree $3$ gives:对三次多项式应用辛普森法则,结果为:
Q5
an overestimate高估
an underestimate低估
the exact value精确值
a value off by $h^2$误差为 $h^2$ 量级的值
Correct. Simpson's error depends on $f^{(4)}$, which is identically zero for any cubic. Hence the rule is exact on polynomials of degree three or less.正确。辛普森误差取决于 $f^{(4)}$,对任意三次多项式均恒为零。故法则对三次及以下多项式精确。
The Simpson error bound contains $f^{(4)}$. A cubic has $f^{(4)}=0$, so the error vanishes and the rule is exact.辛普森误差界包含 $f^{(4)}$。三次多项式的 $f^{(4)}=0$,故误差消失,法则精确。
To halve the trapezoidal error bound on a fixed interval, you should multiply $n$ by about:要将固定区间上的梯形误差界减半,应将 $n$ 大约乘以:
Q6
$\sqrt{2}$
$2$
$4$
$\tfrac12$
Correct. The bound scales like $1/n^2$. To halve it we need $n^2$ to double, so $n$ must be multiplied by $\sqrt{2}$.正确。误差界按 $1/n^2$ 缩放。要减半需 $n^2$ 翻倍,故 $n$ 须乘以 $\sqrt{2}$。
Since the bound goes like $1/n^2$, halving it requires doubling $n^2$, which means scaling $n$ by $\sqrt{2}$, not $2$.误差界按 $1/n^2$ 变化,减半需 $n^2$ 翻倍,即 $n$ 乘以 $\sqrt{2}$ 而非 $2$。

Readiness Checklist准备清单

Tap each item you can do without notes.点击每个无需笔记即可完成的项目。 0 / 8 mastered已掌握 0 / 8