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)进行数值逼近。
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)直接取极限给出,而是先在有限区间上积分,再令区间端点趋向无穷。
converges)到该值;否则发散(diverges)。收敛的含义是:面积虽然分布在无穷区间上,但最终累积到有限的总量。For an integral over the whole line we split at any convenient point $c$ and require both halves to converge separately:对于整条数轴上的积分,在任意方便的点 $c$ 处拆分,要求两段各自独立收敛:
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$。
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$ 都慢,故面积仍无限累积。
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}$,故
令 $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^{+}$,因此不等号方向翻转。
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.第二类反常积分的区间有限,但被积函数在端点或内部某点趋于无穷大。黎曼积分在该处无定义,因此仍退回到在奇点前截止的常义积分,再取单侧极限。
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),故发散:
整个积分发散。直接跨越 $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.$$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 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)通过将被积函数夹在已知积分的函数之间来判断收敛性,是级数比较判别法在积分中的对应版本。
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$),故所给积分也收敛。极限比较判别法从"问题点"处的主项行为直接读出收敛性,无论该点在无穷处还是有限奇点处。
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$ 也必然发散。这一论证是级数比较判别法在积分中的对应,只是将"有界单调部分和"换成了"有界单调部分面积"。
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$,累加所有梯形面积。
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}$ 下凸(函数图像向上弯曲),每段弦在曲线上方,梯形偏大。对下凸函数,梯形法则总是高估;对上凸函数,总是低估,此规律可用于合理性验证。
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$ 权重模式不是需要记忆的约定,而是由每个节点被多少个梯形共享所决定的。
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$ 必须为偶数。
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)}$ 因子对任意三次多项式均为零。
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$。
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.近似值的价值在于我们对误差的掌控。对两种法则,均可用被积函数某阶导数的上界对误差进行先验估计。这些误差界告诉我们:在不知道真实值的情况下,需要多少段才能保证达到目标精度。
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}$ 缩减。
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$ 的来源。
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)与数值积分在实际应用中相遇:概率、物理和工程中许多重要积分既是反常积分,又没有封闭形式。本节汇集了值得深入思考的联系。
反常积分(improper integral)将一个无限过程对应到一个有限数值,而该数值通常最好通过换元(驯化无穷或奇异部分)与数值方法结合来求得。理论告诉我们值存在;计算将其算出。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$ 将其与高斯积分联系起来:
一次换元即将半整数伽玛值转化为上述高斯积分。
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$):
积分收敛(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)数值计算的标准方法:换元使无穷尾部或奇异性变为可控的有限区间,再应用误差界可信赖的数值积分规则。
反常积分(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]$ 积分可夹住各项:
将右侧不等式从 $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$ 发散。
Flashcards闪卡
极限(limit)存在(有限)时。收敛(converges);$p\le 1$ 时发散(diverges)。收敛。原函数(antiderivative)。收敛;即使积分发散,对称极限也可能存在。Unit Quiz单元测验
发散。原函数 $2\sqrt{x}$ 无界增长。收敛;其值为 $\big[2\sqrt{x}\big]_0^1=2$。注意不等号方向与无穷远处判别法相反。Readiness Checklist准备清单
Tap each item you can do without notes.点击每个无需笔记即可完成的项目。 0 / 8 mastered已掌握 0 / 8
- State the definition of an improper integral over an infinite interval as a limit, and decide convergence in basic cases.将无穷区间上
反常积分(improper integral)的定义表述为极限(limit),并判断基本情形的收敛(convergence)性。 - Handle an unbounded integrand at an endpoint or an interior point by taking the correct one-sided limit or splitting the interval.通过取正确的单侧
极限或分拆区间,处理端点或内部奇点处的无界被积函数。 - Apply both $p$ tests: $\int_1^{\infty} x^{-p}$ (converges for $p>1$) and $\int_0^1 x^{-p}$ (converges for $p<1$).应用两种 $p$ 判别法:$\int_1^{\infty} x^{-p}$($p>1$ 时
收敛)和 $\int_0^1 x^{-p}$($p<1$ 时收敛)。 - Use the direct and limit comparison tests to settle convergence without evaluating the integral.使用直接比较判别法和极限比较判别法,无需计算积分即可判断
收敛性。 - Write down and apply the trapezoidal rule with correct $1,2,\dots,2,1$ weights.写出并应用权重为 $1,2,\dots,2,1$ 的
梯形(trapezoidal)法则。 - Write down and apply Simpson's rule with correct $1,4,2,\dots,4,1$ weights, remembering $n$ must be even.写出并应用权重为 $1,4,2,\dots,4,1$ 的辛普森法则,记住 $n$ 必须为偶数。
- Use the trapezoidal and Simpson error bounds to choose $n$ for a target accuracy.使用梯形和辛普森误差界,选取达到目标精度所需的 $n$。
- Recognize that Simpson's rule is exact on cubics and explain why via the $f^{(4)}$ in its error bound.认识到辛普森法则对三次多项式精确,并通过误差界中的 $f^{(4)}$ 解释原因。