当两个量通过方程关联,并且都随时间变化时,它们的变化率也相互关联。模块 5 的链式法则,“变化率相乘”,将量之间的方程转化为变化率之间的方程:如果你知道其中一个的变化率,就可以求出另一个的变化率。这类问题称为 相关变化率 问题。
一架5米长的梯子靠在垂直的墙上,地面上水平放置。梯子底部最初距离墙1米,以恒定的0.5 m/s速度被拉离墙。经过 t t t 秒后,底部距离墙 x = 1 + 0.5 t x = 1 + 0.5t x = 1 + 0.5 t 米,根据毕达哥拉斯定理,顶部在墙上 y = 25 − x 2 y = \sqrt{25 - x^2} y = 25 − x 2 米高:
t t t x x x y = 25 − x 2 y = \sqrt{25 - x^2} y = 25 − x 2 0 0 0 1 1 1 4.899 4.899 4.899 1 1 1 1.5 1.5 1.5 4.770 4.770 4.770 2 2 2 2 2 2 4.583 4.583 4.583 3 3 3 2.5 2.5 2.5 4.330 4.330 4.330 4 4 4 3 3 3 4 4 4 5 5 5 3.5 3.5 3.5 3.571 3.571 3.571 6 6 6 4 4 4 3 3 3 7 7 7 4.5 4.5 4.5 2.179 2.179 2.179
底部以恒定速度移动,但顶部并不如此。第一秒内,顶部下降 4.899 − 4.770 ≈ 0.13 4.899 - 4.770 \approx 0.13 4.899 − 4.770 ≈ 0.13 米;在第八秒内,从 t = 7 t = 7 t = 7 移动到地面 t = 8 , t = 8\mathclose{\text{,}} t = 8 , 当 x = 5 x = 5 x = 5 时,顶部再下降 2.179 2.179 2.179 米。当底部距离墙3米时,即 t = 4 , t = 4\mathclose{\text{,}} t = 4 , 顶部下降的速度是多少?在 t = 4 t = 4 t = 4 前后秒的下降量表明速度在0.330到0.429 m/s之间。要精确求出这个速度,你并不需要 y y y 的公式,只需要在每一时刻 x x x 和 y y y 之间的关系方程。
要点
相关变化率的策略。
画一个示意图。给每一个随时间变化的量赋予一个字母,并写出常量。
将你已知的速率和你想要的速率表示为时间 t t t 的导数,单位为: “d x / d t = 0.5 dx/dt = 0.5 d x / d t = 0.5 m/s;求 d y / d t dy/dt d y / d t 当 x = 3 x = 3 x = 3 m”。
找出一个联系变化量的方程,并且在每一瞬间都成立:从几何(勾股定理、相似三角形、体积公式)或从物理。
对两边关于 t t t 求导。每个变化量都是 t t t 的函数,因此每个都需要应用链式法则: d d t ( x 2 ) = 2 x d x d t 。 \dfrac{d}{dt}\big(x^2\big) = 2x\,\dfrac{dx}{dt}\mathclose{\text{。}} d t d ( x 2 ) = 2 x d t d x 。
现在仅代入你关心的瞬间的值,并求解你想要的速率。检查其符号和单位。
图 7.1 本节的四个相关变化率问题,变化量用字母表示:一梯子的底部从墙边被拉离(例7.1),一个圆锥形水箱在注水(例7.2),一个人从街灯远离行走(例7.3),以及一个气球上升而观察者注视它(例7.4)。
例 7.1滑动的梯子 ✓ 已检验
当梯子底部距离墙3米时,求梯子顶部下落的速度。
设 x x x 为梯子底部到墙的距离, y y y 为梯子顶端的高度,单位均为米,时间为 t t t 秒(图7.1,左上)。你已知 d x / d t = 0.5 , dx/dt = 0.5\mathclose{\text{,}} d x / d t = 0.5 , 并希望求 d y / d t dy/dt d y / d t 当 x = 3 x = 3 x = 3 时。在每一时刻,梯子、墙和地面形成一个直角三角形,斜边为5米,因此
x 2 + y 2 = 25. x^2 + y^2 = 25. x 2 + y 2 = 25.
对两边关于 t t t 求导。根据链式法则, x 2 x^2 x 2 的导数为 2 x d x / d t , 2x\,dx/dt\mathclose{\text{,}} 2 x d x / d t , 常数25的导数为0:
2 x d x d t + 2 y d y d t = 0 , so d y d t = − x y d x d t . \begin{aligned} 2x\,\frac{dx}{dt} + 2y\,\frac{dy}{dt} &= 0, \\ \text{so}\qquad \frac{dy}{dt} &= -\frac{x}{y}\,\frac{dx}{dt}. \end{aligned} 2 x d t d x + 2 y d t d y so d t d y = 0 , = − y x d t d x .
现在代入某一时刻的值。当 x = 3 , x = 3\mathclose{\text{,}} x = 3 , y = 25 − 9 = 4 , y = \sqrt{25 - 9} = 4\mathclose{\text{,}} y = 25 − 9 = 4 , 和
d y d t = − 3 4 ⋅ 0.5 = − 0.375 m/s . \frac{dy}{dt} = -\frac{3}{4} \cdot 0.5 = -0.375 \text{ m/s}. d t d y = − 4 3 ⋅ 0.5 = − 0.375 m/s .
负号表示 y y y 在减小:梯子顶端以0.375 m/s的速度下滑,介于表格中的两个估计值之间。
公式 d y / d t = − ( x / y ) d x / d t dy/dt = -(x/y)\,dx/dt d y / d t = − ( x / y ) d x / d t 也解释了表格:当顶端接近地面时, y y y 趋近于0,顶端的速度趋于无穷大。没有真实的梯子能以这种方式运动,因此该模型假设顶端始终在墙上,必须在顶端到达地面之前失效。
注意
不要在对函数求导之前替换变量的值。如果你先将 x = 3 x = 3 x = 3 代入 x 2 + y 2 = 25 , x^2 + y^2 = 25\mathclose{\text{,}} x 2 + y 2 = 25 , 你将得到 9 + y 2 = 25 , 9 + y^2 = 25\mathclose{\text{,}} 9 + y 2 = 25 , 然后对它求导得到 2 y d y / d t = 0 : 2y\,dy/dt = 0\mathclose{\text{:}} 2 y d y / d t = 0 : 顶部不会变化,这是错误的。你求导的方程必须在每一瞬间都成立,而不仅仅是在你关心的那个瞬间。
体积、阴影和角度
例 7.2填充一个锥形水箱 ✓ 已检验
一个水箱的形状是一个顶点在底部的圆锥体。它的深度是 4 米,顶部是一个半径为 2 米的圆。水以 2 立方米每分钟的速度流入。当水深为 3 米时,水位上升的速度是多少?
设 h h h 为水的深度, r r r 为水面的半径,单位为米,时间为 t t t 分钟(图 7.1,右上角)。你已知 d V / d t = 2 , dV/dt = 2\mathclose{\text{,}} d V / d t = 2 , 想要 d h / d t dh/dt d h / d t 当 h = 3 。 h = 3\mathclose{\text{。}} h = 3 。 水形成一个体积为
V = 1 3 π r 2 h . V = \frac{1}{3}\pi r^2 h. V = 3 1 π r 2 h .
这将三个变化的量联系起来,因此首先消去一个。通过轴做一条垂直切割,显示出两个相似的直角三角形,水箱的三角形的直角边为 4 和 2,水的三角形的直角边为 h h h 和 r 。 r\mathclose{\text{。}} r 。 因此 r / h = 2 / 4 r/h = 2/4 r / h = 2/4 在每一时刻,即 r = h / 2 , r = h/2\mathclose{\text{,}} r = h /2 , 并且
V = 1 3 π ( h 2 ) 2 h = π 12 h 3 . V = \frac{1}{3}\pi\Big(\frac{h}{2}\Big)^2 h = \frac{\pi}{12}h^3. V = 3 1 π ( 2 h ) 2 h = 12 π h 3 .
对 t t t 求导,使用链式法则:
d V d t = π 4 h 2 d h d t . \frac{dV}{dt} = \frac{\pi}{4}h^2\,\frac{dh}{dt}. d t d V = 4 π h 2 d t d h .
当 h = 3 h = 3 h = 3 时,这表示为 2 = 9 π 4 d h d t , 2 = \dfrac{9\pi}{4}\,\dfrac{dh}{dt}\mathclose{\text{,}} 2 = 4 9 π d t d h , 因此
d h d t = 8 9 π ≈ 0.283 m/min . \frac{dh}{dt} = \frac{8}{9\pi} \approx 0.283 \text{ m/min}. d t d h = 9 π 8 ≈ 0.283 m/min .
此时水位上升约 28 厘米每分钟。随着水变深,水位上升速度变慢,因为相同的 2 立方米水体分布在更宽的表面上。
例 7.3行走者的影子 ✓ 已检验
街边路灯位于 6 米高的杆顶上。一个身高 1.8 米的人以 1.5 米/秒的速度直行远离杆子。此时影子长度如何变化?影子顶端如何移动?
设 x x x 为人的距离灯杆的水平距离, s s s 为影子的长度,单位为米(图 7.1,左下)。从灯到影子顶端的光线恰好掠过人的头顶,因此大三角形(灯杆、地面、光线)和小三角形(人、影子、光线)相似。两个三角形的高与底边之比相等:
6 x + s = 1.8 s . \frac{6}{x + s} = \frac{1.8}{s}. x + s 6 = s 1.8 .
两边同乘以 s ( x + s ) : s(x + s)\mathclose{\text{:}} s ( x + s ) : 6 s = 1.8 x + 1.8 s , 6s = 1.8x + 1.8s\mathclose{\text{,}} 6 s = 1.8 x + 1.8 s , 所以 4.2 s = 1.8 x 4.2s = 1.8x 4.2 s = 1.8 x 和 s = 3 7 x 。 s = \dfrac{3}{7}x\mathclose{\text{。}} s = 7 3 x 。 求导,
d s d t = 3 7 d x d t = 3 7 ⋅ 1.5 = 9 14 ≈ 0.643 m/s . \begin{aligned} \frac{ds}{dt} &= \frac{3}{7}\,\frac{dx}{dt} = \frac{3}{7} \cdot 1.5 \\ &= \frac{9}{14} \approx 0.643 \text{ m/s}. \end{aligned} d t d s = 7 3 d t d x = 7 3 ⋅ 1.5 = 14 9 ≈ 0.643 m/s .
影子顶端距离灯杆为 x + s = 10 7 x , x + s = \dfrac{10}{7}x\mathclose{\text{,}} x + s = 7 10 x , 因此其移动速度为 10 7 ⋅ 1.5 = 15 7 ≈ 2.14 \dfrac{10}{7} \cdot 1.5 = \dfrac{15}{7} \approx 2.14 7 10 ⋅ 1.5 = 7 15 ≈ 2.14 m/s,比人行走速度快。两个答案都不依赖于人的位置:此处关系为线性,因此速率恒定。
例 7.4观察气球上升 ✓ 已检验
一个气球从水平地面上某点以恒定速度 2 m/s 垂直上升,该点距离观察者 400 m。当气球上升到 300 m 高时,观察者视线的仰角增加的速度是多少?
设 h h h 为气球的高度(单位:米),θ \theta θ 为仰角(单位:弧度),在时间 t t t (单位:秒)时(图7.1,右下角)。已知 d h / d t = 2 , dh/dt = 2\mathclose{\text{,}} d h / d t = 2 , 要求 d θ / d t d\theta/dt d θ / d t 当 h = 300 。 h = 300\mathclose{\text{。}} h = 300 。 在由观察者、发射点和气球构成的直角三角形中,
tan θ = h 400 . \tan\theta = \frac{h}{400}. tan θ = 400 h .
对两边关于 t t t 求导。tan θ \tan\theta tan θ 的导数为 sec 2 θ \sec^2\theta sec 2 θ (模块5),因此根据链式法则
sec 2 θ d θ d t = 1 400 d h d t . \sec^2\theta\,\frac{d\theta}{dt} = \frac{1}{400}\,\frac{dh}{dt}. sec 2 θ d t d θ = 400 1 d t d h .
当 h = 300 h = 300 h = 300 时,视线长度为 400 2 + 300 2 = 500 , \sqrt{400^2 + 300^2} = 500\mathclose{\text{,}} 40 0 2 + 30 0 2 = 500 , 因此 cos θ = 400 / 500 = 4 / 5 \cos\theta = 400/500 = 4/5 cos θ = 400/500 = 4/5 和 sec 2 θ = 25 / 16 。 \sec^2\theta = 25/16\mathclose{\text{。}} sec 2 θ = 25/16 。 接着
d θ d t = 1 400 ⋅ 2 ⋅ 16 25 = 0.0032 rad/s , \frac{d\theta}{dt} = \frac{1}{400} \cdot 2 \cdot \frac{16}{25} = 0.0032 \text{ rad/s}, d t d θ = 400 1 ⋅ 2 ⋅ 25 16 = 0.0032 rad/s ,
关于 0.18 ∘ 0.18^\circ 0.1 8 ∘ 每秒的变化率(乘以 180 / π )。 180/\pi\mathclose{\text{)。}} 180/ π )。 对 θ = arctan ( h / 400 ) \theta = \arctan(h/400) θ = arctan ( h /400 ) 求导(模块6)得到相同的结果。
注意
还有两种常见错误。第一种是符号错误:递减的量具有负的变化率,因此以每分钟2立方米的速度排水的水箱具有d V / d t = − 2 。 dV/dt = -2\mathclose{\text{。}} d V / d t = − 2 。 第二种是角度单位:仅当θ \theta θ 以弧度为单位时,tan θ \tan\theta tan θ 的导数才是sec 2 θ \sec^2\theta sec 2 θ (见第5.4节 ),因此计算过程中使用弧度,并在最后转换答案,如例7.4所示。
动手计算相关变化率与 SymPy
SymPy 可以完成策略的第 4 步。将 x x x 和 y y y 表示为 t t t 的函数,以 sp.Function 为变量,对例 7.1 的方程进行求导,并解出 d y / d t : dy/dt\mathclose{\text{:}} d y / d t :
Python 复制
import sympy as sp
t = sp.symbols ('t' )
x = sp.Function ('x' )(t) # the foot's distance from the wall at time t
y = sp.Function ('y' )(t) # the height of the top
link = x**2 + y**2 - 25 # zero at every instant
dlink = sp.diff (link, t)
print (dlink)
dydt = sp.solve (dlink, sp.Derivative (y, t))[0 ]
print (dydt)
输出
2*x(t)*Derivative(x(t), t) + 2*y(t)*Derivative(y(t), t)
-x(t)*Derivative(x(t), t)/y(t)
SymPy 将 d x / d t dx/dt d x / d t 写作 Derivative(x(t), t)。调用 sp.solve 时将 dlink 视为等于 0 的表达式。此处返回一个 d y / d t dy/dt d y / d t 的解的列表,而 [0] 取第一个解。现在代入瞬时值,首先求出变化率:
Python 复制
print (dydt.subs (sp.Derivative (x, t), sp.Rational (1 , 2 )).subs ({x: 3 , y: 4 }))
print (dydt.subs ({x: 3 , y: 4 }))
输出
-3/8
-3*Derivative(3, t)/4
第一行是例 7.1 的答案 − 3 / 8 = − 0.375 。 -3/8 = -0.375\mathclose{\text{。}} − 3/8 = − 0.375 。 第二行是 SymPy 在该例之后的陷阱:先代入 x = 3 x = 3 x = 3 也会替换 x ( t ) x(t) x ( t ) 内部的 d x / d t , dx/dt\mathclose{\text{,}} d x / d t , 从而导致 Derivative(3, t),即常数的导数,为 0。
在一个可导函数的图像上放大观察某一点附近的区域,它看起来越来越像一条直线:它的切线。因此,在该点附近,这条易于计算的切线可以作为函数的近似,即使函数本身可能较为复杂。本节将对此进行精确描述,并衡量这种近似有多好。
定义 7.1线性化
设 f f f 在 a a a 处可导。函数 f f f 在 a a a 处的 线性化 是指:
L ( x ) = f ( a ) + f ′ ( a ) ( x − a ) , L(x) = f(a) + f'(a)(x - a), L ( x ) = f ( a ) + f ′ ( a ) ( x − a ) ,
其图像是在 ( a , f ( a ) ) \big(a, f(a)\big) ( a , f ( a ) ) 处 y = f ( x ) y = f(x) y = f ( x ) 的切线,用 f ( x ) ≈ L ( x ) f(x) \approx L(x) f ( x ) ≈ L ( x ) 近似 x x x 在 a a a 附近的 线性近似 ,或称切线近似,是 f f f 在 a a a 处的近似。
L L L 是通过点 ( a , f ( a ) ) \big(a, f(a)\big) ( a , f ( a ) ) 且斜率为 f ′ ( a ) f'(a) f ′ ( a ) 的直线,采用 小节 1.4 的点斜式。它在 a a a 处与 f f f 在值和斜率上一致:L ( a ) = f ( a ) L(a) = f(a) L ( a ) = f ( a ) 和 L ′ ( a ) = f ′ ( a ) 。 L'(a) = f'(a)\mathclose{\text{。}} L ′ ( a ) = f ′ ( a ) 。
图 7.2 左:函数 y = x y = \sqrt x y = x 和其在 a = 4 a = 4 a = 4 处的切线 y = L ( x ) y = L(x) y = L ( x ) 的图像;在 a a a 附近,它们很难分辨。从 a a a 到 a + d x a + dx a + d x (此处 d x = 3 , dx = 3\mathclose{\text{,}} d x = 3 , 被夸大以便显示差距),曲线上升 Δ y , \Delta y\mathclose{\text{,}} Δ y , 切线上升 d y ; dy\mathclose{\text{;}} d y ; d x dx d x 和 d y dy d y 是本节后面定义的微分。右:函数 y = sin θ y = \sin\theta y = sin θ 和其在 0 处的切线 y = θ ; y = \theta\mathclose{\text{;}} y = θ ; 在绿色带内(即 ∣ θ ∣ ≤ 0.5 ), \abs{\theta} \le 0.5\mathclose{\text{),}} ∣ θ ∣ ≤ 0.5 ), 它们几乎重合。
例 7.54 附近平方根的近似 ✓ 已检验
利用 f ( x ) = x f(x) = \sqrt x f ( x ) = x 在 a = 4 a = 4 a = 4 处的线性近似来估计 4.1 \sqrt{4.1} 4.1 和 3.9 。 \sqrt{3.9}\mathclose{\text{。}} 3.9 。
这里 f ( 4 ) = 2 f(4) = 2 f ( 4 ) = 2 和 f ′ ( x ) = 1 2 x , f'(x) = \dfrac{1}{2\sqrt x}\mathclose{\text{,}} f ′ ( x ) = 2 x 1 , 因此 f ′ ( 4 ) = 1 4 f'(4) = \dfrac14 f ′ ( 4 ) = 4 1 和
L ( x ) = 2 + 1 4 ( x − 4 ) . L(x) = 2 + \frac{1}{4}(x - 4). L ( x ) = 2 + 4 1 ( x − 4 ) .
所以 4.1 ≈ L ( 4.1 ) = 2 + 1 4 ( 0.1 ) = 2.025 \sqrt{4.1} \approx L(4.1) = 2 + \tfrac14(0.1) = 2.025 4.1 ≈ L ( 4.1 ) = 2 + 4 1 ( 0.1 ) = 2.025 和 3.9 ≈ L ( 3.9 ) = 2 − 1 4 ( 0.1 ) = 1.975 。 \sqrt{3.9} \approx L(3.9) = 2 - \tfrac14(0.1) = 1.975\mathclose{\text{。}} 3.9 ≈ L ( 3.9 ) = 2 − 4 1 ( 0.1 ) = 1.975 。 计算器给出 4.1 ≈ 2.024846 \sqrt{4.1} \approx 2.024846 4.1 ≈ 2.024846 和 3.9 ≈ 1.974842 : \sqrt{3.9} \approx 1.974842\mathclose{\text{:}} 3.9 ≈ 1.974842 : 两个估计值都与真实值相差不到 0.0002,而且两者都略微偏大,因为函数 x \sqrt x x 的图像在其切线之下弯曲(图 7.2,左)。
在离 4 更远还是更近的地方,这个近似有多好?下表比较了 x \sqrt x x 与 L ( x ) : L(x)\mathclose{\text{:}} L ( x ) :
x x x x \sqrt{x} x L ( x ) L(x) L ( x ) x − L ( x ) \sqrt{x} - L(x) x − L ( x ) 3 3 3 1.73205 1.73205 1.73205 1.75 1.75 1.75 − 0.0179492 -0.0179492 − 0.0179492 3.9 3.9 3.9 1.97484 1.97484 1.97484 1.975 1.975 1.975 − 0.000158234 -0.000158234 − 0.000158234 3.99 3.99 3.99 1.99750 1.99750 1.99750 1.9975 1.9975 1.9975 − 1.56446 × 10 − 6 -1.56446\times10^{-6} − 1.56446 × 1 0 − 6 4.01 4.01 4.01 2.00250 2.00250 2.00250 2.0025 2.0025 2.0025 − 1.56055 × 10 − 6 -1.56055\times10^{-6} − 1.56055 × 1 0 − 6 4.1 4.1 4.1 2.02485 2.02485 2.02485 2.025 2.025 2.025 − 0.000154327 -0.000154327 − 0.000154327 5 5 5 2.23607 2.23607 2.23607 2.25 2.25 2.25 − 0.0139320 -0.0139320 − 0.0139320
有两点显而易见。误差 x − L ( x ) \sqrt x - L(x) x − L ( x ) 始终为负:切线位于图像上方。每次 x x x 靠近 4 的十倍距离,误差缩小约一百倍:在距离 1 处误差为 0.014 或 0.018,在距离 0.1 处为 0.00015 或 0.00016,在距离 0.01 处为 0.0000016。误差行为类似于一个常数乘以 ( x − 4 ) 2 。 (x - 4)^2\mathclose{\text{。}} ( x − 4 ) 2 。
这有多好?
定理 7.1切线是最佳线性近似
设 f f f 在 a a a 处可导,线性化为 L , L\mathclose{\text{,}} L , 令 E ( x ) = f ( x ) − L ( x ) E(x) = f(x) - L(x) E ( x ) = f ( x ) − L ( x ) 为线性近似的误差。则
lim x → a E ( x ) x − a = 0. \lim_{x\to a}\frac{E(x)}{x - a} = 0. x → a lim x − a E ( x ) = 0.
换句话说,误差即使与距离 x − a x - a x − a 相比也很小。此外,只有 L L L 具有此性质:如果 ℓ ( x ) = c + m ( x − a ) \ell(x) = c + m(x - a) ℓ ( x ) = c + m ( x − a ) 和 ( f ( x ) − ℓ ( x ) ) / ( x − a ) → 0 \big(f(x) - \ell(x)\big)/(x - a) \to 0 ( f ( x ) − ℓ ( x ) ) / ( x − a ) → 0 作为 x → a , x \to a\mathclose{\text{,}} x → a , 则 c = f ( a ) c = f(a) c = f ( a ) 和 m = f ′ ( a ) 。 m = f'(a)\mathclose{\text{。}} m = f ′ ( a ) 。
证明
对于 x ≠ a , x \ne a\mathclose{\text{,}} x = a ,
E ( x ) x − a = f ( x ) − f ( a ) − f ′ ( a ) ( x − a ) x − a = f ( x ) − f ( a ) x − a − f ′ ( a ) . \begin{aligned} \frac{E(x)}{x - a} &= \frac{f(x) - f(a) - f'(a)(x - a)}{x - a} \\ &= \frac{f(x) - f(a)}{x - a} - f'(a). \end{aligned} x − a E ( x ) = x − a f ( x ) − f ( a ) − f ′ ( a ) ( x − a ) = x − a f ( x ) − f ( a ) − f ′ ( a ) .
当 x → a x \to a x → a 的差商趋近于 f ′ ( a ) f'(a) f ′ ( a ) 时,根据导数的定义(模块 4),因此整个表达式趋近于 0。
现在假设 ℓ ( x ) = c + m ( x − a ) \ell(x) = c + m(x - a) ℓ ( x ) = c + m ( x − a ) 具有该性质。那么 f ( x ) − ℓ ( x ) = f ( x ) − ℓ ( x ) x − a ( x − a ) f(x) - \ell(x) = \dfrac{f(x) - \ell(x)}{x - a}\,(x - a) f ( x ) − ℓ ( x ) = x − a f ( x ) − ℓ ( x ) ( x − a ) 趋近于 0 ⋅ 0 = 0 。 0 \cdot 0 = 0\mathclose{\text{。}} 0 ⋅ 0 = 0 。 但 f f f 在 a a a 处连续,因为其在该点可导(模块 4),因此 f ( x ) − ℓ ( x ) f(x) - \ell(x) f ( x ) − ℓ ( x ) 也趋近于 f ( a ) − c 。 f(a) - c\mathclose{\text{。}} f ( a ) − c 。 因此 c = f ( a ) , c = f(a)\mathclose{\text{,}} c = f ( a ) , 然后
f ( x ) − ℓ ( x ) x − a = f ( x ) − f ( a ) x − a − m → f ′ ( a ) − m . \begin{aligned} \frac{f(x) - \ell(x)}{x - a} &= \frac{f(x) - f(a)}{x - a} - m \\ &\to f'(a) - m. \end{aligned} x − a f ( x ) − ℓ ( x ) = x − a f ( x ) − f ( a ) − m → f ′ ( a ) − m .
该极限为 0,因此 m = f ′ ( a ) 。 m = f'(a)\mathclose{\text{。}} m = f ′ ( a ) 。
∎
如果你阅读了第4.4节 末尾的“深入探索”框,你之前已经遇到过这个定理,即“可微意味着局部线性”;这里它被付诸实践。可微性是必要的。在∣ x ∣ \abs{x} ∣ x ∣ 处0点的角上,任何直线c + m x c + mx c + m x 都不行:c c c 必须是∣ 0 ∣ = 0 , \abs{0} = 0\mathclose{\text{,}} ∣ 0 ∣ = 0 , 然后( ∣ x ∣ − m x ) / x \big(\abs{x} - mx\big)/x ( ∣ x ∣ − m x ) / x 从右侧趋近于1 − m , 1 - m\mathclose{\text{,}} 1 − m , − 1 − m -1 - m − 1 − m 从左侧趋近,这两者都不能同时为0。
定理 7.1 说明误差与 x − a x - a x − a 相比很小,但并未说明有多小。表格表明误差是常数乘以 ( x − a ) 2 , (x - a)^2\mathclose{\text{,}} ( x − a ) 2 , 这是通常情况:如果 f ′ ′ f'' f ′′ 在 a a a 附近连续,那么对于 x x x 接近 a a a 的情况,
f ( x ) − L ( x ) ≈ f ′ ′ ( a ) 2 ( x − a ) 2 , f(x) - L(x) \approx \frac{f''(a)}{2}(x - a)^2, f ( x ) − L ( x ) ≈ 2 f ′′ ( a ) ( x − a ) 2 ,
在意义上,( f ( x ) − L ( x ) ) / ( x − a ) 2 \big(f(x) - L(x)\big)/(x - a)^2 ( f ( x ) − L ( x ) ) / ( x − a ) 2 趋近于 f ′ ′ ( a ) / 2 , f''(a)/2\mathclose{\text{,}} f ′′ ( a ) /2 , 当 x → a x \to a x → a 时。并且如果 ∣ f ′ ′ ∣ ≤ M \abs{f''} \le M ∣ f ′′ ∣ ≤ M 在 a a a 和 x x x 之间,那么 ∣ f ( x ) − L ( x ) ∣ ≤ M 2 ( x − a ) 2 。 \abs{f(x) - L(x)} \le \dfrac{M}{2}(x - a)^2\mathclose{\text{。}} ∣ f ( x ) − L ( x ) ∣ ≤ 2 M ( x − a ) 2 。 这两点都来自于泰勒定理,该定理在模块 15 中被证明。对于 x \sqrt x x 在 4 处,f ′ ′ ( x ) = − 1 4 x − 3 / 2 , f''(x) = -\tfrac14 x^{-3/2}\mathclose{\text{,}} f ′′ ( x ) = − 4 1 x − 3/2 , 因此 f ′ ′ ( 4 ) = − 1 32 , f''(4) = -\tfrac{1}{32}\mathclose{\text{,}} f ′′ ( 4 ) = − 32 1 , 并且在 x = 4.1 x = 4.1 x = 4.1 处的误差应约为 − 1 64 ( 0.1 ) 2 ≈ − 0.000156 ; -\tfrac{1}{64}(0.1)^2 \approx -0.000156\mathclose{\text{;}} − 64 1 ( 0.1 ) 2 ≈ − 0.000156 ; 表格给出 − 0.000154 。 -0.000154\mathclose{\text{。}} − 0.000154 。
注意
线性近似仅在 a a a 附近有效。远离该点,切线与曲线将分开: L ( 9 ) = 2 + 5 4 = 3.25 , L(9) = 2 + \tfrac54 = 3.25\mathclose{\text{,}} L ( 9 ) = 2 + 4 5 = 3.25 , 而 9 = 3 。 \sqrt9 = 3\mathclose{\text{。}} 9 = 3 。 在信任 f ( x ) ≈ L ( x ) f(x) \approx L(x) f ( x ) ≈ L ( x ) 之前,请问 x x x 距离 a a a 多远,以及曲线在中间弯曲的程度如何。
例 7.6小角度近似 ✓ 已检验
求 sin θ \sin\theta sin θ 在 0 处的线性化,并找出其误差不超过 1% 的角度。
sin 0 = 0 , \sin 0 = 0\mathclose{\text{,}} sin 0 = 0 , 且 sin θ \sin\theta sin θ 的导数是 cos θ \cos\theta cos θ (模块 5),带 cos 0 = 1 。 \cos 0 = 1\mathclose{\text{。}} cos 0 = 1 。 因此 L ( θ ) = 0 + 1 ⋅ ( θ − 0 ) = θ : L(\theta) = 0 + 1\cdot(\theta - 0) = \theta\mathclose{\text{:}} L ( θ ) = 0 + 1 ⋅ ( θ − 0 ) = θ :
sin θ ≈ θ for θ near 0 , \sin\theta \approx \theta \quad\text{for } \theta \text{ near } 0, sin θ ≈ θ for θ near 0 ,
其中 θ \theta θ 以弧度为单位。表格给出了相对误差 ( θ − sin θ ) / sin θ , (\theta - \sin\theta)/\sin\theta\mathclose{\text{,}} ( θ − sin θ ) / sin θ , 即误差与真实值的比值(第7.3节):
θ \theta θ sin θ \sin\theta sin θ θ − sin θ sin θ \dfrac{\theta - \sin\theta}{\sin\theta} sin θ θ − sin θ 0.01 0.01 0.01 0.01000 0.01000 0.01000 1.667 × 10 − 5 1.667\times10^{-5} 1.667 × 1 0 − 5 0.05 0.05 0.05 0.04998 0.04998 0.04998 0.0004168 0.0004168 0.0004168 0.1 0.1 0.1 0.09983 0.09983 0.09983 0.001669 0.001669 0.001669 0.2 0.2 0.2 0.1987 0.1987 0.1987 0.006698 0.006698 0.006698 0.5 0.5 0.5 0.4794 0.4794 0.4794 0.04291 0.04291 0.04291 1 1 1 0.8415 0.8415 0.8415 0.1884 0.1884 0.1884
相对误差在 ∣ θ ∣ \abs{\theta} ∣ θ ∣ 约等于 0.24 弧度(约等于 14 ∘ , 14^\circ\mathclose{\text{,}} 1 4 ∘ , 计算器显示其在 θ = 0.24 \theta = 0.24 θ = 0.24 和 θ = 0.25 \theta = 0.25 θ = 0.25 之间超过 0.01)时保持在 0.01 以下,即 1%;在 θ = 0.1 \theta = 0.1 θ = 0.1 时约为 0.17%。与上述 x \sqrt x x 的线性化误差类似,当 θ \theta θ 缩小十倍时,它缩小约一百倍。(相对误差是 θ \theta θ 的偶函数,因此负角表现相同。)
物理和工程中经常使用小角度近似。对于一个摆锤,将 sin θ \sin\theta sin θ 替换为 θ \theta θ 会使其运动方程变成 模块 13 可以精确求解的形式,这就是为什么单摆周期的常用公式只在小幅度摆动时成立。以度数表示的近似为 sin ( θ ∘ ) ≈ π θ / 180 , \sin(\theta^\circ) \approx \pi\theta/180\mathclose{\text{,}} sin ( θ ∘ ) ≈ π θ /180 , 带有不便于计算的系数:这也是微积分在弧度中更有效的原因。
微分
莱布尼茨的符号 d y / d x dy/dx d y / d x 看起来像一个分数。微分赋予了它的两个部分各自独立的意义。
定义 7.2微分
设 y = f ( x ) , y = f(x)\mathclose{\text{,}} y = f ( x ) , 其中 f f f 可导。微分 differential d x dx d x 是一个独立变量:它可以是任意实数。微分differential d y dy d y 则定义为
d y = f ′ ( x ) d x . dy = f'(x)\,dx. d y = f ′ ( x ) d x .
所以 d y dy d y 依赖于两个数,即 x x x 和 d x 。 dx\mathclose{\text{。}} d x 。
对于 d x ≠ 0 , dx \ne 0\mathclose{\text{,}} d x = 0 , 除以 d x dx d x 得到 d y / d x = f ′ ( x ) : dy/dx = f'(x)\mathclose{\text{:}} d y / d x = f ′ ( x ) : 导数终究是微分的商。比较 d y dy d y 与当 x x x 改变 Δ x = d x \Delta x = dx Δ x = d x 时 y y y 的实际变化量,
Δ y = f ( x + d x ) − f ( x ) . \Delta y = f(x + dx) - f(x). Δ y = f ( x + d x ) − f ( x ) .
在图 7.2 左图中,Δ y \Delta y Δ y 是曲线从 a a a 到 a + d x a + dx a + d x 的增量,d y dy d y 是同一区间内切线的增量,两者满足 d y = L ( a + d x ) − L ( a ) 。 dy = L(a + dx) - L(a)\mathclose{\text{。}} d y = L ( a + d x ) − L ( a ) 。 由定理 7.1,当 d x dx d x 很小时,Δ y − d y \Delta y - dy Δ y − d y 相对于 d x dx d x 很小,因此 Δ y ≈ d y 。 \Delta y \approx dy\mathclose{\text{。}} Δ y ≈ d y 。
例 7.7
d y dy d y 和 Δ y \Delta y Δ y 对于一个立方体✓ 已检验
设 y = x 3 。 y = x^3\mathclose{\text{。}} y = x 3 。 当 x = 2 x = 2 x = 2 和 d x = 0.05 dx = 0.05 d x = 0.05 时,求 d y dy d y 和 Δ y 。 \Delta y\mathclose{\text{。}} Δ y 。
d y = 3 x 2 d x = 3 ⋅ 4 ⋅ 0.05 = 0.6 。 dy = 3x^2\,dx = 3 \cdot 4 \cdot 0.05 = 0.6\mathclose{\text{。}} d y = 3 x 2 d x = 3 ⋅ 4 ⋅ 0.05 = 0.6 。 实际变化为
Δ y = 2.05 3 − 2 3 = 8.615125 − 8 = 0.615125. \begin{aligned} \Delta y &= 2.05^3 - 2^3 \\ &= 8.615125 - 8 = 0.615125. \end{aligned} Δ y = 2.0 5 3 − 2 3 = 8.615125 − 8 = 0.615125.
微分误差为 0.015125 , 0.015125\mathclose{\text{,}} 0.015125 , 约为 Δ y \Delta y Δ y 的 2.5%。展开说明误差来源:( 2 + d x ) 3 − 8 = 12 d x + 6 ( d x ) 2 + ( d x ) 3 , (2 + dx)^3 - 8 = 12\,dx + 6\,(dx)^2 + (dx)^3\mathclose{\text{,}} ( 2 + d x ) 3 − 8 = 12 d x + 6 ( d x ) 2 + ( d x ) 3 , 而 d y = 12 d x dy = 12\,dx d y = 12 d x 仅保留首项。
注意
d y dy d y 不等于 Δ y 。 \Delta y\mathclose{\text{。}} Δ y 。 微分是沿切线的变化,Δ y \Delta y Δ y 是沿曲线的变化。它们仅在 d x dx d x 很小时才接近,而 d y dy d y 是容易计算的,因此有用。
每个测量值都有误差,从测量值计算出的任何量也会继承误差。微分可以估计这种误差:如果 x x x 被测量时有误差 Δ x , \Delta x\mathclose{\text{,}} Δ x , 那么 y = f ( x ) y = f(x) y = f ( x ) 的误差为
Δ y ≈ d y = f ′ ( x ) Δ x . \Delta y \approx dy = f'(x)\,\Delta x. Δ y ≈ d y = f ′ ( x ) Δ x .
定义 7.3绝对误差和相对误差
假设一个真值为x x x 的量被测量或计算为x ~ \tilde x x ~ (读作“x 波浪”)。x ~ \tilde x x ~ 的误差 为Δ x = x − x ~ : \Delta x = x - \tilde x\mathclose{\text{:}} Δ x = x − x ~ : 真值减去近似值,其量级与第7.2节中f ( x ) − L ( x ) f(x) - L(x) f ( x ) − L ( x ) 的误差相同。绝对误差 为∣ Δ x ∣ 。 \abs{\Delta x}\mathclose{\text{。}} ∣ Δ x ∣ 。 对于x ≠ 0 , x \ne 0\mathclose{\text{,}} x = 0 , 相对误差 为∣ Δ x ∣ / ∣ x ∣ ; \abs{\Delta x}/\abs{x}\mathclose{\text{;}} ∣ Δ x ∣ / ∣ x ∣ ; 以百分比表示,即为百分比误差 。
实际应用中,你既不知道真实值,也不知道误差,只知道测量值和误差的上界,例如 “10.0 厘米,误差不超过 0.1 厘米”;此时你将上界除以测量值。当误差较小时,这种差异可以忽略。
例 7.8一个球体的体积 ✓ 已检验
假设一个球的半径测量为 10.0 cm,误差不超过 0.1 cm。
(a) 估计由该半径计算出的体积的最大可能误差,作为绝对误差和相对误差。
(b) 要使体积的误差不超过 1%,半径必须测量到什么精度?
(a) V = 4 3 π r 3 , V = \tfrac43\pi r^3\mathclose{\text{,}} V = 3 4 π r 3 , 所以 d V = 4 π r 2 d r 。 dV = 4\pi r^2\,dr\mathclose{\text{。}} d V = 4 π r 2 d r 。 与 r = 10 r = 10 r = 10 和 ∣ d r ∣ ≤ 0.1 , \abs{dr} \le 0.1\mathclose{\text{,}} ∣ d r ∣ ≤ 0.1 ,
∣ d V ∣ ≤ 4 π ⋅ 10 2 ⋅ 0.1 = 40 π ≈ 126 cm 3 . \abs{dV} \le 4\pi \cdot 10^2 \cdot 0.1 = 40\pi \approx 126 \text{ cm}^3. ∣ d V ∣ ≤ 4 π ⋅ 1 0 2 ⋅ 0.1 = 40 π ≈ 126 cm 3 .
计算出的体积是 V = 4000 π 3 ≈ 4189 V = \tfrac{4000\pi}{3} \approx 4189 V = 3 4000 π ≈ 4189 cm³,因此相对误差最多约为
40 π 4000 π / 3 = 3 100 = 3 % . \frac{40\pi}{4000\pi/3} = \frac{3}{100} = 3\%. 4000 π /3 40 π = 100 3 = 3%.
精确的变化确认了估计值: V ( 10.1 ) − V ( 10 ) ≈ 126.9 V(10.1) - V(10) \approx 126.9 V ( 10.1 ) − V ( 10 ) ≈ 126.9 cm³ 和 V ( 9.9 ) − V ( 10 ) ≈ − 124.4 V(9.9) - V(10) \approx -124.4 V ( 9.9 ) − V ( 10 ) ≈ − 124.4 cm³。
(b) 将d V = 4 π r 2 d r dV = 4\pi r^2\,dr d V = 4 π r 2 d r 除以V = 4 3 π r 3 : V = \tfrac43\pi r^3\mathclose{\text{:}} V = 3 4 π r 3 :
d V V = 3 d r r . \frac{dV}{V} = 3\,\frac{dr}{r}. V d V = 3 r d r .
体积的相对误差是半径相对误差的三倍。为了体积误差不超过 1%,半径误差必须不超过 1 3 % : \tfrac13\%\mathclose{\text{:}} 3 1 % : 对于 r = 10 r = 10 r = 10 cm,误差不超过 10 × 1 300 ≈ 0.033 10 \times \tfrac{1}{300} \approx 0.033 10 × 300 1 ≈ 0.033 cm,即约三分之一毫米。
相同的计算适用于任何幂次。若 y = c x k , y = c\,x^k\mathclose{\text{,}} y = c x k , 常数为 c ≠ 0 c \ne 0 c = 0 和 k , k\mathclose{\text{,}} k , 则 d y = c k x k − 1 d x , dy = ck\,x^{k-1}\,dx\mathclose{\text{,}} d y = c k x k − 1 d x , 并除以 y , y\mathclose{\text{,}} y ,
d y y = k d x x . \frac{dy}{y} = k\,\frac{dx}{x}. y d y = k x d x .
所以一个 k k k 次幂的相对误差大约是 ∣ k ∣ \abs{k} ∣ k ∣ 倍的 x x x 的相对误差。一个平方使它加倍,一个立方使它三倍,一个平方根使它减半,无论常数 c c c 是什么。
注意
估计 Δ y ≈ d y \Delta y \approx dy Δ y ≈ d y 是一个线性近似,因此它只适用于小误差。如果半径测量大了 50%,公式说明体积的误差为 3 × 50 % = 150 % , 3 \times 50\% = 150\%\mathclose{\text{,}} 3 × 50% = 150% , 但 1.5 3 = 3.375 , 1.5^3 = 3.375\mathclose{\text{,}} 1. 5 3 = 3.375 , 因此真实误差为 237.5 % 。 237.5\%\mathclose{\text{。}} 237.5% 。 对于大误差,计算 f ( x + Δ x ) − f ( x ) f(x + \Delta x) - f(x) f ( x + Δ x ) − f ( x ) 本身。
须知
计算机也会产生相对误差。浮点数的相对误差至多约为 10 − 16 。 10^{-16}\mathclose{\text{。}} 1 0 − 16 。 上述法则说明了计算 f ( x ) f(x) f ( x ) 时这种误差被放大多少:放大倍数为 ∣ x f ′ ( x ) / f ( x ) ∣ , \abs{x f'(x)/f(x)}\mathclose{\text{,}} ∣ x f ′ ( x ) / f ( x ) ∣ , 即 f f f 在 x x x 处的条件数 。对于 x k , x^k\mathclose{\text{,}} x k , 条件数是 ∣ k ∣ ; \abs{k}\mathclose{\text{;}} ∣ k ∣ ; 对于 x − 1 , x - 1\mathclose{\text{,}} x − 1 , 条件数是 ∣ x / ( x − 1 ) ∣ , \abs{x/(x - 1)}\mathclose{\text{,}} ∣ x / ( x − 1 ) ∣ , 且在 x = 1 x = 1 x = 1 附近很大,对应于模块 2 中的相消误差。练习 7.12 进一步讨论条件数。
大多数方程无法通过代数方法精确求解:对 cos x = x \cos x = x cos x = x 进行任何重排都无法将 x x x 单独留在等式的一边,即使存在求解公式,如三次方程 x 3 − 2 x − 5 = 0 , x^3 - 2x - 5 = 0\mathclose{\text{,}} x 3 − 2 x − 5 = 0 , 通常更易于通过数值方法计算根。模块 3 的二分法将包含根的区间一分为二,每次迭代增加一个二进制位,约增加 0.3 个十进制位。 牛顿法 (也称为牛顿-拉夫森法)使用导数。在接近根的区域,它要快得多;但与二分法不同,它没有保证,本节末尾将展示它可能失败的情况。
思想。 在根 r r r 附近 f , f\mathclose{\text{,}} f , 用函数 f f f 在某一点 x 0 x_0 x 0 处的切线代替原函数图像,并解这个简单的方程:切线与 x x x 轴的交点在哪里?记作点 x 1 。 x_1\mathclose{\text{。}} x 1 。 这个点通常更接近 r r r (图 7.3)。然后从 x 1 x_1 x 1 重复上述过程。
在 ( x n , f ( x n ) ) \big(x_n, f(x_n)\big) ( x n , f ( x n ) ) 处的切线,其中 x n x_n x n 读作 “x 下标 n”,是 y = f ( x n ) + f ′ ( x n ) ( x − x n ) , y = f(x_n) + f'(x_n)(x - x_n)\mathclose{\text{,}} y = f ( x n ) + f ′ ( x n ) ( x − x n ) , 即 f f f 在 x n x_n x n 处的线性近似。它在 x x x 轴上的截距为 y = 0 。 y = 0\mathclose{\text{。}} y = 0 。 如果 f ′ ( x n ) ≠ 0 , f'(x_n) \ne 0\mathclose{\text{,}} f ′ ( x n ) = 0 , 解 0 = f ( x n ) + f ′ ( x n ) ( x − x n ) 0 = f(x_n) + f'(x_n)(x - x_n) 0 = f ( x n ) + f ′ ( x n ) ( x − x n ) 关于 x x x 得到 x = x n − f ( x n ) / f ′ ( x n ) 。 x = x_n - f(x_n)/f'(x_n)\mathclose{\text{。}} x = x n − f ( x n ) / f ′ ( x n ) 。
定义 7.4牛顿法
解 f ( x ) = 0 , f(x) = 0\mathclose{\text{,}} f ( x ) = 0 , 其中 f f f 可导,选择一个初始值 x 0 x_0 x 0 并计算
x n + 1 = x n − f ( x n ) f ′ ( x n ) , n = 0 , 1 , 2 , … , x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}, \quad n = 0, 1, 2, \dots, x n + 1 = x n − f ′ ( x n ) f ( x n ) , n = 0 , 1 , 2 , … ,
只要 f ′ ( x n ) ≠ 0 。 f'(x_n) \ne 0\mathclose{\text{。}} f ′ ( x n ) = 0 。 数列 x 0 , x 1 , x 2 , … x_0, x_1, x_2, \dots x 0 , x 1 , x 2 , … 是 迭代值 。当它们不再变化到你所需的精度时停止。
图 7.3 针对f ( x ) = x 2 − 2 f(x) = x^2 - 2 f ( x ) = x 2 − 2 的牛顿法,从x 0 = 3 x_0 = 3 x 0 = 3 开始。在( x 0 , f ( x 0 ) ) \big(x_0, f(x_0)\big) ( x 0 , f ( x 0 ) ) 处的切线与x x x 轴交于x 1 ≈ 1.83 ; x_1 \approx 1.83\mathclose{\text{;}} x 1 ≈ 1.83 ; 在( x 1 , f ( x 1 ) ) \big(x_1, f(x_1)\big) ( x 1 , f ( x 1 ) ) 处的切线与之交于x 2 ≈ 1.46 。 x_2 \approx 1.46\mathclose{\text{。}} x 2 ≈ 1.46 。 下一个迭代值x 3 ≈ 1.415 x_3 \approx 1.415 x 3 ≈ 1.415 过于接近根2 , \sqrt2\mathclose{\text{,}} 2 , 以至于在此尺度下无法区分。
可以用正确的小数位数来衡量迭代近似的精度。若数 r r r 的近似值 x ~ \tilde x x ~ 的绝对误差小于第 d d d 位小数的半个单位,即 ∣ r − x ~ ∣ < 0.5 × 10 − d , \abs{r - \tilde x} < 0.5 \times 10^{-d}\mathclose{\text{,}} ∣ r − x ~ ∣ < 0.5 × 1 0 − d , 就说它精确到 d d d 位小数 。精确到 0 位小数意味着与 r r r 的距离仍小于 0.5。距离更大时,x ~ \tilde x x ~ 连 0 位小数的精度也达不到。
例 7.9
牛顿法用于 2 \sqrt2 2 ✓ 已检验
使用牛顿法计算 2 , \sqrt2\mathclose{\text{,}} 2 , 从 x 0 = 1 x_0 = 1 x 0 = 1 开始。
2 \sqrt2 2 是 f ( x ) = x 2 − 2 f(x) = x^2 - 2 f ( x ) = x 2 − 2 的正根,且 f ′ ( x ) = 2 x 。 f'(x) = 2x\mathclose{\text{。}} f ′ ( x ) = 2 x 。 这一步简化为:
x n + 1 = x n − x n 2 − 2 2 x n = 2 x n 2 − x n 2 + 2 2 x n = 1 2 ( x n + 2 x n ) . \begin{aligned} x_{n+1} &= x_n - \frac{x_n^2 - 2}{2x_n} = \frac{2x_n^2 - x_n^2 + 2}{2x_n} \\ &= \frac12\Big(x_n + \frac{2}{x_n}\Big). \end{aligned} x n + 1 = x n − 2 x n x n 2 − 2 = 2 x n 2 x n 2 − x n 2 + 2 = 2 1 ( x n + x n 2 ) .
从 x 0 = 1 : x_0 = 1\mathclose{\text{:}} x 0 = 1 :
x 1 = 1 2 ( 1 + 2 ) = 3 2 , x 2 = 1 2 ( 3 2 + 4 3 ) = 17 12 , x 3 = 1 2 ( 17 12 + 24 17 ) = 577 408 . \begin{aligned} x_1 &= \tfrac12(1 + 2) = \tfrac32, \\ x_2 &= \tfrac12\Big(\tfrac32 + \tfrac43\Big) = \tfrac{17}{12}, \\ x_3 &= \tfrac12\Big(\tfrac{17}{12} + \tfrac{24}{17}\Big) = \tfrac{577}{408}. \end{aligned} x 1 x 2 x 3 = 2 1 ( 1 + 2 ) = 2 3 , = 2 1 ( 2 3 + 3 4 ) = 12 17 , = 2 1 ( 12 17 + 17 24 ) = 408 577 .
再进行两步,精确地由计算机完成,得到表格;比较 2 = 1.414213562373095 … : \sqrt2 = 1.414213562373095\ldots\mathclose{\text{:}} 2 = 1.414213562373095 … :
x n x_{n} x n x n in decimals x_n\text{ in decimals} x n in decimals x n − 2 x_n - \sqrt{2} x n − 2 1 1 1 1.000000000000000 1.000000000000000 1.000000000000000 − 0.414213562373095 -0.414213562373095 − 0.414213562373095 3 2 \frac{3}{2} 2 3 1.500000000000000 1.500000000000000 1.500000000000000 0.085786437626905 0.085786437626905 0.085786437626905 17 12 \frac{17}{12} 12 17 1.416666666666667 1.416666666666667 1.416666666666667 0.002453104293572 0.002453104293572 0.002453104293572 577 408 \frac{577}{408} 408 577 1.414215686274510 1.414215686274510 1.414215686274510 0.000002123901415 0.000002123901415 0.000002123901415 665857 470832 \frac{665857}{470832} 470832 665857 1.414213562374690 1.414213562374690 1.414213562374690 0.000000000001595 0.000000000001595 0.000000000001595 886731088897 627013566048 \frac{886731088897}{627013566048} 627013566048 886731088897 1.414213562373095 1.414213562373095 1.414213562373095 0.000000000000000 0.000000000000000 0.000000000000000
迭代值 x 0 , … , x 5 x_0, \dots, x_5 x 0 , … , x 5 分别正确到 0、0、2、5、11 和 23 位小数:从 x 2 x_2 x 2 开始,每一步大约将正确的小数位数翻倍。(表格显示 15 位小数,因此最后一行看起来是精确的;其误差约为 9 × 10 − 25 。) 9 \times 10^{-25}\mathclose{\text{。)}} 9 × 1 0 − 25 。)
例 7.10
求解 cos x = x \cos x = x cos x = x ✓ 已检验
证明 cos x = x \cos x = x cos x = x 在 [ 0 , 1 ] [0, 1] [ 0 , 1 ] 中恰好有一个解,并用牛顿法从 x 0 = 1 x_0 = 1 x 0 = 1 找到它。
设 f ( x ) = cos x − x . f(x) = \cos x - x\mathclose{\text{.}} f ( x ) = cos x − x . 然后 f ( 0 ) = 1 > 0 f(0) = 1 > 0 f ( 0 ) = 1 > 0 和 f ( 1 ) = cos 1 − 1 < 0 , f(1) = \cos 1 - 1 < 0\mathclose{\text{,}} f ( 1 ) = cos 1 − 1 < 0 , 因此根据介值定理(模块 3),f f f 在 ( 0 , 1 ) (0, 1) ( 0 , 1 ) 内有一个根。只有一个:在 [ 0 , 1 ] [0, 1] [ 0 , 1 ] 上,cos x \cos x cos x 减少(在单位圆上,角度为 x x x 的点的 x x x 坐标随着 x x x 从 0 增加到 π \pi π 而减少),且 − x -x − x 也减少,因此 f f f 严格递减,并且仅在一次取值为 0。
当 f ′ ( x ) = − sin x − 1 f'(x) = -\sin x - 1 f ′ ( x ) = − sin x − 1 时,牛顿迭代步为
x n + 1 = x n − cos x n − x n − sin x n − 1 = x n + cos x n − x n sin x n + 1 . \begin{aligned} x_{n+1} &= x_n - \frac{\cos x_n - x_n}{-\sin x_n - 1} \\ &= x_n + \frac{\cos x_n - x_n}{\sin x_n + 1}. \end{aligned} x n + 1 = x n − − sin x n − 1 cos x n − x n = x n + sin x n + 1 cos x n − x n .
由 x 0 = 1 : x_0 = 1\mathclose{\text{:}} x 0 = 1 : x 1 = 1 + cos 1 − 1 sin 1 + 1 ≈ 1 + − 0.45970 1.84147 ≈ 0.75036 。 x_1 = 1 + \dfrac{\cos 1 - 1}{\sin 1 + 1} \approx 1 + \dfrac{-0.45970}{1.84147} \approx 0.75036\mathclose{\text{。}} x 1 = 1 + sin 1 + 1 cos 1 − 1 ≈ 1 + 1.84147 − 0.45970 ≈ 0.75036 。 进一步的步骤(下面的计算框执行这些步骤)得到
x 2 ≈ 0.7391129 , x 3 ≈ 0.739085133385 , x 4 ≈ 0.739085133215161 , \begin{aligned} x_2 &\approx 0.7391129, \\ x_3 &\approx 0.739085133385, \\ x_4 &\approx 0.739085133215161, \end{aligned} x 2 x 3 x 4 ≈ 0.7391129 , ≈ 0.739085133385 , ≈ 0.739085133215161 ,
对 x 1 , … , x 4 x_1, \dots, x_4 x 1 , … , x 4 正确到 1、4、9 和 19 位小数。解为 x ≈ 0.739085133215161 , x \approx 0.739085133215161\mathclose{\text{,}} x ≈ 0.739085133215161 , 精确到 15 位小数。
动手计算用 Python 实现牛顿法
几行 Python 代码即可实现牛顿法。以下是例 7.10 的迭代结果(浮点数):
Python 复制
import math
def newton (f, df, x, steps):
for n in range (1 , steps + 1 ):
x = x - f (x)/df (x)
print (f"x{n} = {x:.16f} f(x{n}) = {f(x):.1e}" )
return x
f = lambda x: math.cos (x) - x
df = lambda x: -math.sin (x) - 1
root = newton (f, df, 1.0 , 5 )
输出
x1 = 0.7503638678402439 f(x1) = -1.9e-02
x2 = 0.7391128909113617 f(x2) = -4.6e-05
x3 = 0.7390851333852840 f(x3) = -2.8e-10
x4 = 0.7390851332151607 f(x4) = 0.0e+00
x5 = 0.7390851332151607 f(x5) = 0.0e+00
经过四步后 f ( x 4 ) f(x_4) f ( x 4 ) 在浮点数中恰好为 0,第五步没有变化:迭代值已达到双精度的极限,大约 16 位有效数字。二分法需要超过 50 次 [ 0 , 1 ] [0, 1] [ 0 , 1 ] 的划分才能达到同样接近的程度。
平方根的计算方式也是一样的。这个函数使用例 7.9 中的步骤 x n + 1 = 1 2 ( x n + a / x n ) x_{n+1} = \tfrac12(x_n + a/x_n) x n + 1 = 2 1 ( x n + a / x n ) 来计算 a 。 \sqrt a\mathclose{\text{。}} a 。 它开始时大于 a ; \sqrt a\mathclose{\text{;}} a ; 下面的定理 7.2 表明,迭代值随后会减少并趋近于 a , \sqrt a\mathclose{\text{,}} a , 因此函数一旦发现迭代值不再减少就会停止:
Python 复制
def my_sqrt (a):
x = max (a, 1.0 ) # a starting value above sqrt(a)
steps = 0
while True :
new = (x + a/x)/2
steps += 1
if new >= x: # no longer decreasing: as good as it gets
return x, steps
x = new
for a in [2.0 , 3.0 , 1e6 ]:
print (a, my_sqrt (a), math.sqrt (a))
输出
2.0 (1.414213562373095, 6) 1.4142135623730951
3.0 (1.7320508075688772, 6) 1.7320508075688772
1000000.0 (1000.0, 16) 1000.0
对于 3 和 10 6 , 10^6\mathclose{\text{,}} 1 0 6 , 结果与 math.sqrt 在最后一位数字上一致。对于 2,它们在最后一位二进制数字上有所不同,差值为 2 − 52 ≈ 2.2 × 10 − 16 : 2^{-52} \approx 2.2 \times 10^{-16}\mathclose{\text{:}} 2 − 52 ≈ 2.2 × 1 0 − 16 : math.sqrt 返回最接近 2 \sqrt2 2 的浮点数,而这个函数返回下一个更小的浮点数,要正确得到最后一位数字需要比这个简短函数更多的处理。对于 10 6 10^6 1 0 6 的 16 步显示了不良初始值的代价:从 x 0 = 10 6 x_0 = 10^6 x 0 = 1 0 6 开始,每一步早期的迭代只将 x x x 减半,因为 a / x a/x a / x 相比于 x x x 小很多;直到接近根时,数字才开始翻倍。
为什么数字会翻倍
平方根情形的位数倍增只需几行即可证明。处理迭代时,取与近似误差相反的符号,记 e n = x n − r , e_n = x_n - r\mathclose{\text{,}} e n = x n − r , 其中 r r r 是根。它是 x n x_n x n 的误差(定义 7.3)反号所得。当 x n x_n x n 偏大时它为正,∣ e n ∣ \abs{e_n} ∣ e n ∣ 为绝对误差。
定理 7.2牛顿法求平方根
设 a > 0 a > 0 a > 0 和 x 0 > 0 , x_0 > 0\mathclose{\text{,}} x 0 > 0 , 并设 x n + 1 = 1 2 ( x n + a / x n ) x_{n+1} = \tfrac12\big(x_n + a/x_n\big) x n + 1 = 2 1 ( x n + a / x n ) 为 n = 0 , 1 , 2 , … 。 n = 0, 1, 2, \dots\mathclose{\text{。}} n = 0 , 1 , 2 , … 。 则
x n + 1 − a = ( x n − a ) 2 2 x n . x_{n+1} - \sqrt a = \frac{(x_n - \sqrt a)^2}{2x_n}. x n + 1 − a = 2 x n ( x n − a ) 2 .
因此,对于每一个 n ≥ 1 , n \ge 1\mathclose{\text{,}} n ≥ 1 , x n ≥ a x_n \ge \sqrt a x n ≥ a 从 x 1 x_1 x 1 开始递减,并且趋近于 a 。 \sqrt a\mathclose{\text{。}} a 。
证明
所有迭代值都是正数:x 0 > 0 , x_0 > 0\mathclose{\text{,}} x 0 > 0 , 且每一步都是两个正数的平均值。将步骤放在同一分母下,并减去 a : \sqrt a\mathclose{\text{:}} a :
x n + 1 − a = x n 2 + a 2 x n − a = x n 2 − 2 a x n + a 2 x n = ( x n − a ) 2 2 x n . \begin{aligned} x_{n+1} - \sqrt a &= \frac{x_n^2 + a}{2x_n} - \sqrt a \\ &= \frac{x_n^2 - 2\sqrt a\,x_n + a}{2x_n} \\ &= \frac{(x_n - \sqrt a)^2}{2x_n}. \end{aligned} x n + 1 − a = 2 x n x n 2 + a − a = 2 x n x n 2 − 2 a x n + a = 2 x n ( x n − a ) 2 .
右边的值从不为负,因此 x n + 1 ≥ a x_{n+1} \ge \sqrt a x n + 1 ≥ a 对于每一个 n ≥ 0 : n \ge 0\mathclose{\text{:}} n ≥ 0 : 从 x 1 x_1 x 1 开始的所有迭代值都不小于 a 。 \sqrt a\mathclose{\text{。}} a 。 对于这样的 x n , x_n\mathclose{\text{,}} x n , a / x n ≤ a ≤ x n , a/x_n \le \sqrt a \le x_n\mathclose{\text{,}} a / x n ≤ a ≤ x n , 因此 x n + 1 , x_{n+1}\mathclose{\text{,}} x n + 1 , 即 a / x n a/x_n a / x n 和 x n x_n x n 的平均值,最多为 x n : x_n\mathclose{\text{:}} x n : 迭代值在减小。最后,这里根是 a , \sqrt a\mathclose{\text{,}} a , 因此 e n = x n − a 。 e_n = x_n - \sqrt a\mathclose{\text{。}} e n = x n − a 。 对于 n ≥ 1 , n \ge 1\mathclose{\text{,}} n ≥ 1 , 0 ≤ e n < x n , 0 \le e_n < x_n\mathclose{\text{,}} 0 ≤ e n < x n , 因此
e n + 1 = e n ⋅ e n 2 x n ≤ e n 2 , e_{n+1} = e_n \cdot \frac{e_n}{2x_n} \le \frac{e_n}{2}, e n + 1 = e n ⋅ 2 x n e n ≤ 2 e n ,
和 e n ≤ e 1 / 2 n − 1 , e_n \le e_1/2^{n-1}\mathclose{\text{,}} e n ≤ e 1 / 2 n − 1 , 它趋近于 0。
∎
该恒等式解释了例 7.9 的表格。在根 2 x n ≈ 2 2 ≈ 2.8 2x_n \approx 2\sqrt2 \approx 2.8 2 x n ≈ 2 2 ≈ 2.8 附近,因此 e n + 1 ≈ e n 2 / 2.8 : e_{n+1} \approx e_n^2/2.8\mathclose{\text{:}} e n + 1 ≈ e n 2 /2.8 : 误差 10 − 5 10^{-5} 1 0 − 5 变为约 4 × 10 − 11 4 \times 10^{-11} 4 × 1 0 − 11 的误差。平方误差会使小数点后零的个数翻倍,因此正确数字的个数也翻倍。
对于任何在根处导数不为零的函数,都会发生相同的情况。
定理 7.3牛顿法收敛于二次速度
设f ( r ) = 0 。 f(r) = 0\mathclose{\text{。}} f ( r ) = 0 。 假设f ′ f' f ′ 和f ′ ′ f'' f ′′ 在包含r r r 的开区间上连续,且满足f ′ ( r ) ≠ 0 。 f'(r) \ne 0\mathclose{\text{。}} f ′ ( r ) = 0 。 则存在一个δ > 0 , \delta > 0\mathclose{\text{,}} δ > 0 , 使得对于每个满足∣ x 0 − r ∣ < δ \abs{x_0 - r} < \delta ∣ x 0 − r ∣ < δ 的初始值x 0 , x_0\mathclose{\text{,}} x 0 , 牛顿法永远不遇到f ′ ( x n ) = 0 , f'(x_n) = 0\mathclose{\text{,}} f ′ ( x n ) = 0 , 迭代序列趋近于r , r\mathclose{\text{,}} r , 且e n = x n − r e_n = x_n - r e n = x n − r 满足
lim n → ∞ e n + 1 e n 2 = f ′ ′ ( r ) 2 f ′ ( r ) \lim_{n\to\infty}\frac{e_{n+1}}{e_n^2} = \frac{f''(r)}{2f'(r)} n → ∞ lim e n 2 e n + 1 = 2 f ′ ( r ) f ′′ ( r )
(如果没有任何迭代恰好落在 r r r 上)。每个 e n + 1 e_{n+1} e n + 1 大致是 e n 2 e_n^2 e n 2 的一个固定倍数,因此每个绝对误差大致是前一个误差的平方的固定倍数:牛顿法 收敛速度为二次收敛 。
证明的思想。 牛顿法求解 L n ( x ) = 0 , L_n(x) = 0\mathclose{\text{,}} L n ( x ) = 0 , 其中 L n L_n L n 是 f f f 在 x n x_n x n 处的线性化。根求解 f ( r ) = 0 , f(r) = 0\mathclose{\text{,}} f ( r ) = 0 , 并且根据第7.2节,线性化在 r r r 处的误差为 f ( r ) − L n ( r ) ≈ 1 2 f ′ ′ ( x n ) ( r − x n ) 2 , f(r) - L_n(r) \approx \tfrac12 f''(x_n)(r - x_n)^2\mathclose{\text{,}} f ( r ) − L n ( r ) ≈ 2 1 f ′′ ( x n ) ( r − x n ) 2 , 因此 L n ( r ) ≈ − 1 2 f ′ ′ ( x n ) e n 2 。 L_n(r) \approx -\tfrac12 f''(x_n)\,e_n^2\mathclose{\text{。}} L n ( r ) ≈ − 2 1 f ′′ ( x n ) e n 2 。 但 L n L_n L n 是一条斜率为 f ′ ( x n ) f'(x_n) f ′ ( x n ) 的直线,在 x n + 1 x_{n+1} x n + 1 处为 0,因此 L n ( r ) = f ′ ( x n ) ( r − x n + 1 ) = − f ′ ( x n ) e n + 1 。 L_n(r) = f'(x_n)(r - x_{n+1}) = -f'(x_n)\,e_{n+1}\mathclose{\text{。}} L n ( r ) = f ′ ( x n ) ( r − x n + 1 ) = − f ′ ( x n ) e n + 1 。 将 L n ( r ) L_n(r) L n ( r ) 的两个表达式相等得到
e n + 1 ≈ f ′ ′ ( x n ) 2 f ′ ( x n ) e n 2 . e_{n+1} \approx \frac{f''(x_n)}{2f'(x_n)}\,e_n^2. e n + 1 ≈ 2 f ′ ( x n ) f ′′ ( x n ) e n 2 .
泰勒定理(模块 15)控制第一个 ≈ \approx ≈ 的误差,并将这一思想转化为证明。对于 f ( x ) = x 2 − a , f(x) = x^2 - a\mathclose{\text{,}} f ( x ) = x 2 − a , 常数是 2 2 ⋅ 2 a = 1 2 a , \dfrac{2}{2 \cdot 2\sqrt a} = \dfrac{1}{2\sqrt a}\mathclose{\text{,}} 2 ⋅ 2 a 2 = 2 a 1 , 如定理 7.2 所示;对于 2 , \sqrt2\mathclose{\text{,}} 2 , 常数是 1 / ( 2 2 ) ≈ 0.354 , 1/(2\sqrt2) \approx 0.354\mathclose{\text{,}} 1/ ( 2 2 ) ≈ 0.354 , 并且示例 7.9 中的迭代确实给出 e 5 / e 4 2 ≈ 0.354 。 e_5/e_4^2 \approx 0.354\mathclose{\text{。}} e 5 / e 4 2 ≈ 0.354 。
如何计算平方根
程序在图形、物理模拟和机器学习中不断计算平方根,从一个良好的初始值进行几次牛顿迭代是实现这一目标的标准方法之一。两个想法使其计算速度加快。
一个良好的初始值。 浮点数以 a = m × 2 e a = m \times 2^e a = m × 2 e 的形式存储,其中 1 ≤ m < 2 1 \le m < 2 1 ≤ m < 2 是尾数,且有一个整数指数 e 。 e\mathclose{\text{。}} e 。 如果 e e e 是奇数,将一个因子 2 移到 m m m 中,使 e e e 变为偶数,得到 1 ≤ m < 4 , 1 \le m < 4\mathclose{\text{,}} 1 ≤ m < 4 , 然后得到 a = m × 2 e / 2 。 \sqrt a = \sqrt m \times 2^{e/2}\mathclose{\text{。}} a = m × 2 e /2 。 因此,只需要计算 1 到 4 之间数的平方根,一个小的表格或一个简单的公式就可以提供一个相对误差较小的初始值,例如最大误差不超过 1%。
几步。 写 x n = a ( 1 + ε n ) , x_n = \sqrt a\,(1 + \varepsilon_n)\mathclose{\text{,}} x n = a ( 1 + ε n ) , 使得 ε n = e n / a \varepsilon_n = e_n/\sqrt a ε n = e n / a (ε \varepsilon ε 是希腊字母 “epsilon”)在 x n x_n x n 太大时为正,且 ∣ ε n ∣ \abs{\varepsilon_n} ∣ ε n ∣ 是 x n x_n x n 的相对误差。将此代入定理 7.2 的恒等式,并除以 a \sqrt a a 得到
ε n + 1 = ε n 2 2 ( 1 + ε n ) . \varepsilon_{n+1} = \frac{\varepsilon_n^2}{2(1 + \varepsilon_n)}. ε n + 1 = 2 ( 1 + ε n ) ε n 2 .
从 ∣ ε 0 ∣ ≤ 0.01 : \abs{\varepsilon_0} \le 0.01\mathclose{\text{:}} ∣ ε 0 ∣ ≤ 0.01 : ε 1 ≤ 0.0001 / ( 2 × 0.99 ) ≈ 5.1 × 10 − 5 , \varepsilon_1 \le 0.0001/(2 \times 0.99) \approx 5.1 \times 10^{-5}\mathclose{\text{,}} ε 1 ≤ 0.0001/ ( 2 × 0.99 ) ≈ 5.1 × 1 0 − 5 , 然后继续 ε n ≥ 0 , \varepsilon_n \ge 0\mathclose{\text{,}} ε n ≥ 0 , 因此 ε n + 1 ≤ ε n 2 / 2 , \varepsilon_{n+1} \le \varepsilon_n^2/2\mathclose{\text{,}} ε n + 1 ≤ ε n 2 /2 , 从而得到 ε 2 ≤ 1.3 × 10 − 9 \varepsilon_2 \le 1.3 \times 10^{-9} ε 2 ≤ 1.3 × 1 0 − 9 和 ε 3 ≤ 8.2 × 10 − 19 。 \varepsilon_3 \le 8.2 \times 10^{-19}\mathclose{\text{。}} ε 3 ≤ 8.2 × 1 0 − 19 。 这远远低于双精度数的精度,相对误差约为 1.1 × 10 − 16 : 1.1 \times 10^{-16}\mathclose{\text{:}} 1.1 × 1 0 − 16 : 三步就足够了。
在大多数处理器上,除法比乘法慢,因此在速度至关重要的地方,一种无需除法的变体很受欢迎:将 1 / y 2 − a = 0 1/y^2 - a = 0 1/ y 2 − a = 0 应用于牛顿法,其根为 1 / a , 1/\sqrt a\mathclose{\text{,}} 1/ a , 只需乘法(练习 7.10)。例如,图形程序需要 1 / a 1/\sqrt a 1/ a 来将向量缩放为长度 1。
当牛顿法失效时
定理 7.3 仅在 x 0 x_0 x 0 足够接近一个根时才保证成功,该根处 f ′ f' f ′ 不为 0(且 f ′ ′ f'' f ′′ 在该点附近连续)。它并未说明“足够接近”的程度,对于其他起始值它不作任何保证。在这些条件之外,牛顿法可能以多种方式失效(图 7.4):
水平切线。 若 f ′ ( x n ) = 0 , f'(x_n) = 0\mathclose{\text{,}} f ′ ( x n ) = 0 , 则切线水平且永不与 x x x 轴相交:没有下一个迭代点。对于 f ( x ) = x 2 − 2 , f(x) = x^2 - 2\mathclose{\text{,}} f ( x ) = x 2 − 2 , 这种情况发生在 x 0 = 0 。 x_0 = 0\mathclose{\text{。}} x 0 = 0 。 若 f ′ ( x n ) f'(x_n) f ′ ( x n ) 仅仅是小量,下一个迭代点会远离很远:从 x 0 = 0.1 , x_0 = 0.1\mathclose{\text{,}} x 0 = 0.1 , 到 x 1 = 10.05 。 x_1 = 10.05\mathclose{\text{。}} x 1 = 10.05 。
循环。 对于 f ( x ) = x 3 − 2 x + 2 f(x) = x^3 - 2x + 2 f ( x ) = x 3 − 2 x + 2 来自 x 0 = 0 : x_0 = 0\mathclose{\text{:}} x 0 = 0 : f ( 0 ) = 2 f(0) = 2 f ( 0 ) = 2 和 f ′ ( 0 ) = − 2 , f'(0) = -2\mathclose{\text{,}} f ′ ( 0 ) = − 2 , 因此 x 1 = 0 − 2 / ( − 2 ) = 1 ; x_1 = 0 - 2/(-2) = 1\mathclose{\text{;}} x 1 = 0 − 2/ ( − 2 ) = 1 ; 然后 f ( 1 ) = 1 f(1) = 1 f ( 1 ) = 1 和 f ′ ( 1 ) = 1 , f'(1) = 1\mathclose{\text{,}} f ′ ( 1 ) = 1 , 因此 x 2 = 1 − 1 = 0 。 x_2 = 1 - 1 = 0\mathclose{\text{。}} x 2 = 1 − 1 = 0 。 迭代值在 0 和 1 之间无限交替,而唯一的实根则接近 − 1.769 。 -1.769\mathclose{\text{。}} − 1.769 。
逃离。 迭代值不断远离根(例 7.11)。
离开定义域。 对于 f ( x ) = ln x f(x) = \ln x f ( x ) = ln x 来自 x 0 = 3 , x_0 = 3\mathclose{\text{,}} x 0 = 3 , x 1 = 3 − 3 ln 3 ≈ − 0.296 , x_1 = 3 - 3\ln 3 \approx -0.296\mathclose{\text{,}} x 1 = 3 − 3 ln 3 ≈ − 0.296 , 其中 ln \ln ln 未定义。
收敛缓慢。 在一个根处,即使 f ′ ( r ) = 0 f'(r) = 0 f ′ ( r ) = 0 也如此,例如 ( x − 1 ) 2 (x - 1)^2 ( x − 1 ) 2 的二重根 1,步长为 x n + 1 = x n − 1 2 ( x n − 1 ) : x_{n+1} = x_n - \tfrac12(x_n - 1)\mathclose{\text{:}} x n + 1 = x n − 2 1 ( x n − 1 ) : 每次迭代的误差仅减半,不如二分法好。
例 7.11牛顿法无法找到的根 ✓ 已检验
证明:对于 f ( x ) = x 3 , f(x) = \sqrt[3]{x}\mathclose{\text{,}} f ( x ) = 3 x , 从任意起始值 x 0 ≠ 0 x_0 \ne 0 x 0 = 0 出发,牛顿法会远离根 0。
对于 x ≠ 0 , x \ne 0\mathclose{\text{,}} x = 0 , f ′ ( x ) = 1 3 x 3 2 : f'(x) = \dfrac{1}{3\sqrt[3]{x}^{\,2}}\mathclose{\text{:}} f ′ ( x ) = 3 3 x 2 1 : x 3 \sqrt[3]{x} 3 x 是 x 3 x^3 x 3 的反函数,且反函数的导数(第6模块)在 u = x 3 u = \sqrt[3]{x} u = 3 x 处为 1 / ( 3 u 2 ) 。 1/\big(3u^2\big)\mathclose{\text{。}} 1/ ( 3 u 2 ) 。 因此,设 u = x n 3 , u = \sqrt[3]{x_n}\mathclose{\text{,}} u = 3 x n , 使得 x n = u 3 , x_n = u^3\mathclose{\text{,}} x n = u 3 ,
x n + 1 = x n − u 1 / ( 3 u 2 ) = x n − 3 u 3 = x n − 3 x n = − 2 x n . \begin{aligned} x_{n+1} &= x_n - \frac{u}{1/(3u^2)} = x_n - 3u^3 \\ &= x_n - 3x_n = -2x_n. \end{aligned} x n + 1 = x n − 1/ ( 3 u 2 ) u = x n − 3 u 3 = x n − 3 x n = − 2 x n .
每一步都将距离根的距离加倍,并切换到另一侧:从 x 0 = 1 x_0 = 1 x 0 = 1 出发的迭代点为 − 2 , 4 , − 8 , 16 , … -2, 4, -8, 16, \dots − 2 , 4 , − 8 , 16 , … (图 7.4,右图)。定理 7.3 不适用,因为 f ′ ( 0 ) f'(0) f ′ ( 0 ) 不存在:图像在根处有垂直切线。在图像上的任意其他点 ( u 3 , u ) , (u^3, u)\mathclose{\text{,}} ( u 3 , u ) , 切线的斜率为 1 / ( 3 u 2 ) , 1/(3u^2)\mathclose{\text{,}} 1/ ( 3 u 2 ) , 是该点到根连线斜率 u / u 3 = 1 / u 2 u/u^3 = 1/u^2 u / u 3 = 1/ u 2 的三分之一。因此,每条切线与坐标轴的交点距离 x n x_n x n 的距离是根到该点距离的三倍:在 − 2 x n -2x_n − 2 x n 处,位于根的另一侧。
图 7.4 牛顿法的两个失败情况。左图:从 x 0 = 0 x_0 = 0 x 0 = 0 出发的 f ( x ) = x 3 − 2 x + 2 , f(x) = x^3 - 2x + 2\mathclose{\text{,}} f ( x ) = x 3 − 2 x + 2 , 在 x 0 x_0 x 0 处的切线导致到达 x 1 = 1 , x_1 = 1\mathclose{\text{,}} x 1 = 1 , 在 x 1 x_1 x 1 处的切线又回到 0;唯一的根(绿色,近 − 1.769 ) -1.769\mathclose{\text{)}} − 1.769 ) 从未被到达。右图:从 x 0 = 1 x_0 = 1 x 0 = 1 出发的 f ( x ) = x 3 , f(x) = \sqrt[3]{x}\mathclose{\text{,}} f ( x ) = 3 x , 每条切线都会超过根 0(绿色),并落在另一侧距离为根两倍的位置。
提示
实际操作:从根附近开始(一个图像、一个值表或几次二分法步骤可以告诉你它在哪里),观察 ∣ f ( x n ) ∣ \abs{f(x_n)} ∣ f ( x n ) ∣ 和步骤 ∣ x n + 1 − x n ∣ \abs{x_{n+1} - x_n} ∣ x n + 1 − x n ∣ 缩小,并在固定步骤数后放弃。好的方程求解器结合了二分法的安全性和牛顿法的速度。
模块 2 评估形如 0 / 0 0/0 0/0 的极限,通过代数方法:因式分解并约分、有理化或夹逼定理。许多这样的极限无法通过代数方法解决。什么是
lim x → 0 e 2 x − 1 sin 3 x ? \lim_{x\to0}\frac{e^{2x} - 1}{\sin 3x}? x → 0 lim sin 3 x e 2 x − 1 ?
分子和分母都趋于 0,且没有可以约分的内容。数值提示 2 / 3 : 2/3\mathclose{\text{:}} 2/3 :
x x x e 2 x − 1 e^{2x} - 1 e 2 x − 1 sin 3 x \sin 3x sin 3 x e 2 x − 1 sin 3 x \dfrac{e^{2x} - 1}{\sin 3x} sin 3 x e 2 x − 1 0.1 0.1 0.1 0.221403 0.221403 0.221403 0.295520 0.295520 0.295520 0.749197 0.749197 0.749197 0.01 0.01 0.01 0.0202013 0.0202013 0.0202013 0.0299955 0.0299955 0.0299955 0.673479 0.673479 0.673479 0.001 0.001 0.001 0.00200200 0.00200200 0.00200200 0.00300000 0.00300000 0.00300000 0.667335 0.667335 0.667335 − 0.001 -0.001 − 0.001 − 0.00199800 -0.00199800 − 0.00199800 − 0.00300000 -0.00300000 − 0.00300000 0.666001 0.666001 0.666001 − 0.01 -0.01 − 0.01 − 0.0198013 -0.0198013 − 0.0198013 − 0.0299955 -0.0299955 − 0.0299955 0.660143 0.660143 0.660143 − 0.1 -0.1 − 0.1 − 0.181269 -0.181269 − 0.181269 − 0.295520 -0.295520 − 0.295520 0.613390 0.613390 0.613390
图 7.5 解释了这一点。在接近 0 处,每个函数都接近其在该点的切线: e 2 x − 1 ≈ 2 x , e^{2x} - 1 \approx 2x\mathclose{\text{,}} e 2 x − 1 ≈ 2 x , 因为其在 0 处的导数为 2, sin 3 x ≈ 3 x , \sin 3x \approx 3x\mathclose{\text{,}} sin 3 x ≈ 3 x , 因为其在 0 处的导数为 3。因此,比值接近 2 x / 3 x = 2 / 3 : 2x/3x = 2/3\mathclose{\text{:}} 2 x /3 x = 2/3 : 切线斜率的比值。
图 7.5 左: e 2 x − 1 e^{2x} - 1 e 2 x − 1 和 sin 3 x \sin 3x sin 3 x 都通过原点,接近它们的切线 y = 2 x y = 2x y = 2 x 和 y = 3 x y = 3x y = 3 x (虚线)。右:它们的比值在 0 处未定义(空心点),趋近于 2 / 3 , 2/3\mathclose{\text{,}} 2/3 , 即切线斜率的比值。
定义 7.5
不定式 0 / 0 0/0 0/0 和 ∞ / ∞ \infty/\infty ∞/∞
若f ( x ) → 0 f(x) \to 0 f ( x ) → 0 与g ( x ) → 0 g(x) \to 0 g ( x ) → 0 如x → a x \to a x → a 所示,则f ( x ) / g ( x ) f(x)/g(x) f ( x ) / g ( x ) 的极限具有不定形式 0 / 0 。 0/0\mathclose{\text{。}} 0/0 。 若f ( x ) → ± ∞ f(x) \to \pm\infty f ( x ) → ± ∞ 与g ( x ) → ± ∞ , g(x) \to \pm\infty\mathclose{\text{,}} g ( x ) → ± ∞ , 则其具有不定形式∞ / ∞ 。 \infty/\infty\mathclose{\text{。}} ∞/∞ 。 此处a a a 可为某数、∞ \infty ∞ 或− ∞ , -\infty\mathclose{\text{,}} − ∞ , 且极限可为单侧极限。
“不定式”意味着仅凭形式无法决定极限。当 x → 0 、 x \to 0\mathclose{\text{、}} x → 0 、 x / x → 1 、 x/x \to 1\mathclose{\text{、}} x / x → 1 、 x 2 / x → 0 x^2/x \to 0 x 2 / x → 0 和 x / x 3 → ∞ x/x^3 \to \infty x / x 3 → ∞ 都属于 0 / 0 0/0 0/0 形式时,你必须更仔细地考察 f f f 和 g 。 g\mathclose{\text{。}} g 。
规则
定理 7.4洛必达法则,简单形式
设 f f f 和 g g g 在包含 a a a 的开区间内有定义,且 f ( a ) = g ( a ) = 0 。 f(a) = g(a) = 0\mathclose{\text{。}} f ( a ) = g ( a ) = 0 。 若 f ′ ( a ) f'(a) f ′ ( a ) 和 g ′ ( a ) g'(a) g ′ ( a ) 存在且 g ′ ( a ) ≠ 0 , g'(a) \ne 0\mathclose{\text{,}} g ′ ( a ) = 0 , 则
lim x → a f ( x ) g ( x ) = f ′ ( a ) g ′ ( a ) . \lim_{x\to a}\frac{f(x)}{g(x)} = \frac{f'(a)}{g'(a)}. x → a lim g ( x ) f ( x ) = g ′ ( a ) f ′ ( a ) .
证明
对于 x ≠ a x \ne a x = a 在区间内,减去 f ( a ) = 0 f(a) = 0 f ( a ) = 0 和 g ( a ) = 0 , g(a) = 0\mathclose{\text{,}} g ( a ) = 0 , 然后将分子和分母都除以 x − a ≠ 0 : x - a \ne 0\mathclose{\text{:}} x − a = 0 :
f ( x ) g ( x ) = f ( x ) − f ( a ) g ( x ) − g ( a ) = f ( x ) − f ( a ) x − a g ( x ) − g ( a ) x − a . \frac{f(x)}{g(x)} = \frac{f(x) - f(a)}{g(x) - g(a)} = \frac{\dfrac{f(x) - f(a)}{x - a}}{\dfrac{g(x) - g(a)}{x - a}}. g ( x ) f ( x ) = g ( x ) − g ( a ) f ( x ) − f ( a ) = x − a g ( x ) − g ( a ) x − a f ( x ) − f ( a ) .
作为 x → a , x \to a\mathclose{\text{,}} x → a , 分子趋于 f ′ ( a ) , f'(a)\mathclose{\text{,}} f ′ ( a ) , 分母趋于 g ′ ( a ) , g'(a)\mathclose{\text{,}} g ′ ( a ) , 根据导数的定义(模块 4)。由于 g ′ ( a ) ≠ 0 , g'(a) \ne 0\mathclose{\text{,}} g ′ ( a ) = 0 , 根据极限的商法则(模块 2)可得极限 f ′ ( a ) / g ′ ( a ) 。 f'(a)/g'(a)\mathclose{\text{。}} f ′ ( a ) / g ′ ( a ) 。
还有一个细节:f ( x ) / g ( x ) f(x)/g(x) f ( x ) / g ( x ) 必须在a a a 附近的x x x 处有定义,即g ( x ) ≠ 0 。 g(x) \ne 0\mathclose{\text{。}} g ( x ) = 0 。 g g g 的差商趋近于g ′ ( a ) ≠ 0 , g'(a) \ne 0\mathclose{\text{,}} g ′ ( a ) = 0 , 因此对于足够接近a a a 的x , x\mathclose{\text{,}} x , 它落在g ′ ( a ) g'(a) g ′ ( a ) 的∣ g ′ ( a ) ∣ / 2 \abs{g'(a)}/2 ∣ g ′ ( a ) ∣ /2 范围内且不为0;于是g ( x ) = ( x − a ) ⋅ g ( x ) − g ( a ) x − a ≠ 0 g(x) = (x - a) \cdot \dfrac{g(x) - g(a)}{x - a} \ne 0 g ( x ) = ( x − a ) ⋅ x − a g ( x ) − g ( a ) = 0 对相应的x ≠ a x \ne a x = a 成立。
∎
例 7.12斜率的比值 ✓ 已检验
求 lim x → 0 e 2 x − 1 sin 3 x 。 \displaystyle\lim_{x\to0}\frac{e^{2x} - 1}{\sin 3x}\mathclose{\text{。}} x → 0 lim sin 3 x e 2 x − 1 。
设 f ( x ) = e 2 x − 1 f(x) = e^{2x} - 1 f ( x ) = e 2 x − 1 和 g ( x ) = sin 3 x 。 g(x) = \sin 3x\mathclose{\text{。}} g ( x ) = sin 3 x 。 两者在所有点均可导,且 f ( 0 ) = e 0 − 1 = 0 f(0) = e^0 - 1 = 0 f ( 0 ) = e 0 − 1 = 0 和 g ( 0 ) = sin 0 = 0 。 g(0) = \sin 0 = 0\mathclose{\text{。}} g ( 0 ) = sin 0 = 0 。 根据链式法则 f ′ ( x ) = 2 e 2 x f'(x) = 2e^{2x} f ′ ( x ) = 2 e 2 x 和 g ′ ( x ) = 3 cos 3 x , g'(x) = 3\cos 3x\mathclose{\text{,}} g ′ ( x ) = 3 cos 3 x , 因此 f ′ ( 0 ) = 2 f'(0) = 2 f ′ ( 0 ) = 2 和 g ′ ( 0 ) = 3 ≠ 0 。 g'(0) = 3 \ne 0\mathclose{\text{。}} g ′ ( 0 ) = 3 = 0 。 根据定理 7.4,
lim x → 0 e 2 x − 1 sin 3 x = f ′ ( 0 ) g ′ ( 0 ) = 2 3 , \lim_{x\to0}\frac{e^{2x} - 1}{\sin 3x} = \frac{f'(0)}{g'(0)} = \frac{2}{3}, x → 0 lim sin 3 x e 2 x − 1 = g ′ ( 0 ) f ′ ( 0 ) = 3 2 ,
如表格和图 7.5 所示。
简单形式需要 f ( a ) = g ( a ) = 0 f(a) = g(a) = 0 f ( a ) = g ( a ) = 0 和 g ′ ( a ) ≠ 0 , g'(a) \ne 0\mathclose{\text{,}} g ′ ( a ) = 0 , 并且通常其中一个会失败: f f f 和 g g g 可能在 a a a 处未定义, a a a 可能为 ∞ , \infty\mathclose{\text{,}} ∞ , 或者 g ′ ( a ) g'(a) g ′ ( a ) 也可能为 0。一般规则比较 f / g f/g f / g 的极限与 f ′ / g ′ f'/g' f ′ / g ′ 的极限,而不是与 a a a 处的值。
定理 7.5洛必达法则
设 f 、 f\mathclose{\text{、}} f 、 g g g 在含 a a a 的开区间 I I I 上可微,唯独 a a a 本身可例外。对 I I I 内的每个 x ≠ a , x \ne a\mathclose{\text{,}} x = a , 都有 g ′ ( x ) ≠ 0 。 g'(x) \ne 0\mathclose{\text{。}} g ′ ( x ) = 0 。 设当 x → a x \to a x → a 时,f ( x ) / g ( x ) f(x)/g(x) f ( x ) / g ( x ) 的极限为 0 / 0 0/0 0/0 或 ∞ / ∞ \infty/\infty ∞/∞ 未定式。若
lim x → a f ′ ( x ) g ′ ( x ) = L , \lim_{x\to a}\frac{f'(x)}{g'(x)} = L, x → a lim g ′ ( x ) f ′ ( x ) = L ,
其中 L L L 是一个实数, ∞ \infty ∞ 或 − ∞ , -\infty\mathclose{\text{,}} − ∞ , 则
lim x → a f ( x ) g ( x ) = L . \lim_{x\to a}\frac{f(x)}{g(x)} = L. x → a lim g ( x ) f ( x ) = L .
对于单侧极限也成立,其中 I I I 是一个以 a a a 为端点的开区间,对于 x → ∞ x \to \infty x → ∞ 或 x → − ∞ , x \to -\infty\mathclose{\text{,}} x → − ∞ , 以 I I I 为区间 ( b , ∞ ) (b, \infty) ( b , ∞ ) 或 ( − ∞ , b ) 。 (-\infty, b)\mathclose{\text{。}} ( − ∞ , b ) 。
模块 8 在一个“深入理解”框中使用柯西中值定理证明了这个一般形式;该证明需要用到你目前尚未掌握的工具。每个假设都是必需的。形式必须是不定式(下面的第一个陷阱); g ′ g' g ′ 在 a a a 附近不能为 0,以确保 f ′ / g ′ f'/g' f ′ / g ′ 在那里有定义;并且 f ′ / g ′ f'/g' f ′ / g ′ 的极限必须存在:如果不存在,规则则无能为力(第三个陷阱)。
例 7.13使用规则两次 ✓ 已检验
求 lim x → 0 e x − 1 − x x 2 。 \displaystyle\lim_{x\to0}\frac{e^x - 1 - x}{x^2}\mathclose{\text{。}} x → 0 lim x 2 e x − 1 − x 。
在x = 0 x = 0 x = 0 处分子为1 − 1 − 0 = 0 1 - 1 - 0 = 0 1 − 1 − 0 = 0 且分母为0:形式为0 / 0 。 0/0\mathclose{\text{。}} 0/0 。 由于x 2 x^2 x 2 的导数2 x 2x 2 x 在0处为0,简单形式不适用。定理7.5适用(在0附近,2 x ≠ 0 2x \ne 0 2 x = 0 在0处除外)并指出极限等于
lim x → 0 e x − 1 2 x , \lim_{x\to0}\frac{e^x - 1}{2x}, x → 0 lim 2 x e x − 1 ,
如果这个极限存在。它又具有形式 0 / 0 , 0/0\mathclose{\text{,}} 0/0 , 现在简单形式适用: f 1 ( x ) = e x − 1 f_1(x) = e^x - 1 f 1 ( x ) = e x − 1 和 g 1 ( x ) = 2 x g_1(x) = 2x g 1 ( x ) = 2 x 都有 f 1 ( 0 ) = g 1 ( 0 ) = 0 , f_1(0) = g_1(0) = 0\mathclose{\text{,}} f 1 ( 0 ) = g 1 ( 0 ) = 0 , f 1 ′ ( 0 ) = e 0 = 1 f_1'(0) = e^0 = 1 f 1 ′ ( 0 ) = e 0 = 1 和 g 1 ′ ( 0 ) = 2 ≠ 0 , g_1'(0) = 2 \ne 0\mathclose{\text{,}} g 1 ′ ( 0 ) = 2 = 0 , 因此这个极限是 1 2 。 \tfrac12\mathclose{\text{。}} 2 1 。 因此
lim x → 0 e x − 1 − x x 2 = 1 2 . \lim_{x\to0}\frac{e^x - 1 - x}{x^2} = \frac12. x → 0 lim x 2 e x − 1 − x = 2 1 .
答案提到 e x : e^x\mathclose{\text{:}} e x : 在 0 附近, e x − 1 − x ≈ 1 2 x 2 , e^x - 1 - x \approx \tfrac12 x^2\mathclose{\text{,}} e x − 1 − x ≈ 2 1 x 2 , 即 e x ≈ 1 + x + 1 2 x 2 , e^x \approx 1 + x + \tfrac12 x^2\mathclose{\text{,}} e x ≈ 1 + x + 2 1 x 2 , 比线性近似 1 + x 1 + x 1 + x 更好。模块 15 进一步发展了这一想法。
例 7.14无穷远处的极限 ✓ 已检验
在机器学习中,Softplus 函数 s ( x ) = ln ( 1 + e x ) s(x) = \ln(1 + e^x) s ( x ) = ln ( 1 + e x ) 是第 1.3 节 所述函数 ReLU ( x ) = max ( 0 , x ) \operatorname{ReLU}(x) = \max(0, x) ReLU ( x ) = max ( 0 , x ) 的光滑版本。证明当 x → ∞ x \to \infty x → ∞ 时,s ( x ) / x → 1 。 s(x)/x \to 1\mathclose{\text{。}} s ( x ) / x → 1 。
当 x → ∞ , x \to \infty\mathclose{\text{,}} x → ∞ , ln ( 1 + e x ) → ∞ \ln(1 + e^x) \to \infty ln ( 1 + e x ) → ∞ 和 x → ∞ : x \to \infty\mathclose{\text{:}} x → ∞ : 形式为 ∞ / ∞ 。 \infty/\infty\mathclose{\text{。}} ∞/∞ 。 导数为 e x 1 + e x \dfrac{e^x}{1 + e^x} 1 + e x e x (链式法则)和 1,永远不会为 0,将分子和分母同时除以 e x , e^x\mathclose{\text{,}} e x ,
lim x → ∞ e x / ( 1 + e x ) 1 = lim x → ∞ 1 e − x + 1 = 1 0 + 1 = 1. \begin{aligned} \lim_{x\to\infty}\frac{e^x/(1 + e^x)}{1} &= \lim_{x\to\infty}\frac{1}{e^{-x} + 1} \\ &= \frac{1}{0 + 1} = 1. \end{aligned} x → ∞ lim 1 e x / ( 1 + e x ) = x → ∞ lim e − x + 1 1 = 0 + 1 1 = 1.
根据定理 7.5, s ( x ) / x → 1 : s(x)/x \to 1\mathclose{\text{:}} s ( x ) / x → 1 : 对于足够大的 x , x\mathclose{\text{,}} x , softplus 的行为类似于 ReLU,即在该处等于 x 。 x\mathclose{\text{。}} x 。
正确使用规则
注意
先检查形式。 洛必达法则仅适用于 0 / 0 0/0 0/0 和 ∞ / ∞ 。 \infty/\infty\mathclose{\text{。}} ∞/∞ 。 取 lim x → 0 1 − cos x x + x 2 。 \displaystyle\lim_{x\to0}\frac{1 - \cos x}{x + x^2}\mathclose{\text{。}} x → 0 lim x + x 2 1 − cos x 。 它具有形式 0 / 0 , 0/0\mathclose{\text{,}} 0/0 , 法则给出 lim x → 0 sin x 1 + 2 x = 0 1 = 0 , \displaystyle\lim_{x\to0}\frac{\sin x}{1 + 2x} = \frac{0}{1} = 0\mathclose{\text{,}} x → 0 lim 1 + 2 x sin x = 1 0 = 0 , 即正确答案。再次应用法则到 sin x 1 + 2 x , \dfrac{\sin x}{1 + 2x}\mathclose{\text{,}} 1 + 2 x sin x , 它不是不定式,得到 cos x 2 → 1 2 : \dfrac{\cos x}{2} \to \dfrac12\mathclose{\text{:}} 2 cos x → 2 1 : 错误。在每一步,先代入,只有当结果为 0 / 0 0/0 0/0 或 ∞ / ∞ \infty/\infty ∞/∞ 时才进行求导。
注意
分别对分子和分母求导。 法则使用 f ′ ( x ) g ′ ( x ) , \dfrac{f'(x)}{g'(x)}\mathclose{\text{,}} g ′ ( x ) f ′ ( x ) , 即两个导数的商,而不是 ( f g ) ′ ( x ) , \Big(\dfrac{f}{g}\Big)'(x)\mathclose{\text{,}} ( g f ) ′ ( x ) , 即商的导数。在这里使用模块 5 的商法则是一种常见错误,它给出一个通常与原式不同的表达式和极限。
注意
其逆命题不成立。 如果 f ′ / g ′ f'/g' f ′ / g ′ 没有极限,法则对 f / g f/g f / g 什么也不说。例如 x → ∞ , x \to \infty\mathclose{\text{,}} x → ∞ , x + sin x x = 1 + sin x x → 1 \dfrac{x + \sin x}{x} = 1 + \dfrac{\sin x}{x} \to 1 x x + sin x = 1 + x sin x → 1 (根据夹逼定理,因为 ∣ sin x / x ∣ ≤ 1 / x ), \abs{\sin x/x} \le 1/x\mathclose{\text{),}} ∣ sin x / x ∣ ≤ 1/ x ), 但导数的商 1 + cos x 1 \dfrac{1 + \cos x}{1} 1 1 + cos x 在 0 和 2 之间来回摆动,没有极限。
须知
洛必达法则可在一行中给出 lim θ → 0 sin θ θ = cos 0 1 = 1 , \displaystyle\lim_{\theta\to0}\frac{\sin\theta}{\theta} = \frac{\cos 0}{1} = 1\mathclose{\text{,}} θ → 0 lim θ sin θ = 1 cos 0 = 1 , 但作为证明则会陷入循环:该法则所使用的导数 sin , \sin\mathclose{\text{,}} sin , 正是由这个极限得出的(模块 2 和 5)。该法则是一种用于求极限的工具,其构成元素你已经可以求导。
乘积、差和幂也有不定式形式。例如 x → ∞ 、 x \to \infty\mathclose{\text{、}} x → ∞ 、 1 / x → 0 1/x \to 0 1/ x → 0 和 x → ∞ , x \to \infty\mathclose{\text{,}} x → ∞ , 然而
1 x ⋅ x → 1 , 1 x 2 ⋅ x → 0 , 1 x ⋅ x 2 → ∞ . \frac{1}{x}\cdot x \to 1, \quad \frac{1}{x^2}\cdot x \to 0, \quad \frac{1}{x}\cdot x^2 \to \infty. x 1 ⋅ x → 1 , x 2 1 ⋅ x → 0 , x 1 ⋅ x 2 → ∞.
形如0 ⋅ ∞ 0\cdot\infty 0 ⋅ ∞ 的乘积可以趋近于任意值。形如∞ − ∞ \infty - \infty ∞ − ∞ 的差以及形如1 ∞ 、 1^\infty\mathclose{\text{、}} 1 ∞ 、 0 0 0^0 0 0 和∞ 0 \infty^0 ∞ 0 的幂也具有相同性质;这些也是不定式 。对每种情况的策略是将表达式重写为形如0 / 0 0/0 0/0 或∞ / ∞ \infty/\infty ∞/∞ 的商,并使用洛必达法则。
乘积与差
0 ⋅ ∞ 0\cdot\infty 0 ⋅ ∞ 型的乘积 f g fg f g 可通过除以某个因子的倒数写成商:f g = f 1 / g fg = \dfrac{f}{1/g} f g = 1/ g f 属于 0 / 0 0/0 0/0 型,或者写成属于 ∞ / ∞ \infty/\infty ∞/∞ 型的 f g = g 1 / f 。 fg = \dfrac{g}{1/f}\mathclose{\text{。}} f g = 1/ f g 。 选择其中求导较简单的写法。
例 7.15
x ln x x\ln x x ln x 在 0 附近✓ 已检验
求 lim x → 0 + x ln x 。 \displaystyle\lim_{x\to0^+} x\ln x\mathclose{\text{。}} x → 0 + lim x ln x 。
如 x → 0 + 、 x \to 0^+\mathclose{\text{、}} x → 0 + 、 x → 0 x \to 0 x → 0 和 ln x → − ∞ : \ln x \to -\infty\mathclose{\text{:}} ln x → − ∞ : 形式为 0 ⋅ ∞ 。 0\cdot\infty\mathclose{\text{。}} 0 ⋅ ∞ 。 将乘积写为 ln x 1 / x , \dfrac{\ln x}{1/x}\mathclose{\text{,}} 1/ x ln x , 形式为 ∞ / ∞ \infty/\infty ∞/∞ (分子趋于 − ∞ , -\infty\mathclose{\text{,}} − ∞ , 分母趋于 ∞ )。 \infty\mathclose{\text{)。}} ∞ )。 导数的商为
1 / x − 1 / x 2 = − x → 0 , \frac{1/x}{-1/x^2} = -x \;\to\; 0, − 1/ x 2 1/ x = − x → 0 ,
且 − 1 / x 2 ≠ 0 , -1/x^2 \ne 0\mathclose{\text{,}} − 1/ x 2 = 0 , 因此根据定理 7.5
lim x → 0 + x ln x = 0. \lim_{x\to0^+} x\ln x = 0. x → 0 + lim x ln x = 0.
因子 x x x 比 ln x \ln x ln x 更占主导地位。另一种选择 x 1 / ln x \dfrac{x}{1/\ln x} 1/ ln x x 会导致 1 − 1 / ( x ( ln x ) 2 ) = − x ( ln x ) 2 , \dfrac{1}{-1/\big(x(\ln x)^2\big)} = -x(\ln x)^2\mathclose{\text{,}} − 1/ ( x ( ln x ) 2 ) 1 = − x ( ln x ) 2 , 这比你开始的地方更糟糕。
一个形如 的差∞ − ∞ \infty - \infty ∞ − ∞ 在通分后通常变为商;有时因式分解或有理化可以做到。
例 7.16
形如 ∞ − ∞ \infty - \infty ∞ − ∞ 的差 ✓ 已检验
求 lim x → 1 ( x x − 1 − 1 ln x ) 。 \displaystyle\lim_{x\to1}\Big(\frac{x}{x - 1} - \frac{1}{\ln x}\Big)\mathclose{\text{。}} x → 1 lim ( x − 1 x − ln x 1 ) 。
当 x → 1 + x \to 1^+ x → 1 + 时,两项都趋于 ∞ , \infty\mathclose{\text{,}} ∞ , 当 x → 1 − x \to 1^- x → 1 − 时,两项都趋于 − ∞ 。 -\infty\mathclose{\text{。}} − ∞ 。 在通分后的公共分母 ( x − 1 ) ln x (x - 1)\ln x ( x − 1 ) ln x 上,
x x − 1 − 1 ln x = x ln x − ( x − 1 ) ( x − 1 ) ln x , \frac{x}{x - 1} - \frac{1}{\ln x} = \frac{x\ln x - (x - 1)}{(x - 1)\ln x}, x − 1 x − ln x 1 = ( x − 1 ) ln x x ln x − ( x − 1 ) ,
的形式为 0 / 0 0/0 0/0 在 x = 1 。 x = 1\mathclose{\text{。}} x = 1 。 对分子和分母分别求导,每个都使用乘积法则:
ln x + 1 − 1 ln x + ( x − 1 ) / x = ln x ln x + 1 − 1 / x . \frac{\ln x + 1 - 1}{\ln x + (x - 1)/x} = \frac{\ln x}{\ln x + 1 - 1/x}. ln x + ( x − 1 ) / x ln x + 1 − 1 = ln x + 1 − 1/ x ln x .
定理 7.5 需要下底的导数在 1 附近(除 1 外)不为零,且它满足:对于 x > 1 、 x > 1\mathclose{\text{、}} x > 1 、 ln x \ln x ln x 和 1 − 1 / x 1 - 1/x 1 − 1/ x 均为正数,对于 0 < x < 1 0 < x < 1 0 < x < 1 均为负数。新的商式仍是 0 / 0 , 0/0\mathclose{\text{,}} 0/0 , 现在使用简单形式 f ( x ) = ln x f(x) = \ln x f ( x ) = ln x 和 g ( x ) = ln x + 1 − 1 / x : g(x) = \ln x + 1 - 1/x\mathclose{\text{:}} g ( x ) = ln x + 1 − 1/ x : 即 f ′ ( 1 ) = 1 , f'(1) = 1\mathclose{\text{,}} f ′ ( 1 ) = 1 , 由于 g ′ ( x ) = 1 / x + 1 / x 2 , g'(x) = 1/x + 1/x^2\mathclose{\text{,}} g ′ ( x ) = 1/ x + 1/ x 2 , 所以 g ′ ( 1 ) = 2 。 g'(1) = 2\mathclose{\text{。}} g ′ ( 1 ) = 2 。 因此,根据定理 7.4 和 7.5,
lim x → 1 ( x x − 1 − 1 ln x ) = 1 2 . \lim_{x\to1}\Big(\frac{x}{x - 1} - \frac{1}{\ln x}\Big) = \frac12. x → 1 lim ( x − 1 x − ln x 1 ) = 2 1 .
幂函数
形式 1 ∞ 、 1^\infty\mathclose{\text{、}} 1 ∞ 、 0 0 0^0 0 0 和 ∞ 0 \infty^0 ∞ 0 出现在 f ( x ) g ( x ) f(x)^{g(x)} f ( x ) g ( x ) 的极限中,与 f ( x ) > 0 f(x) > 0 f ( x ) > 0 相关。取对数:若 y = f ( x ) g ( x ) , y = f(x)^{g(x)}\mathclose{\text{,}} y = f ( x ) g ( x ) , 则
ln y = g ( x ) ln f ( x ) , \ln y = g(x)\ln f(x), ln y = g ( x ) ln f ( x ) ,
其形式在所有三种情况下均为 0 ⋅ ∞ 。 0\cdot\infty\mathclose{\text{。}} 0 ⋅ ∞ 。 求 L L L 的极限 ln y ; \ln y\mathclose{\text{;}} ln y ; 然后,由于 e x e^x e x 是连续的(模块 3),所以 y = e ln y y = e^{\ln y} y = e l n y 趋近于 e L 。 e^L\mathclose{\text{。}} e L 。
证明对于每个实数 a , a\mathclose{\text{,}} a , 均有 lim x → ∞ ( 1 + a x ) x = e a , \displaystyle\lim_{x\to\infty}\Big(1 + \frac{a}{x}\Big)^x = e^a\mathclose{\text{,}} x → ∞ lim ( 1 + x a ) x = e a , 从而推导出 ( 1 + 1 n ) n → e \Big(1 + \dfrac1n\Big)^n \to e ( 1 + n 1 ) n → e 当 n → ∞ n \to \infty n → ∞ 时。
对于 a = 0 a = 0 a = 0 每个值都是 1 x = 1 = e 0 。 1^x = 1 = e^0\mathclose{\text{。}} 1 x = 1 = e 0 。 对于 a ≠ 0 , a \ne 0\mathclose{\text{,}} a = 0 , 形式是 1 ∞ 。 1^\infty\mathclose{\text{。}} 1 ∞ 。 令 y = ( 1 + a / x ) x , y = (1 + a/x)^x\mathclose{\text{,}} y = ( 1 + a / x ) x , 对于 x > ∣ a ∣ , x > \abs{a}\mathclose{\text{,}} x > ∣ a ∣ , 使得 1 + a / x > 0 。 1 + a/x > 0\mathclose{\text{。}} 1 + a / x > 0 。 然后
ln y = x ln ( 1 + a x ) = ln ( 1 + a / x ) 1 / x , \ln y = x\ln\Big(1 + \frac{a}{x}\Big) = \frac{\ln(1 + a/x)}{1/x}, ln y = x ln ( 1 + x a ) = 1/ x ln ( 1 + a / x ) ,
形式为 0 / 0 。 0/0\mathclose{\text{。}} 0/0 。 顶部和底部在 x > ∣ a ∣ x > \abs{a} x > ∣ a ∣ 处可导,且底部的导数 − 1 / x 2 -1/x^2 − 1/ x 2 永远不为 0。对顶部(链式法则)和底部求导:
1 1 + a / x ⋅ ( − a x 2 ) − 1 x 2 = a 1 + a / x → a . \frac{\dfrac{1}{1 + a/x}\cdot\Big(-\dfrac{a}{x^2}\Big)}{-\dfrac{1}{x^2}} = \frac{a}{1 + a/x} \;\to\; a. − x 2 1 1 + a / x 1 ⋅ ( − x 2 a ) = 1 + a / x a → a .
所以 ln y → a \ln y \to a ln y → a 根据定理 7.5,且 y → e a 。 y \to e^a\mathclose{\text{。}} y → e a 。 以 a = 1 , a = 1\mathclose{\text{,}} a = 1 , ( 1 + 1 / x ) x → e (1 + 1/x)^x \to e ( 1 + 1/ x ) x → e 作为 x → ∞ , x \to \infty\mathclose{\text{,}} x → ∞ , 因此当 x x x 遍历所有整数 n = 1 , 2 , 3 , … n = 1, 2, 3, \dots n = 1 , 2 , 3 , … 时也是如此。
这是模块 6 的复利,其 定理 6.6 证明了对于整数 n , n\mathclose{\text{,}} n , 从 ln \ln ln 在 1 处的导数得出的相同极限;洛必达法则给出了一个针对每个实数 x x x 的第二证明。年利率为 a , a\mathclose{\text{,}} a , 每年复利 n n n 次,一年后本金乘以 ( 1 + a / n ) n , (1 + a/n)^n\mathclose{\text{,}} ( 1 + a / n ) n , 当 n n n 增大时,趋近于 e a , e^a\mathclose{\text{,}} e a , 即连续复利的因子。
例 7.18
0 0 0^0 0 0 和 ∞ 0 \infty^0 ∞ 0 ✓ 已检验
求 lim x → 0 + x x \displaystyle\lim_{x\to0^+} x^x x → 0 + lim x x 和 lim x → ∞ x 1 / x 。 \displaystyle\lim_{x\to\infty} x^{1/x}\mathclose{\text{。}} x → ∞ lim x 1/ x 。
x x , x^x\mathclose{\text{,}} x x , 的形式为 0 0 。 0^0\mathclose{\text{。}} 0 0 。 ln ( x x ) = x ln x → 0 \ln\big(x^x\big) = x\ln x \to 0 ln ( x x ) = x ln x → 0 作为 x → 0 + , x \to 0^+\mathclose{\text{,}} x → 0 + , 根据例 7.15。因此 x x → e 0 = 1 。 x^x \to e^0 = 1\mathclose{\text{。}} x x → e 0 = 1 。
x 1 / x , x^{1/x}\mathclose{\text{,}} x 1/ x , of the form ∞ 0 . \infty^0\mathclose{\text{.}} ∞ 0 . ln ( x 1 / x ) = ln x x , \ln\big(x^{1/x}\big) = \dfrac{\ln x}{x}\mathclose{\text{,}} ln ( x 1/ x ) = x ln x , of the form ∞ / ∞ . \infty/\infty\mathclose{\text{.}} ∞/∞ . 导数的分母是 1,永远不是 0,导数的商是 1 / x 1 → 0 . \dfrac{1/x}{1} \to 0\mathclose{\text{.}} 1 1/ x → 0 . 所以,根据定理 7.5, ln ( x 1 / x ) → 0 , \ln\big(x^{1/x}\big) \to 0\mathclose{\text{,}} ln ( x 1/ x ) → 0 , 和 x 1 / x → e 0 = 1 ; x^{1/x} \to e^0 = 1\mathclose{\text{;}} x 1/ x → e 0 = 1 ; 例如, 1000 1 / 1000 ≈ 1.0069 . 1000^{1/1000} \approx 1.0069\mathclose{\text{.}} 100 0 1/1000 ≈ 1.0069 .
注意
未定式意味着未决定,不是“等于 1”。例如 7.17 中,形式 1 ∞ 1^\infty 1 ∞ 可以趋近于 e , e\mathclose{\text{,}} e , 或者任何正数 e a 。 e^a\mathclose{\text{。}} e a 。 形式 0 0 0^0 0 0 也不一定趋近于 1:对于 0 < x < 1 , 0 < x < 1\mathclose{\text{,}} 0 < x < 1 , x 1 / ln x = e ln x / ln x = e , x^{1/\ln x} = e^{\ln x/\ln x} = e\mathclose{\text{,}} x 1/ l n x = e l n x / l n x = e , 因此当 x → 0 + , x \to 0^+\mathclose{\text{,}} x → 0 + , 其中它具有形式 0 0 , 0^0\mathclose{\text{,}} 0 0 , 则趋近于 e 。 e\mathclose{\text{。}} e 。 请记住最后一步:当 ln y → L \ln y \to L ln y → L 时,答案是 e L , e^L\mathclose{\text{,}} e L , 而不是 L 。 L\mathclose{\text{。}} L 。
动手计算使用 SymPy 计算极限,以及浮点数中的未定式
SymPy 的 limit 评估了本节和最后一节的极限。它的第四个参数是方向:'+-' 表示双边极限,'+' 或 '-' 表示单边极限。若省略该参数,SymPy 默认从右侧取极限,这与 x → 0 x \to 0 x → 0 的含义不符。答案与示例一致:
Python 复制
import sympy as sp
x = sp.symbols ('x' )
print (sp.limit ((sp.exp (2 *x) - 1 )/sp.sin (3 *x), x, 0 , '+-' ))
print (sp.limit ((sp.exp (x) - 1 - x)/x**2 , x, 0 , '+-' ))
print (sp.limit (x*sp.log (x), x, 0 , '+' ))
print (sp.limit (x/(x - 1 ) - 1 /sp.log (x), x, 1 , '+-' ))
print (sp.limit ((1 + 1 /x)**x, x, sp.oo))
浮点运算对不定形式有自己的处理方式,主要由 IEEE 754 浮点运算标准规定。形式 0 ⋅ ∞ 、 0\cdot\infty\mathclose{\text{、}} 0 ⋅ ∞ 、 ∞ − ∞ \infty - \infty ∞ − ∞ 和 ∞ / ∞ \infty/\infty ∞/∞ 会得到 nan,即 “非数”,在 Python 中 0 / 0 0/0 0/0 会引发错误:
Python 复制
import math
inf = math.inf
print (0.0 *inf, inf - inf, inf/inf)
print (0.0 **0.0 , 1.0 **inf, inf**0.0 )
输出
nan nan nan
1.0 1.0 1.0
Python 故意出错的例子
print (0.0 /0.0 )
错误
ZeroDivisionError: float division by zero
三个幂的结果都是 1.0。这是一种约定,便于程序处理,并非数学上的极限:( 1 + 1 / n ) n (1 + 1/n)^n ( 1 + 1/ n ) n 具有 1 ∞ 1^\infty 1 ∞ 的形式并趋近于 e 。 e\mathclose{\text{。}} e 。 浮点运算甚至可能错误地得到该极限:
Python 复制
for n in [10 , 10 **6 , 10 **12 , 10 **15 , 10 **16 ]:
print (n, (1 + 1 /n)**n)
输出
10 2.5937424601000023
1000000 2.7182804690957534
1000000000000 2.7185234960372378
1000000000000000 3.035035206549262
10000000000000000 1.0
直到 n = 10 6 , n = 10^6\mathclose{\text{,}} n = 1 0 6 , 值接近 e = 2.71828 … ; e = 2.71828\ldots\mathclose{\text{;}} e = 2.71828 … ; 然后它们出错。对于 n = 10 16 , n = 10^{16}\mathclose{\text{,}} n = 1 0 16 , 1 + 10 − 16 1 + 10^{-16} 1 + 1 0 − 16 舍入到恰好 1,且 1 n = 1 。 1^n = 1\mathclose{\text{。}} 1 n = 1 。 对于 n = 10 12 n = 10^{12} n = 1 0 12 和 10 15 , 10^{15}\mathclose{\text{,}} 1 0 15 , 1 + 1 / n 1 + 1/n 1 + 1/ n 以一个微小的相对误差存储,将其提升到幂 n n n 会将该误差乘以约 n : n\mathclose{\text{:}} n : u n u^n u n 的条件数是 n n n (参见第 7.3 节的注释)。解决方法是避免形成 1 + 1 / n : 1 + 1/n\mathclose{\text{:}} 1 + 1/ n : math.log1p(u) 对于小的 u u u 可以准确计算 ln ( 1 + u ) , \ln(1 + u)\mathclose{\text{,}} ln ( 1 + u ) , 且 ( 1 + 1 / n ) n = e n ln ( 1 + 1 / n ) 。 (1 + 1/n)^n = e^{n\ln(1 + 1/n)}\mathclose{\text{。}} ( 1 + 1/ n ) n = e n l n ( 1 + 1/ n ) 。
Python 复制
n = 10 **15
print (math.exp (n*math.log1p (1 /n)), math.e)
输出
2.7182818284590438 2.718281828459045
模块 3 通过函数随 x → ∞ x \to \infty x → ∞ 增长的速度对它们进行排序(定理 3.11 ):对数增长比幂函数慢,幂函数又比指数函数慢。这种排序解释了为什么一个运行时间增长像 n 2 n^2 n 2 的算法在大数据输入上会比一个运行时间增长像 2 n 2^n 2 n 的算法更快。模块 3 在一个“深入理解”框中使用它所拥有的工具证明了这一点;洛必达法则只需几行即可证明。
定理 7.6对数增长比幂函数慢
对于每一个 p > 0 , p > 0\mathclose{\text{,}} p > 0 ,
lim x → ∞ ln x x p = 0. \lim_{x\to\infty}\frac{\ln x}{x^p} = 0. x → ∞ lim x p ln x = 0.
证明
如 x → ∞ 、 x \to \infty\mathclose{\text{、}} x → ∞ 、 ln x → ∞ \ln x \to \infty ln x → ∞ 和 x p → ∞ , x^p \to \infty\mathclose{\text{,}} x p → ∞ , 以及 x p x^p x p 的导数 p x p − 1 px^{p-1} p x p − 1 (第 6 模块)在 x > 0 x > 0 x > 0 处不为 0。导数的商为
1 / x p x p − 1 = 1 p x p → 0 , \frac{1/x}{px^{p-1}} = \frac{1}{px^p} \;\to\; 0, p x p − 1 1/ x = p x p 1 → 0 ,
因此,根据洛必达法则(定理 7.5) ln x / x p → 0 。 \ln x/x^p \to 0\mathclose{\text{。}} ln x / x p → 0 。
∎
该定理对每一个 p > 0 p > 0 p > 0 都成立,无论多么小,但对于小的 p , p\mathclose{\text{,}} p , 极限需要一定时间才能达到。表格显示 ln x / x 0.1 : \ln x/x^{0.1}\mathclose{\text{:}} ln x / x 0.1 : 它上升到 10 / e ≈ 3.68 10/e \approx 3.68 10/ e ≈ 3.68 的最大值,出现在 x = e 10 ≈ 22 026 x = e^{10} \approx 22\,026 x = e 10 ≈ 22 026 (第 8 模块展示如何找到此类最大值),然后才缓慢下降。
x x x ln x x 0.1 \dfrac{\ln x}{x^{0.1}} x 0.1 ln x 10 10 10 1.829 1.829 1.829 10 4 10^{4} 1 0 4 3.667 3.667 3.667 10 10 10^{10} 1 0 10 2.303 2.303 2.303 10 20 10^{20} 1 0 20 0.4605 0.4605 0.4605 10 50 10^{50} 1 0 50 0.001151 0.001151 0.001151 10 100 10^{100} 1 0 100 2.303 × 10 − 8 2.303\times10^{-8} 2.303 × 1 0 − 8
定理 7.7幂函数的增长速度慢于指数函数
对于每一个实数 p p p 和每一个 a > 1 , a > 1\mathclose{\text{,}} a > 1 ,
lim x → ∞ x p a x = 0. \lim_{x\to\infty}\frac{x^p}{a^x} = 0. x → ∞ lim a x x p = 0.
证明
先设 a = e , a = e\mathclose{\text{,}} a = e , 并取非负整数 p = n , p = n\mathclose{\text{,}} p = n , 其中 n ≥ 1 。 n \ge 1\mathclose{\text{。}} n ≥ 1 。 商 x n / e x x^n/e^x x n / e x 为 ∞ / ∞ \infty/\infty ∞/∞ 型,且 e x e^x e x 的导数始终非零。由洛必达法则,可改求 n x n − 1 / e x nx^{n-1}/e^x n x n − 1 / e x 的极限。当 n ≥ 2 n \ge 2 n ≥ 2 时,它仍为 ∞ / ∞ \infty/\infty ∞/∞ 型。反复应用 n n n 次后,
x n e x , n x n − 1 e x , n ( n − 1 ) x n − 2 e x , … , n ! e x , \frac{x^n}{e^x},\; \frac{nx^{n-1}}{e^x},\; \frac{n(n-1)x^{n-2}}{e^x},\; \dots,\; \frac{n!}{e^x}, e x x n , e x n x n − 1 , e x n ( n − 1 ) x n − 2 , … , e x n ! ,
其中n ! = n ( n − 1 ) ⋯ 2 ⋅ 1 n! = n(n-1)\cdots2\cdot1 n ! = n ( n − 1 ) ⋯ 2 ⋅ 1 (模块3)。最后一个商趋于0。由定理7.5,列表中的每个商与下一个商具有相同的极限,因此逆向推导,它们都趋于0。(对于n = 0 、 n = 0\mathclose{\text{、}} n = 0 、 1 / e x → 0 1/e^x \to 0 1/ e x → 0 直接成立。)
接下来,对任意实数 p : p\mathclose{\text{:}} p : 选取一个整数 n ≥ p 。 n \ge p\mathclose{\text{。}} n ≥ p 。 对于 x ≥ 1 , x \ge 1\mathclose{\text{,}} x ≥ 1 , x p ≤ x n , x^p \le x^n\mathclose{\text{,}} x p ≤ x n , 因此 0 < x p / e x ≤ x n / e x , 0 < x^p/e^x \le x^n/e^x\mathclose{\text{,}} 0 < x p / e x ≤ x n / e x , 且夹逼定理(模块 2)给出 x p / e x → 0 。 x^p/e^x \to 0\mathclose{\text{。}} x p / e x → 0 。
最后,任意a > 1 : a > 1\mathclose{\text{:}} a > 1 : 则ln a > 0 \ln a > 0 ln a > 0 且a x = e x ln a 。 a^x = e^{x\ln a}\mathclose{\text{。}} a x = e x l n a 。 设u = x ln a , u = x\ln a\mathclose{\text{,}} u = x ln a , 其以x x x 趋近于∞ ; \infty\mathclose{\text{;}} ∞ ; 则
x p a x = ( u / ln a ) p e u = 1 ( ln a ) p ⋅ u p e u → 0. \frac{x^p}{a^x} = \frac{(u/\ln a)^p}{e^u} = \frac{1}{(\ln a)^p}\cdot\frac{u^p}{e^u} \;\to\; 0. a x x p = e u ( u / ln a ) p = ( ln a ) p 1 ⋅ e u u p → 0.
∎
再次,极限可以慢慢来。对于 p = 10 : p = 10\mathclose{\text{:}} p = 10 :
x x x x 10 e x \dfrac{x^{10}}{e^x} e x x 10 10 10 10 454000 454000 454000 20 20 20 21100 21100 21100 30 30 30 55.3 55.3 55.3 40 40 40 0.0445 0.0445 0.0445 50 50 50 1.88 × 10 − 5 1.88\times10^{-5} 1.88 × 1 0 − 5 100 100 100 3.72 × 10 − 24 3.72\times10^{-24} 3.72 × 1 0 − 24
在 x = 10 x = 10 x = 10 处,x 10 x^{10} x 10 大约是 e x e^x e x 的 450,000 倍;在 x = 100 x = 100 x = 100 处,它大约小 3 × 10 23 3 \times 10^{23} 3 × 1 0 23 倍。
要点
作为 x → ∞ , x \to \infty\mathclose{\text{,}} x → ∞ , 对于每一个 p > 0 , p > 0\mathclose{\text{,}} p > 0 , q > 0 q > 0 q > 0 和 a > 1 : a > 1\mathclose{\text{:}} a > 1 : ln x ≪ x p ≪ a x \;\ln x \ll x^p \ll a^x\; ln x ≪ x p ≪ a x 和 ( ln x ) q ≪ x p , \;(\ln x)^q \ll x^p\mathclose{\text{,}} ( ln x ) q ≪ x p , 其中 f ≪ g f \ll g f ≪ g (模块 3 的记号,读作 “f 比 g 小得多”)意味着 f ( x ) / g ( x ) → 0 。 f(x)/g(x) \to 0\mathclose{\text{。}} f ( x ) / g ( x ) → 0 。 最后一个结论由第一个得出: ( ln x ) q / x p = ( ln x / x p / q ) q → 0 。 (\ln x)^q/x^p = \big(\ln x/x^{p/q}\big)^q \to 0\mathclose{\text{。}} ( ln x ) q / x p = ( ln x / x p / q ) q → 0 。 任何对数的幂都比任何正幂的 x x x 小,任何 x x x 的幂都比任何大于 1 的底数的指数函数小,无论常数如何。
注意
增长率是关于大 x x x 的陈述。x 10 x^{10} x 10 在 x = 10 x = 10 x = 10 和 x = 30 x = 30 x = 30 处大于 e x , e^x\mathclose{\text{,}} e x , 且 ln x \ln x ln x 在从大约 3 到大约 3 × 10 15 3 \times 10^{15} 3 × 1 0 15 的每个 x x x 处大于 x 0.1 。 x^{0.1}\mathclose{\text{。}} x 0.1 。 同样的谨慎也适用于算法:对于大 n , n\mathclose{\text{,}} n , 需要 n 2 n^2 n 2 步的算法优于需要 2 n 2^n 2 n 步的算法,但对于 n = 3 , n = 3\mathclose{\text{,}} n = 3 , 后者需要 8 步而前者需要 9 步。
相关变化率 :画一个图,找出在每一时刻连接变化量的方程,对时间求导(每个量都是 t t t 的函数,因此需要使用链式法则),然后才将该时刻的值代入。
线性近似 L ( x ) = f ( a ) + f ′ ( a ) ( x − a ) L(x) = f(a) + f'(a)(x - a) L ( x ) = f ( a ) + f ′ ( a ) ( x − a ) 是在 a a a 处的切线,且 f ( x ) ≈ L ( x ) f(x) \approx L(x) f ( x ) ≈ L ( x ) 在 a a a 附近。其误差相对于 x − a x - a x − a 很小(定理 7.1),通常接近 1 2 f ′ ′ ( a ) ( x − a ) 2 。 \tfrac12 f''(a)(x - a)^2\mathclose{\text{。}} 2 1 f ′′ ( a ) ( x − a ) 2 。 例子: 4.1 ≈ 2.025 , \sqrt{4.1} \approx 2.025\mathclose{\text{,}} 4.1 ≈ 2.025 , sin θ ≈ θ . \sin\theta \approx \theta\mathclose{\text{.}} sin θ ≈ θ .
微分 : d y = f ′ ( x ) d x dy = f'(x)\,dx d y = f ′ ( x ) d x 是切线上变化量, Δ y \Delta y Δ y 是曲线上变化量,且 Δ y ≈ d y \Delta y \approx dy Δ y ≈ d y 当 d x dx d x 很小时。
误差 传播遵循 Δ y ≈ f ′ ( x ) Δ x 。 \Delta y \approx f'(x)\,\Delta x\mathclose{\text{。}} Δ y ≈ f ′ ( x ) Δ x 。 x k x^k x k 的相对误差约为 ∣ k ∣ \abs{k} ∣ k ∣ 倍于 x x x 的相对误差,因此球体体积的相对误差是其半径的三倍。
牛顿法 x n + 1 = x n − f ( x n ) / f ′ ( x n ) x_{n+1} = x_n - f(x_n)/f'(x_n) x n + 1 = x n − f ( x n ) / f ′ ( x n ) 沿着切线逼近 x x x 轴。在具有 f ′ ( r ) ≠ 0 f'(r) \ne 0 f ′ ( r ) = 0 的根附近,它以二次收敛,每次迭代大致将正确数字翻倍;对于平方根, x n + 1 = 1 2 ( x n + a / x n ) 。 x_{n+1} = \tfrac12(x_n + a/x_n)\mathclose{\text{。}} x n + 1 = 2 1 ( x n + a / x n ) 。 它在水平切线处失效,可能循环、发散或离开定义域,并且在多重根处收敛缓慢。
洛必达法则 : 对于形式 0 / 0 0/0 0/0 和 ∞ / ∞ , \infty/\infty\mathclose{\text{,}} ∞/∞ , 当 g ′ ≠ 0 g' \ne 0 g ′ = 0 接近 a a a 时,若第二个极限存在,则 lim f / g = lim f ′ / g ′ 。 \lim f/g = \lim f'/g'\mathclose{\text{。}} lim f / g = lim f ′ / g ′ 。 简单形式 f ′ ( a ) / g ′ ( a ) f'(a)/g'(a) f ′ ( a ) / g ′ ( a ) 当 f ( a ) = g ( a ) = 0 f(a) = g(a) = 0 f ( a ) = g ( a ) = 0 和 g ′ ( a ) ≠ 0 g'(a) \ne 0 g ′ ( a ) = 0 时,由导数的定义得出。每次使用前请检查形式,并分别对分子和分母进行求导。
其他 不定形式 : 将 0 ⋅ ∞ 0\cdot\infty 0 ⋅ ∞ 转换为一个商式,将 ∞ − ∞ \infty - \infty ∞ − ∞ 放在同一个分母上,并对 1 ∞ 、 1^\infty\mathclose{\text{、}} 1 ∞ 、 0 0 0^0 0 0 和 ∞ 0 \infty^0 ∞ 0 取对数。特别是 ( 1 + a / x ) x → e a 。 (1 + a/x)^x \to e^a\mathclose{\text{。}} ( 1 + a / x ) x → e a 。
增长速率 : ln x ≪ x p ≪ a x \ln x \ll x^p \ll a^x ln x ≪ x p ≪ a x 对于 p > 0 p > 0 p > 0 和 a > 1 , a > 1\mathclose{\text{,}} a > 1 , 尽管“最终”可能意味着“仅当 x x x 非常大时”。
练习 7.1 ★ 一个球形气球
空气以 100 cm³ 每秒的速度被泵入球形气球中。
(a) 当半径为 10 cm 时,半径增加的速度是多少?
(b) 此时表面积 S = 4 π r 2 S = 4\pi r^2 S = 4 π r 2 增加的速度是多少?
(c) 当半径为 20 cm 时,半径增加的速度是多少?为什么更慢?
查看解答✓ 已检验
(a) 体积是 V = 4 3 π r 3 。 V = \tfrac43\pi r^3\mathclose{\text{。}} V = 3 4 π r 3 。 对 t t t 求导(链式法则): d V d t = 4 π r 2 d r d t 。 \dfrac{dV}{dt} = 4\pi r^2\,\dfrac{dr}{dt}\mathclose{\text{。}} d t d V = 4 π r 2 d t d r 。 带入 d V / d t = 100 dV/dt = 100 d V / d t = 100 和 r = 10 : r = 10\mathclose{\text{:}} r = 10 : 100 = 400 π d r d t , 100 = 400\pi\,\dfrac{dr}{dt}\mathclose{\text{,}} 100 = 400 π d t d r , 因此
d r d t = 1 4 π ≈ 0.0796 cm/s . \frac{dr}{dt} = \frac{1}{4\pi} \approx 0.0796 \text{ cm/s}. d t d r = 4 π 1 ≈ 0.0796 cm/s .
(b) d S d t = 8 π r d r d t = 8 π ⋅ 10 ⋅ 1 4 π = 20 \dfrac{dS}{dt} = 8\pi r\,\dfrac{dr}{dt} = 8\pi \cdot 10 \cdot \dfrac{1}{4\pi} = 20 d t d S = 8 π r d t d r = 8 π ⋅ 10 ⋅ 4 π 1 = 20 cm²/s。
(c) 在 r = 20 r = 20 r = 20 处: 100 = 4 π ⋅ 400 d r d t , 100 = 4\pi \cdot 400\,\dfrac{dr}{dt}\mathclose{\text{,}} 100 = 4 π ⋅ 400 d t d r , 因此 d r d t = 1 16 π ≈ 0.0199 \dfrac{dr}{dt} = \dfrac{1}{16\pi} \approx 0.0199 d t d r = 16 π 1 ≈ 0.0199 cm/s,是 (a) 中速率的四分之一。相同的 100 cm³/s 被分散在一个面积 4 π r 2 4\pi r^2 4 π r 2 上,该面积是原来的四倍,因此半径增长速度慢四倍。
练习 7.2 ★ 线性近似
(a) 求 f ( x ) = x 3 f(x) = \sqrt[3]{x} f ( x ) = 3 x 在 a = 27 a = 27 a = 27 处的线性化,并用它来估计 26 3 \sqrt[3]{26} 3 26 和 28 3 。 \sqrt[3]{28}\mathclose{\text{。}} 3 28 。
(b) 求 ln x \ln x ln x 在 a = 1 a = 1 a = 1 处的线性化,并用它来估计 ln 1.1 \ln 1.1 ln 1.1 和 ln 0.9 。 \ln 0.9\mathclose{\text{。}} ln 0.9 。
(c) 将所有四个估计值与计算器结果进行比较。它们是偏大还是偏小?
查看解答✓ 已检验
(a) f ( 27 ) = 3 f(27) = 3 f ( 27 ) = 3 和 f ′ ( x ) = 1 3 x − 2 / 3 , f'(x) = \tfrac13 x^{-2/3}\mathclose{\text{,}} f ′ ( x ) = 3 1 x − 2/3 , 因此 f ′ ( 27 ) = 1 3 ⋅ 9 = 1 27 f'(27) = \dfrac{1}{3 \cdot 9} = \dfrac{1}{27} f ′ ( 27 ) = 3 ⋅ 9 1 = 27 1 和
L ( x ) = 3 + x − 27 27 . L(x) = 3 + \frac{x - 27}{27}. L ( x ) = 3 + 27 x − 27 .
所以 26 3 ≈ 3 − 1 27 = 80 27 ≈ 2.96296 \sqrt[3]{26} \approx 3 - \tfrac{1}{27} = \tfrac{80}{27} \approx 2.96296 3 26 ≈ 3 − 27 1 = 27 80 ≈ 2.96296 和 28 3 ≈ 3 + 1 27 = 82 27 ≈ 3.03704 。 \sqrt[3]{28} \approx 3 + \tfrac{1}{27} = \tfrac{82}{27} \approx 3.03704\mathclose{\text{。}} 3 28 ≈ 3 + 27 1 = 27 82 ≈ 3.03704 。
(b) ln 1 = 0 \ln 1 = 0 ln 1 = 0 和 ln x \ln x ln x 的导数是 1 / x , 1/x\mathclose{\text{,}} 1/ x , 其在 x = 1 x = 1 x = 1 处为 1。因此 L ( x ) = x − 1 , L(x) = x - 1\mathclose{\text{,}} L ( x ) = x − 1 , 且 ln 1.1 ≈ 0.1 , \ln 1.1 \approx 0.1\mathclose{\text{,}} ln 1.1 ≈ 0.1 , ln 0.9 ≈ − 0.1 。 \ln 0.9 \approx -0.1\mathclose{\text{。}} ln 0.9 ≈ − 0.1 。
(c) 一台计算器给出 26 3 ≈ 2.96250 , \sqrt[3]{26} \approx 2.96250\mathclose{\text{,}} 3 26 ≈ 2.96250 , 28 3 ≈ 3.03659 , \sqrt[3]{28} \approx 3.03659\mathclose{\text{,}} 3 28 ≈ 3.03659 , ln 1.1 ≈ 0.09531 \ln 1.1 \approx 0.09531 ln 1.1 ≈ 0.09531 和 ln 0.9 ≈ − 0.10536 。 \ln 0.9 \approx -0.10536\mathclose{\text{。}} ln 0.9 ≈ − 0.10536 。 所有四个估计值都略微偏大:立方根的误差分别为 0.00047 和 0.00045,对数的误差分别为 0.0047 和 0.0054。两个图像都向下弯曲,因此它们的切线位于图像上方。误差的大小符合第 7.2 节的规则 f ( x ) − L ( x ) ≈ 1 2 f ′ ′ ( a ) ( x − a ) 2 。 f(x) - L(x) \approx \tfrac12 f''(a)(x - a)^2\mathclose{\text{。}} f ( x ) − L ( x ) ≈ 2 1 f ′′ ( a ) ( x − a ) 2 。 对于 x 3 , \sqrt[3]{x}\mathclose{\text{,}} 3 x , f ′ ′ ( x ) = − 2 9 x − 5 / 3 , f''(x) = -\tfrac29 x^{-5/3}\mathclose{\text{,}} f ′′ ( x ) = − 9 2 x − 5/3 , 因此 f ′ ′ ( 27 ) = − 2 2187 ≈ − 0.00091 f''(27) = -\tfrac{2}{2187} \approx -0.00091 f ′′ ( 27 ) = − 2187 2 ≈ − 0.00091 和 1 2 ( 0.00091 ) ( 1 ) 2 ≈ 0.00046 。 \tfrac12(0.00091)(1)^2 \approx 0.00046\mathclose{\text{。}} 2 1 ( 0.00091 ) ( 1 ) 2 ≈ 0.00046 。 对于 ln x , \ln x\mathclose{\text{,}} ln x , f ′ ′ ( 1 ) = − 1 f''(1) = -1 f ′′ ( 1 ) = − 1 和 1 2 ( 1 ) ( 0.1 ) 2 = 0.005 。 \tfrac12(1)(0.1)^2 = 0.005\mathclose{\text{。}} 2 1 ( 1 ) ( 0.1 ) 2 = 0.005 。
练习 7.3 ★ 是不定式吗?
对每个极限,说明是否适用洛必达法则,然后求出极限。
(a) lim x → 0 e 3 x − 1 x \displaystyle\lim_{x\to0}\frac{e^{3x} - 1}{x} x → 0 lim x e 3 x − 1
(b) lim x → π sin x x − π \displaystyle\lim_{x\to\pi}\frac{\sin x}{x - \pi} x → π lim x − π sin x
(c) lim x → 0 cos x 1 + x \displaystyle\lim_{x\to0}\frac{\cos x}{1 + x} x → 0 lim 1 + x cos x
(d) lim x → ∞ 2 x + 3 5 x − 1 \displaystyle\lim_{x\to\infty}\frac{2x + 3}{5x - 1} x → ∞ lim 5 x − 1 2 x + 3
查看解答✓ 已检验
(a) 在 x = 0 x = 0 x = 0 处,分子是 e 0 − 1 = 0 , e^0 - 1 = 0\mathclose{\text{,}} e 0 − 1 = 0 , 分母是 0:形式为 0 / 0 。 0/0\mathclose{\text{。}} 0/0 。 两者均可导,分母的导数是 1,从不为 0,因此适用该规则。导数的商是 3 e 3 x 1 → 3 , \dfrac{3e^{3x}}{1} \to 3\mathclose{\text{,}} 1 3 e 3 x → 3 , 因此极限是 3。
(b) sin π = 0 \sin\pi = 0 sin π = 0 和 π − π = 0 : \pi - \pi = 0\mathclose{\text{:}} π − π = 0 : 形式为 0 / 0 , 0/0\mathclose{\text{,}} 0/0 , 且分母的导数仍是 1。导数的商为 cos x 1 → cos π = − 1 , \dfrac{\cos x}{1} \to \cos\pi = -1\mathclose{\text{,}} 1 cos x → cos π = − 1 , 因此极限为 − 1 。 -1\mathclose{\text{。}} − 1 。 (简单形式,定理 7.4,给出相同结果:f ′ ( π ) / g ′ ( π ) = − 1 / 1 。) f'(\pi)/g'(\pi) = -1/1\mathclose{\text{。)}} f ′ ( π ) / g ′ ( π ) = − 1/1 。)
(c) 在 x = 0 x = 0 x = 0 处,分子是 cos 0 = 1 , \cos 0 = 1\mathclose{\text{,}} cos 0 = 1 , 分母是 1:不是不定式,因此规则不适用。代入求极限为 1 / 1 = 1 。 1/1 = 1\mathclose{\text{。}} 1/1 = 1 。 若强行应用规则,则得到 − sin x 1 → 0 , \dfrac{-\sin x}{1} \to 0\mathclose{\text{,}} 1 − sin x → 0 , 这是错误的。
(d) 两者顶部和底部都趋近于 ∞ : \infty\mathclose{\text{:}} ∞ : 形式为 ∞ / ∞ , \infty/\infty\mathclose{\text{,}} ∞/∞ , 底部的导数为 5,永远不会为 0。导数的商是常数 2 / 5 , 2/5\mathclose{\text{,}} 2/5 , 因此极限为 2 5 。 \tfrac25\mathclose{\text{。}} 5 2 。 将顶部和底部都除以 x x x (模块 3)得到相同的结果:2 + 3 / x 5 − 1 / x → 2 5 。 \dfrac{2 + 3/x}{5 - 1/x} \to \dfrac25\mathclose{\text{。}} 5 − 1/ x 2 + 3/ x → 5 2 。
练习 7.4 ★ 牛顿法手动计算
方程 x 3 − 2 x − 5 = 0 x^3 - 2x - 5 = 0 x 3 − 2 x − 5 = 0 在 2 附近有一个根。
(a) 写出 f ( x ) = x 3 − 2 x − 5 f(x) = x^3 - 2x - 5 f ( x ) = x 3 − 2 x − 5 的牛顿迭代步,并简化为一个分数。
(b) 从 x 0 = 2 x_0 = 2 x 0 = 2 开始,手动计算 x 1 x_1 x 1 和 x 2 x_2 x 2 (x 2 x_2 x 2 作为分数并保留六位小数)。
(c) 根是 r = 2.0945514815 … ; r = 2.0945514815\ldots\mathclose{\text{;}} r = 2.0945514815 … ; x 0 、 x_0\mathclose{\text{、}} x 0 、 x 1 x_1 x 1 和 x 2 x_2 x 2 分别正确到小数点后几位?
(d) 为什么 x 0 = 0.8 x_0 = 0.8 x 0 = 0.8 是一个较差的初始值?从它计算 x 1 。 x_1\mathclose{\text{。}} x 1 。
查看解答✓ 已检验
(a) f ′ ( x ) = 3 x 2 − 2 。 f'(x) = 3x^2 - 2\mathclose{\text{。}} f ′ ( x ) = 3 x 2 − 2 。 为 x n x_n x n 写出 x , x\mathclose{\text{,}} x , 并将步骤放在公共分母 3 x 2 − 2 3x^2 - 2 3 x 2 − 2 上:
x − x 3 − 2 x − 5 3 x 2 − 2 = 3 x 3 − 2 x − x 3 + 2 x + 5 3 x 2 − 2 = 2 x 3 + 5 3 x 2 − 2 . \begin{aligned} &x - \frac{x^3 - 2x - 5}{3x^2 - 2} \\ &\quad= \frac{3x^3 - 2x - x^3 + 2x + 5}{3x^2 - 2} \\ &\quad= \frac{2x^3 + 5}{3x^2 - 2}. \end{aligned} x − 3 x 2 − 2 x 3 − 2 x − 5 = 3 x 2 − 2 3 x 3 − 2 x − x 3 + 2 x + 5 = 3 x 2 − 2 2 x 3 + 5 .
So x n + 1 = 2 x n 3 + 5 3 x n 2 − 2 . x_{n+1} = \dfrac{2x_n^3 + 5}{3x_n^2 - 2}\mathclose{\text{.}} x n + 1 = 3 x n 2 − 2 2 x n 3 + 5 .
(b) x 1 = 2 ⋅ 8 + 5 3 ⋅ 4 − 2 = 21 10 = 2.1 . x_1 = \dfrac{2 \cdot 8 + 5}{3 \cdot 4 - 2} = \dfrac{21}{10} = 2.1\mathclose{\text{.}} x 1 = 3 ⋅ 4 − 2 2 ⋅ 8 + 5 = 10 21 = 2.1 . 然后,用 2.1 3 = 9.261 2.1^3 = 9.261 2. 1 3 = 9.261 和 2.1 2 = 4.41 , 2.1^2 = 4.41\mathclose{\text{,}} 2. 1 2 = 4.41 ,
x 2 = 2 ⋅ 9.261 + 5 3 ⋅ 4.41 − 2 = 23.522 11.23 = 11761 5615 ≈ 2.094568. \begin{aligned} x_2 &= \frac{2 \cdot 9.261 + 5}{3 \cdot 4.41 - 2} = \frac{23.522}{11.23} \\ &= \frac{11761}{5615} \approx 2.094568. \end{aligned} x 2 = 3 ⋅ 4.41 − 2 2 ⋅ 9.261 + 5 = 11.23 23.522 = 5615 11761 ≈ 2.094568.
(c) 误差是 ∣ x 0 − r ∣ ≈ 0.095 , \abs{x_0 - r} \approx 0.095\mathclose{\text{,}} ∣ x 0 − r ∣ ≈ 0.095 , ∣ x 1 − r ∣ ≈ 0.0054 \abs{x_1 - r} \approx 0.0054 ∣ x 1 − r ∣ ≈ 0.0054 和 ∣ x 2 − r ∣ ≈ 0.000017 。 \abs{x_2 - r} \approx 0.000017\mathclose{\text{。}} ∣ x 2 − r ∣ ≈ 0.000017 。 与 0.5 × 10 − d 0.5 \times 10^{-d} 0.5 × 1 0 − d 比较: x 0 x_0 x 0 正确到 0 位小数(0.095 < 0.5 0.095 < 0.5 0.095 < 0.5 但不是 < 0.05 ), < 0.05\mathclose{\text{),}} < 0.05 ), x 1 x_1 x 1 正确到 1 位(0.0054 < 0.05 0.0054 < 0.05 0.0054 < 0.05 但不是 < 0.005 ) < 0.005\mathclose{\text{)}} < 0.005 ) 和 x 2 x_2 x 2 正确到 4 位(0.000017 < 0.00005 0.000017 < 0.00005 0.000017 < 0.00005 但不是 < 0.000005 )。 < 0.000005\mathclose{\text{)。}} < 0.000005 )。 下一个迭代正确到 9 位小数。
(d) f ′ ( 0.8 ) = 3 ⋅ 0.64 − 2 = − 0.08 f'(0.8) = 3 \cdot 0.64 - 2 = -0.08 f ′ ( 0.8 ) = 3 ⋅ 0.64 − 2 = − 0.08 接近 0: 0.8 0.8 0.8 接近 2 / 3 ≈ 0.816 , \sqrt{2/3} \approx 0.816\mathclose{\text{,}} 2/3 ≈ 0.816 , 其中 f ′ ( x ) = 0 , f'(x) = 0\mathclose{\text{,}} f ′ ( x ) = 0 , 因此在 x 0 x_0 x 0 处的切线几乎水平,并且与 x x x 轴相交点很远。用 f ( 0.8 ) = 0.512 − 1.6 − 5 = − 6.088 , f(0.8) = 0.512 - 1.6 - 5 = -6.088\mathclose{\text{,}} f ( 0.8 ) = 0.512 − 1.6 − 5 = − 6.088 ,
x 1 = 0.8 − − 6.088 − 0.08 = 0.8 − 76.1 = − 75.3 , \begin{aligned} x_1 &= 0.8 - \frac{-6.088}{-0.08} \\ &= 0.8 - 76.1 = -75.3, \end{aligned} x 1 = 0.8 − − 0.08 − 6.088 = 0.8 − 76.1 = − 75.3 ,
大约距离根 77 个单位。在这里,方法逐渐恢复:对于大的 ∣ x n ∣ , \abs{x_n}\mathclose{\text{,}} ∣ x n ∣ , 步长 2 x n 3 + 5 3 x n 2 − 2 \dfrac{2x_n^3 + 5}{3x_n^2 - 2} 3 x n 2 − 2 2 x n 3 + 5 接近 2 3 x n , \tfrac23 x_n\mathclose{\text{,}} 3 2 x n , 因此每次迭代仅将近似值缩小约三分之一,而 x 12 ≈ 1.97 x_{12} \approx 1.97 x 12 ≈ 1.97 是再次接近根的第一个迭代。从那里开始,正确的数字通常会翻倍。第 7.4 节的控件部件展示了整个过程。
练习 7.5 ★★ 两辆车
汽车A位于十字路口以北0.3公里处,以90公里/小时的速度向南驶向十字路口。汽车B位于十字路口以东0.4公里处,以60公里/小时的速度向西驶向十字路口。两车之间的距离变化率是多少?是增加还是减少?
查看解答✓ 已检验
设 x x x 为 B 车在十字路口东边的距离,y y y 为 A 车在十字路口北边的距离,z z z 为两车在时间 t t t 小时内的距离,单位为公里。两车均接近十字路口,因此 x x x 和 y y y 减小:d x / d t = − 60 dx/dt = -60 d x / d t = − 60 和 d y / d t = − 90 。 dy/dt = -90\mathclose{\text{。}} d y / d t = − 90 。 根据勾股定理,在每一时刻
z 2 = x 2 + y 2 . z^2 = x^2 + y^2. z 2 = x 2 + y 2 .
对 t t t 求导:2 z d z d t = 2 x d x d t + 2 y d y d t 。 2z\,\dfrac{dz}{dt} = 2x\,\dfrac{dx}{dt} + 2y\,\dfrac{dy}{dt}\mathclose{\text{。}} 2 z d t d z = 2 x d t d x + 2 y d t d y 。 在该时刻,x = 0.4 x = 0.4 x = 0.4 和 y = 0.3 , y = 0.3\mathclose{\text{,}} y = 0.3 , 因此 z = 0.16 + 0.09 = 0.5 , z = \sqrt{0.16 + 0.09} = 0.5\mathclose{\text{,}} z = 0.16 + 0.09 = 0.5 , 和
d z d t = x d x / d t + y d y / d t z = 0.4 ( − 60 ) + 0.3 ( − 90 ) 0.5 = − 24 − 27 0.5 = − 102 km/h . \begin{aligned} \frac{dz}{dt} &= \frac{x\,dx/dt + y\,dy/dt}{z} \\ &= \frac{0.4(-60) + 0.3(-90)}{0.5} \\ &= \frac{-24 - 27}{0.5} = -102 \text{ km/h}. \end{aligned} d t d z = z x d x / d t + y d y / d t = 0.5 0.4 ( − 60 ) + 0.3 ( − 90 ) = 0.5 − 24 − 27 = − 102 km/h .
两车之间的距离以102公里/小时的速度在减少。常见的错误是将两个速度都视为正数,这会导致+ 102 : +102\mathclose{\text{:}} + 102 : 一个距离减少的量具有负的变化率。
练习 7.6 ★★ 测量立方体
立方体的边长测量为30厘米,最大误差不超过0.1厘米。
(a) 估计计算出的体积的最大误差,作为绝对误差和相对误差。
(b) 对计算出的表面积做同样的估计。
(c) 体积误差不超过 0.5% 时,边长必须测量多准确?
查看解答✓ 已检验
(a) V = x 3 , V = x^3\mathclose{\text{,}} V = x 3 , 所以 d V = 3 x 2 d x . dV = 3x^2\,dx\mathclose{\text{.}} d V = 3 x 2 d x . 以 x = 30 x = 30 x = 30 和 ∣ d x ∣ ≤ 0.1 : \abs{dx} \le 0.1\mathclose{\text{:}} ∣ d x ∣ ≤ 0.1 : ∣ d V ∣ ≤ 3 ⋅ 900 ⋅ 0.1 = 270 \abs{dV} \le 3 \cdot 900 \cdot 0.1 = 270 ∣ d V ∣ ≤ 3 ⋅ 900 ⋅ 0.1 = 270 cm³. 体积是 30 3 = 27 000 30^3 = 27\,000 3 0 3 = 27 000 cm³, 所以相对误差最多为 270 / 27 000 = 0.01 = 1 % . 270/27\,000 = 0.01 = 1\%\mathclose{\text{.}} 270/27 000 = 0.01 = 1% . 作为验证,幂的规则给出 3 × 0.1 30 = 1 % . 3 \times \tfrac{0.1}{30} = 1\%\mathclose{\text{.}} 3 × 30 0.1 = 1% .
(b) S = 6 x 2 , S = 6x^2\mathclose{\text{,}} S = 6 x 2 , 所以 d S = 12 x d x , dS = 12x\,dx\mathclose{\text{,}} d S = 12 x d x , 并且 ∣ d S ∣ ≤ 12 ⋅ 30 ⋅ 0.1 = 36 \abs{dS} \le 12 \cdot 30 \cdot 0.1 = 36 ∣ d S ∣ ≤ 12 ⋅ 30 ⋅ 0.1 = 36 cm². 面积是 6 ⋅ 900 = 5400 6 \cdot 900 = 5400 6 ⋅ 900 = 5400 cm², 所以相对误差最多为 36 / 5400 = 1 150 ≈ 0.67 % : 36/5400 = \tfrac{1}{150} \approx 0.67\%\mathclose{\text{:}} 36/5400 = 150 1 ≈ 0.67% : 边长的相对误差的两倍,因为 S S S 是一个平方。
(c) d V V = 3 d x x , \dfrac{dV}{V} = 3\,\dfrac{dx}{x}\mathclose{\text{,}} V d V = 3 x d x , 所以当 ∣ d x ∣ x ≤ 0.005 3 = 1 600 \dfrac{\abs{dx}}{x} \le \dfrac{0.005}{3} = \dfrac{1}{600} x ∣ d x ∣ ≤ 3 0.005 = 600 1 时,体积在 0.5% 以内,即 ∣ d x ∣ ≤ 30 600 = 0.05 \abs{dx} \le \dfrac{30}{600} = 0.05 ∣ d x ∣ ≤ 600 30 = 0.05 cm: 半毫米。
练习 7.7 ★★ 洛必达法则在实际中的应用
求每个极限。
(a) lim x → 0 x − sin x x 3 \displaystyle\lim_{x\to0}\frac{x - \sin x}{x^3} x → 0 lim x 3 x − sin x
(b) lim x → 0 + x 2 ln x \displaystyle\lim_{x\to0^+} x^2\ln x x → 0 + lim x 2 ln x
(c) lim x → 0 ( 1 x − 1 e x − 1 ) \displaystyle\lim_{x\to0}\Big(\frac{1}{x} - \frac{1}{e^x - 1}\Big) x → 0 lim ( x 1 − e x − 1 1 )
查看解答✓ 已检验
(a) 形式是 0 / 0 。 0/0\mathclose{\text{。}} 0/0 。 应用该法则三次,每次检查形式(分母 x 3 、 x^3\mathclose{\text{、}} x 3 、 3 x 2 3x^2 3 x 2 和 6 x 6x 6 x 的导数分别为 3 x 2 、 3x^2\mathclose{\text{、}} 3 x 2 、 6 x 6x 6 x 和 6,这些导数在 0 附近(除 0 外)都不为 0):
x − sin x x 3 , 1 − cos x 3 x 2 , sin x 6 x , cos x 6 . \begin{aligned} &\frac{x - \sin x}{x^3},\; \frac{1 - \cos x}{3x^2}, \\ &\frac{\sin x}{6x},\; \frac{\cos x}{6}. \end{aligned} x 3 x − sin x , 3 x 2 1 − cos x , 6 x sin x , 6 cos x .
前三个形式是 0 / 0 ; 0/0\mathclose{\text{;}} 0/0 ; 最后一个趋向于 1 6 。 \tfrac16\mathclose{\text{。}} 6 1 。 使用定理 7.5 逆向推导,极限是 1 6 。 \tfrac16\mathclose{\text{。}} 6 1 。 (在第三阶段,简单形式也适用:cos 0 6 = 1 6 。) \dfrac{\cos 0}{6} = \dfrac16\mathclose{\text{。)}} 6 cos 0 = 6 1 。)
(b) 形式是 0 ⋅ ( − ∞ ) 。 0\cdot(-\infty)\mathclose{\text{。}} 0 ⋅ ( − ∞ ) 。 写出 x 2 ln x = ln x x − 2 , x^2\ln x = \dfrac{\ln x}{x^{-2}}\mathclose{\text{,}} x 2 ln x = x − 2 ln x , 形式为 ∞ / ∞ \infty/\infty ∞/∞ (分子趋向于 − ∞ , -\infty\mathclose{\text{,}} − ∞ , 分母为 ∞ )。 \infty\mathclose{\text{)。}} ∞ )。 分母的导数 − 2 x − 3 -2x^{-3} − 2 x − 3 在 x > 0 x > 0 x > 0 处不为 0,导数的商为
1 / x − 2 x − 3 = − x 2 2 → 0 , \frac{1/x}{-2x^{-3}} = -\frac{x^2}{2} \;\to\; 0, − 2 x − 3 1/ x = − 2 x 2 → 0 ,
因此极限是 0。
(c) 形式是 ∞ − ∞ \infty - \infty ∞ − ∞ (从右侧;左侧为 − ∞ + ∞ )。 -\infty + \infty\mathclose{\text{)。}} − ∞ + ∞ )。 通分后,
1 x − 1 e x − 1 = e x − 1 − x x ( e x − 1 ) , \frac1x - \frac{1}{e^x - 1} = \frac{e^x - 1 - x}{x(e^x - 1)}, x 1 − e x − 1 1 = x ( e x − 1 ) e x − 1 − x ,
的形式为 0 / 0 . 0/0\mathclose{\text{.}} 0/0 . 对分子求导,分母用乘积法则求导,得到 e x − 1 e x − 1 + x e x , \dfrac{e^x - 1}{e^x - 1 + xe^x}\mathclose{\text{,}} e x − 1 + x e x e x − 1 , 再次得到 0 / 0 , 0/0\mathclose{\text{,}} 0/0 , 再求一次导得到 e x 2 e x + x e x = 1 2 + x → 1 2 . \dfrac{e^x}{2e^x + xe^x} = \dfrac{1}{2 + x} \to \dfrac12\mathclose{\text{.}} 2 e x + x e x e x = 2 + x 1 → 2 1 . 极限是 1 2 . \tfrac12\mathclose{\text{.}} 2 1 . (分母的导数 e x − 1 + x e x e^x - 1 + xe^x e x − 1 + x e x 和 2 e x + x e x 2e^x + xe^x 2 e x + x e x 在 0 附近不为 0,除了在 0 处:第一个的符号为 x , x\mathclose{\text{,}} x , 第二个在 0 附近为正.)
练习 7.8 ★★ 指数形式
(a) 一个数据集有 n n n 个样本。一个 bootstrap 样本 ,用于统计和机器学习,从数据集中随机抽取 n n n 个样本,每次抽取一个,允许重复。某个样本未被抽取的概率是 ( 1 − 1 / n ) n . (1 - 1/n)^n\mathclose{\text{.}} ( 1 − 1/ n ) n . 当 n → ∞ n \to \infty n → ∞ 趋近于什么时,这个概率趋近于什么?
(b) 求 lim x → 0 + ( sin x ) x 。 \displaystyle\lim_{x\to0^+}(\sin x)^x\mathclose{\text{。}} x → 0 + lim ( sin x ) x 。
(c) 求 lim x → ∞ ( ln x ) 1 / x . \displaystyle\lim_{x\to\infty}(\ln x)^{1/x}\mathclose{\text{.}} x → ∞ lim ( ln x ) 1/ x .
查看解答✓ 已检验
(a) 形式为 1 ∞ . 1^\infty\mathclose{\text{.}} 1 ∞ . 根据例 7.17,带入 a = − 1 , a = -1\mathclose{\text{,}} a = − 1 , ( 1 − 1 / x ) x → e − 1 (1 - 1/x)^x \to e^{-1} ( 1 − 1/ x ) x → e − 1 作为 x → ∞ , x \to \infty\mathclose{\text{,}} x → ∞ , 因此
( 1 − 1 n ) n → 1 e ≈ 0.368. \Big(1 - \frac1n\Big)^n \to \frac1e \approx 0.368. ( 1 − n 1 ) n → e 1 ≈ 0.368.
对于一个大数据集,大约 36.8% 的样本在任何一个 bootstrap 样本中都会被排除。
(b) 的形式是 0 0 。 0^0\mathclose{\text{。}} 0 0 。 令 y = ( sin x ) x , y = (\sin x)^x\mathclose{\text{,}} y = ( sin x ) x , 对于 0 < x < π 。 0 < x < \pi\mathclose{\text{。}} 0 < x < π 。 然后 ln y = x ln sin x = ln sin x 1 / x , \ln y = x\ln\sin x = \dfrac{\ln\sin x}{1/x}\mathclose{\text{,}} ln y = x ln sin x = 1/ x ln sin x , 形式为 ∞ / ∞ \infty/\infty ∞/∞ (上部分趋近于 − ∞ )。 -\infty\mathclose{\text{)。}} − ∞ )。 下部分的导数 − 1 / x 2 -1/x^2 − 1/ x 2 永远不为 0,导数的商是
cos x / sin x − 1 / x 2 = − x ⋅ x sin x ⋅ cos x → 0 ⋅ 1 ⋅ 1 = 0 , \begin{aligned} \frac{\cos x/\sin x}{-1/x^2} &= -x \cdot \frac{x}{\sin x} \cdot \cos x \\ &\to 0 \cdot 1 \cdot 1 = 0, \end{aligned} − 1/ x 2 cos x / sin x = − x ⋅ sin x x ⋅ cos x → 0 ⋅ 1 ⋅ 1 = 0 ,
使用 x / sin x → 1 x/\sin x \to 1 x / sin x → 1 (模块 2)。因此 ln y → 0 \ln y \to 0 ln y → 0 和 y → e 0 = 1 。 y \to e^0 = 1\mathclose{\text{。}} y → e 0 = 1 。
(c) 的形式是 ∞ 0 。 \infty^0\mathclose{\text{。}} ∞ 0 。 令 y = ( ln x ) 1 / x , y = (\ln x)^{1/x}\mathclose{\text{,}} y = ( ln x ) 1/ x , 对于 x > 1 。 x > 1\mathclose{\text{。}} x > 1 。 然后 ln y = ln ( ln x ) x , \ln y = \dfrac{\ln(\ln x)}{x}\mathclose{\text{,}} ln y = x ln ( ln x ) , 形式为 ∞ / ∞ 。 \infty/\infty\mathclose{\text{。}} ∞/∞ 。 ln ( ln x ) \ln(\ln x) ln ( ln x ) 的导数是 1 x ln x \dfrac{1}{x\ln x} x ln x 1 (链式法则),下部分的导数是 1,因此导数的商是 1 x ln x → 0 。 \dfrac{1}{x\ln x} \to 0\mathclose{\text{。}} x ln x 1 → 0 。 因此 ln y → 0 \ln y \to 0 ln y → 0 和 y → 1 。 y \to 1\mathclose{\text{。}} y → 1 。
练习 7.9 ★★ 求解 e − x = x e^{-x} = x e − x = x
(a) 证明方程 e − x = x e^{-x} = x e − x = x 在 [ 0 , 1 ] [0, 1] [ 0 , 1 ] 内恰好有一个解。
(b) 证明 Newton 法用于 f ( x ) = x − e − x f(x) = x - e^{-x} f ( x ) = x − e − x 的迭代步是 x n + 1 = 1 + x n 1 + e x n 。 x_{n+1} = \dfrac{1 + x_n}{1 + e^{x_n}}\mathclose{\text{。}} x n + 1 = 1 + e x n 1 + x n 。
(c) 从 x 0 = 0.5 x_0 = 0.5 x 0 = 0.5 开始,计算 x 1 x_1 x 1 和 x 2 。 x_2\mathclose{\text{。}} x 2 。 已知解是 0.5671432904 … , 0.5671432904\ldots\mathclose{\text{,}} 0.5671432904 … , 每个数有多少位小数是正确的?
查看解答✓ 已检验
(a) f ( x ) = x − e − x f(x) = x - e^{-x} f ( x ) = x − e − x 是连续的,具有 f ( 0 ) = − 1 < 0 f(0) = -1 < 0 f ( 0 ) = − 1 < 0 和 f ( 1 ) = 1 − 1 / e > 0 , f(1) = 1 - 1/e > 0\mathclose{\text{,}} f ( 1 ) = 1 − 1/ e > 0 , 因此根据中间值定理,在 ( 0 , 1 ) (0, 1) ( 0 , 1 ) 内有一个根。它只有一个:因为 x x x 增加,而 e − x e^{-x} e − x 减少,所以 − e − x -e^{-x} − e − x 增加,而 f f f 是两个增加函数的和,严格增加,因为 x x x 是。
(b) f ′ ( x ) = 1 + e − x 。 f'(x) = 1 + e^{-x}\mathclose{\text{。}} f ′ ( x ) = 1 + e − x 。 然后
x − x − e − x 1 + e − x = x + x e − x − x + e − x 1 + e − x = ( 1 + x ) e − x 1 + e − x = 1 + x e x + 1 , \begin{aligned} &x - \frac{x - e^{-x}}{1 + e^{-x}} \\ &\quad= \frac{x + xe^{-x} - x + e^{-x}}{1 + e^{-x}} \\ &\quad= \frac{(1 + x)e^{-x}}{1 + e^{-x}} = \frac{1 + x}{e^x + 1}, \end{aligned} x − 1 + e − x x − e − x = 1 + e − x x + x e − x − x + e − x = 1 + e − x ( 1 + x ) e − x = e x + 1 1 + x ,
在最后一步中,将分子和分母都乘以 e x 。 e^x\mathclose{\text{。}} e x 。
(c) x 1 = 1.5 e 0.5 + 1 ≈ 1.5 2.648721 ≈ 0.566311 , x_1 = \dfrac{1.5}{e^{0.5} + 1} \approx \dfrac{1.5}{2.648721} \approx 0.566311\mathclose{\text{,}} x 1 = e 0.5 + 1 1.5 ≈ 2.648721 1.5 ≈ 0.566311 , 和 x 2 = 1.566311 … e 0.566311 … + 1 ≈ 0.5671431650 。 x_2 = \dfrac{1.566311\ldots}{e^{0.566311\ldots} + 1} \approx 0.5671431650\mathclose{\text{。}} x 2 = e 0.566311 … + 1 1.566311 … ≈ 0.5671431650 。 误差大约为 0.067,0.00083 和 1.3 × 10 − 7 , 1.3 \times 10^{-7}\mathclose{\text{,}} 1.3 × 1 0 − 7 , 因此 x 0 , x_0\mathclose{\text{,}} x 0 , x 1 x_1 x 1 和 x 2 x_2 x 2 分别精确到 0,2 和 6 位小数; x 3 x_3 x 3 精确到 14 位, x 4 x_4 x 4 精确到 29 位。模式 0,2,6,14,29 是定理 7.3 的两倍。
练习 7.10 ★★★ 平方根的倒数
必须避免除法的程序计算 1 / a , 1/\sqrt a\mathclose{\text{,}} 1/ a , 对于 a > 0 , a > 0\mathclose{\text{,}} a > 0 , 作为 g ( y ) = 1 y 2 − a g(y) = \dfrac{1}{y^2} - a g ( y ) = y 2 1 − a 的正根。
(a) 证明牛顿法用于 g g g 的迭代步 y n + 1 = 1 2 y n ( 3 − a y n 2 ) , y_{n+1} = \tfrac12 y_n\big(3 - ay_n^2\big)\mathclose{\text{,}} y n + 1 = 2 1 y n ( 3 − a y n 2 ) , 无需进行除法运算。
(b) 将 y n = ( 1 + ε n ) / a y_n = (1 + \varepsilon_n)/\sqrt a y n = ( 1 + ε n ) / a 表示为 ∣ ε n ∣ \abs{\varepsilon_n} ∣ ε n ∣ 是 y n y_n y n 的相对误差。证明 ε n + 1 = − 1 2 ε n 2 ( 3 + ε n ) 。 \varepsilon_{n+1} = -\tfrac12\varepsilon_n^2(3 + \varepsilon_n)\mathclose{\text{。}} ε n + 1 = − 2 1 ε n 2 ( 3 + ε n ) 。
(c) 若 ∣ ε 0 ∣ ≤ 0.01 , \abs{\varepsilon_0} \le 0.01\mathclose{\text{,}} ∣ ε 0 ∣ ≤ 0.01 , 需要多少步才能使相对误差小于 10 − 15 ? 10^{-15}\mathclose{\text{?}} 1 0 − 15 ?
查看解答✓ 已检验
(a) g ( y ) = y − 2 − a , g(y) = y^{-2} - a\mathclose{\text{,}} g ( y ) = y − 2 − a , 因此 g ′ ( y ) = − 2 y − 3 。 g'(y) = -2y^{-3}\mathclose{\text{。}} g ′ ( y ) = − 2 y − 3 。 然后
y − g ( y ) g ′ ( y ) = y − y − 2 − a − 2 y − 3 = y + y 3 ( y − 2 − a ) 2 = y + y − a y 3 2 = 3 y − a y 3 2 = 1 2 y ( 3 − a y 2 ) . \begin{aligned} y - \frac{g(y)}{g'(y)} &= y - \frac{y^{-2} - a}{-2y^{-3}} \\ &= y + \frac{y^3\big(y^{-2} - a\big)}{2} \\ &= y + \frac{y - ay^3}{2} \\ &= \frac{3y - ay^3}{2} \\ &= \frac12 y\big(3 - ay^2\big). \end{aligned} y − g ′ ( y ) g ( y ) = y − − 2 y − 3 y − 2 − a = y + 2 y 3 ( y − 2 − a ) = y + 2 y − a y 3 = 2 3 y − a y 3 = 2 1 y ( 3 − a y 2 ) .
该步骤仅使用乘法、一次减法和一次除以二的操作,在二进制中是精确且高效的。
(b) 用 y n = ( 1 + ε n ) / a , y_n = (1 + \varepsilon_n)/\sqrt a\mathclose{\text{,}} y n = ( 1 + ε n ) / a , 则 a y n 2 = ( 1 + ε n ) 2 , ay_n^2 = (1 + \varepsilon_n)^2\mathclose{\text{,}} a y n 2 = ( 1 + ε n ) 2 , 因此
y n + 1 = 1 + ε n 2 a ( 3 − ( 1 + ε n ) 2 ) = ( 1 + ε n ) ( 2 − 2 ε n − ε n 2 ) 2 a . \begin{aligned} y_{n+1} &= \frac{1 + \varepsilon_n}{2\sqrt a}\big(3 - (1 + \varepsilon_n)^2\big) \\ &= \frac{(1 + \varepsilon_n)\big(2 - 2\varepsilon_n - \varepsilon_n^2\big)}{2\sqrt a}. \end{aligned} y n + 1 = 2 a 1 + ε n ( 3 − ( 1 + ε n ) 2 ) = 2 a ( 1 + ε n ) ( 2 − 2 ε n − ε n 2 ) .
展开后,得到 ( 1 + ε ) ( 2 − 2 ε − ε 2 ) = 2 − 3 ε 2 − ε 3 , (1 + \varepsilon)(2 - 2\varepsilon - \varepsilon^2) = 2 - 3\varepsilon^2 - \varepsilon^3\mathclose{\text{,}} ( 1 + ε ) ( 2 − 2 ε − ε 2 ) = 2 − 3 ε 2 − ε 3 , 因此
y n + 1 = 1 − 3 2 ε n 2 − 1 2 ε n 3 a , y_{n+1} = \frac{1 - \tfrac32\varepsilon_n^2 - \tfrac12\varepsilon_n^3}{\sqrt a}, y n + 1 = a 1 − 2 3 ε n 2 − 2 1 ε n 3 ,
即 ε n + 1 = − 3 2 ε n 2 − 1 2 ε n 3 = − 1 2 ε n 2 ( 3 + ε n ) : \varepsilon_{n+1} = -\tfrac32\varepsilon_n^2 - \tfrac12\varepsilon_n^3 = -\tfrac12\varepsilon_n^2(3 + \varepsilon_n)\mathclose{\text{:}} ε n + 1 = − 2 3 ε n 2 − 2 1 ε n 3 = − 2 1 ε n 2 ( 3 + ε n ) : 二次收敛性再次成立。
(c) 虽然 ∣ ε n ∣ ≤ 0.01 , \abs{\varepsilon_n} \le 0.01\mathclose{\text{,}} ∣ ε n ∣ ≤ 0.01 , 但 ∣ ε n + 1 ∣ ≤ 1 2 ε n 2 ⋅ 3.01 。 \abs{\varepsilon_{n+1}} \le \tfrac12\varepsilon_n^2 \cdot 3.01\mathclose{\text{。}} ∣ ε n + 1 ∣ ≤ 2 1 ε n 2 ⋅ 3.01 。 由 ∣ ε 0 ∣ ≤ 0.01 \abs{\varepsilon_0} \le 0.01 ∣ ε 0 ∣ ≤ 0.01 可得,每个上界向上取整后,得到 ∣ ε 1 ∣ ≤ 1.51 × 10 − 4 , \abs{\varepsilon_1} \le 1.51 \times 10^{-4}\mathclose{\text{,}} ∣ ε 1 ∣ ≤ 1.51 × 1 0 − 4 , ∣ ε 2 ∣ ≤ 3.41 × 10 − 8 , \abs{\varepsilon_2} \le 3.41 \times 10^{-8}\mathclose{\text{,}} ∣ ε 2 ∣ ≤ 3.41 × 1 0 − 8 , ∣ ε 3 ∣ ≤ 1.75 × 10 − 15 \abs{\varepsilon_3} \le 1.75 \times 10^{-15} ∣ ε 3 ∣ ≤ 1.75 × 1 0 − 15 和 ∣ ε 4 ∣ ≤ 4.61 × 10 − 30 ; \abs{\varepsilon_4} \le 4.61 \times 10^{-30}\mathclose{\text{;}} ∣ ε 4 ∣ ≤ 4.61 × 1 0 − 30 ; 所有值均小于 0.01,因此在每一步该不等式均成立。根据此上界,三步还不够;四步足够。
练习 7.11 ★★★ “最终”何时成立?
(a) 证明 lim x → ∞ ( ln x ) 10 x 0.1 = 0 。 \displaystyle\lim_{x\to\infty}\frac{(\ln x)^{10}}{x^{0.1}} = 0\mathclose{\text{。}} x → ∞ lim x 0.1 ( ln x ) 10 = 0 。
(b) 证明,尽管如此, ( ln x ) 10 (\ln x)^{10} ( ln x ) 10 在 x = 10 100 x = 10^{100} x = 1 0 100 处比 x 0.1 x^{0.1} x 0.1 大得多。
(c) 用 u = ln x , u = \ln x\mathclose{\text{,}} u = ln x , 两个函数在 10 ln u = 0.1 u 10\ln u = 0.1u 10 ln u = 0.1 u 处相等,即 g ( u ) = u − 100 ln u g(u) = u - 100\ln u g ( u ) = u − 100 ln u 为 0 处。从 u 0 = 600 u_0 = 600 u 0 = 600 使用牛顿法求出 5 位小数的解,并将对应的 x x x 写成 10 的幂。
查看解答✓ 已检验
(a) 将商写成十分幂:
( ln x ) 10 x 0.1 = ( ln x x 0.01 ) 10 . \frac{(\ln x)^{10}}{x^{0.1}} = \Big(\frac{\ln x}{x^{0.01}}\Big)^{10}. x 0.1 ( ln x ) 10 = ( x 0.01 ln x ) 10 .
根据定理 7.6 与 p = 0.01 , p = 0.01\mathclose{\text{,}} p = 0.01 , 括号中的商趋近于 0,且 t ↦ t 10 t \mapsto t^{10} t ↦ t 10 连续,因此十分幂趋近于 0 10 = 0 。 0^{10} = 0\mathclose{\text{。}} 0 10 = 0 。
(b) 在 x = 10 100 x = 10^{100} x = 1 0 100 处, ln x = 100 ln 10 ≈ 230.26 , \ln x = 100\ln 10 \approx 230.26\mathclose{\text{,}} ln x = 100 ln 10 ≈ 230.26 , 因此 ( ln x ) 10 ≈ 4.19 × 10 23 , (\ln x)^{10} \approx 4.19 \times 10^{23}\mathclose{\text{,}} ( ln x ) 10 ≈ 4.19 × 1 0 23 , 而 x 0.1 = 10 10 。 x^{0.1} = 10^{10}\mathclose{\text{。}} x 0.1 = 1 0 10 。 对数的幂仍然比 10 13 10^{13} 1 0 13 大得多。
(c) g ′ ( u ) = 1 − 100 / u , g'(u) = 1 - 100/u\mathclose{\text{,}} g ′ ( u ) = 1 − 100/ u , 因此步长为 u n + 1 = u n − u n − 100 ln u n 1 − 100 / u n 。 u_{n+1} = u_n - \dfrac{u_n - 100\ln u_n}{1 - 100/u_n}\mathclose{\text{。}} u n + 1 = u n − 1 − 100/ u n u n − 100 ln u n 。 从 u 0 = 600 : u_0 = 600\mathclose{\text{:}} u 0 = 600 : u 1 ≈ 647.63156 , u_1 \approx 647.63156\mathclose{\text{,}} u 1 ≈ 647.63156 , u 2 ≈ 647.27753 , u_2 \approx 647.27753\mathclose{\text{,}} u 2 ≈ 647.27753 , u 3 ≈ 647.27751 , u_3 \approx 647.27751\mathclose{\text{,}} u 3 ≈ 647.27751 , 且 u 4 u_4 u 4 与 u 3 u_3 u 3 在更多小数位上一致。因此 u ≈ 647.27751 , u \approx 647.27751\mathclose{\text{,}} u ≈ 647.27751 , 且
x = e 647.27751 = 10 647.27751 / ln 10 ≈ 10 281.1 . \begin{aligned} x = e^{647.27751} &= 10^{647.27751/\ln 10} \\ &\approx 10^{281.1}. \end{aligned} x = e 647.27751 = 1 0 647.27751/ l n 10 ≈ 1 0 281.1 .
所以 ( ln x ) 10 (\ln x)^{10} ( ln x ) 10 保持领先于 x 0.1 x^{0.1} x 0.1 直到大约 x = 10 281 。 x = 10^{281}\mathclose{\text{。}} x = 1 0 281 。 (模块 8 的工具显示 g g g 在 u > 100 u > 100 u > 100 上增加,因此在此点之后 x 0.1 x^{0.1} x 0.1 会保持领先。)
练习 7.12 ★★★ 条件数
假设 x x x 已知,其相对误差为 ρ \rho ρ (希腊字母 “rho”),并且 y = f ( x ) y = f(x) y = f ( x ) 是由此计算得到的。
(a) 使用微分来证明 y y y 的相对误差大约为 κ ( x ) ρ , \kappa(x)\,\rho\mathclose{\text{,}} κ ( x ) ρ , 其中 κ ( x ) = ∣ x f ′ ( x ) f ( x ) ∣ \kappa(x) = \abs{\dfrac{x f'(x)}{f(x)}} κ ( x ) = f ( x ) x f ′ ( x ) (希腊字母 “kappa”)是 f f f 在 x x x 处的 条件数 。
(b) 求 x k 、 x^k\mathclose{\text{、}} x k 、 e x 、 e^x\mathclose{\text{、}} e x 、 ln x \ln x ln x 和 x − 1 x - 1 x − 1 的条件数。
(c) 一台计算机以相对误差约为 10 − 16 10^{-16} 1 0 − 16 的精度存储 x = 1 + 10 − 8 。 x = 1 + 10^{-8}\mathclose{\text{。}} x = 1 + 1 0 − 8 。 由此计算得到的 ln x \ln x ln x 的相对误差大约有多大?解释第 7.6 节末尾计算框中 ( 1 + 1 / n ) n (1 + 1/n)^n ( 1 + 1/ n ) n 的结果。
查看解答✓ 已检验
(a) 如果 x x x 的误差为 d x , dx\mathclose{\text{,}} d x , 那么 y y y 的误差大约为 d y = f ′ ( x ) d x , dy = f'(x)\,dx\mathclose{\text{,}} d y = f ′ ( x ) d x , 因此 y y y 的相对误差大约为
∣ d y y ∣ = ∣ f ′ ( x ) d x f ( x ) ∣ = ∣ x f ′ ( x ) f ( x ) ∣ ⋅ ∣ d x x ∣ = κ ( x ) ρ . \begin{aligned} \abs{\frac{dy}{y}} &= \abs{\frac{f'(x)\,dx}{f(x)}} \\ &= \abs{\frac{xf'(x)}{f(x)}}\cdot\abs{\frac{dx}{x}} \\ &= \kappa(x)\,\rho. \end{aligned} y d y = f ( x ) f ′ ( x ) d x = f ( x ) x f ′ ( x ) ⋅ x d x = κ ( x ) ρ .
(b) 对于 x k : x^k\mathclose{\text{:}} x k : ∣ x ⋅ k x k − 1 x k ∣ = ∣ k ∣ , \abs{\dfrac{x \cdot kx^{k-1}}{x^k}} = \abs{k}\mathclose{\text{,}} x k x ⋅ k x k − 1 = ∣ k ∣ , 参见第 7.3 节的规则。对于 e x : e^x\mathclose{\text{:}} e x : ∣ x e x e x ∣ = ∣ x ∣ 。 \abs{\dfrac{xe^x}{e^x}} = \abs{x}\mathclose{\text{。}} e x x e x = ∣ x ∣ 。 对于 ln x : \ln x\mathclose{\text{:}} ln x : ∣ x ⋅ ( 1 / x ) ln x ∣ = 1 ∣ ln x ∣ 。 \abs{\dfrac{x \cdot (1/x)}{\ln x}} = \dfrac{1}{\abs{\ln x}}\mathclose{\text{。}} ln x x ⋅ ( 1/ x ) = ∣ ln x ∣ 1 。 对于 x − 1 : x - 1\mathclose{\text{:}} x − 1 : ∣ x x − 1 ∣ 。 \abs{\dfrac{x}{x - 1}}\mathclose{\text{。}} x − 1 x 。
(c) 对于 ln x \ln x ln x 在 x = 1 + 10 − 8 x = 1 + 10^{-8} x = 1 + 1 0 − 8 处,ln x ≈ 10 − 8 \ln x \approx 10^{-8} ln x ≈ 1 0 − 8 (练习 7.2 的线性近似 ln x ≈ x − 1 ), \ln x \approx x - 1\mathclose{\text{),}} ln x ≈ x − 1 ), 因此 κ ≈ 10 8 , \kappa \approx 10^8\mathclose{\text{,}} κ ≈ 1 0 8 , 且 ln x \ln x ln x 的相对误差约为 10 8 × 10 − 16 = 10 − 8 : 10^8 \times 10^{-16} = 10^{-8}\mathclose{\text{:}} 1 0 8 × 1 0 − 16 = 1 0 − 8 : 大约损失了 16 位数字的一半。ln x \ln x ln x 和 x − 1 x - 1 x − 1 在接近 1 处都严重病态,这就是为什么 math.log1p(u) 采用的是小数 u u u 本身,而不是 1 + u 。 1 + u\mathclose{\text{。}} 1 + u 。 在计算框中,( 1 + 1 / n ) n = u n (1 + 1/n)^n = u^n ( 1 + 1/ n ) n = u n 与 u = 1 + 1 / n u = 1 + 1/n u = 1 + 1/ n 相乘,u n u^n u n 的条件数为 n : n\mathclose{\text{:}} n : 存储 u u u 时相对误差约为 10 − 16 , 10^{-16}\mathclose{\text{,}} 1 0 − 16 , 会增长到约 n × 10 − 16 , n \times 10^{-16}\mathclose{\text{,}} n × 1 0 − 16 , 这相当于 10 − 4 10^{-4} 1 0 − 4 对于 n = 10 12 n = 10^{12} n = 1 0 12 (计算值相对于 e e e 的相对误差约为 9 × 10 − 5 ) 9 \times 10^{-5}\mathclose{\text{)}} 9 × 1 0 − 5 ) 以及约 0.1 0.1 0.1 对于 n = 10 15 n = 10^{15} n = 1 0 15 (相对误差约为 12%)。
1 圆的半径以 2 cm/s 的速度增长。当半径为 5 cm 时,面积增长的速度是多少?
20 π 20\pi 20 π cm²/s10 π 10\pi 10 π cm²/s4 π 4\pi 4 π cm²/s25 π 25\pi 25 π cm²/sA = π r 2 , A = \pi r^2\mathclose{\text{,}} A = π r 2 , 所以
d A / d t = 2 π r d r / d t = 2 π ⋅ 5 ⋅ 2 = 20 π . dA/dt = 2\pi r\,dr/dt = 2\pi \cdot 5 \cdot 2 = 20\pi\mathclose{\text{.}} d A / d t = 2 π r d r / d t = 2 π ⋅ 5 ⋅ 2 = 20 π . 10 π 10\pi 10 π 是
d A / d r dA/dr d A / d r 在
r = 5 r = 5 r = 5 处,没有因子
d r / d t = 2 ; dr/dt = 2\mathclose{\text{;}} d r / d t = 2 ; 4 π 4\pi 4 π 忽略了
r ; r\mathclose{\text{;}} r ; 25 π 25\pi 25 π 是面积本身,不是其变化率。
2 使用
x \sqrt x x 在 9 处的线性近似,
9.6 \sqrt{9.6} 9.6 约为
3.2 3.2 3.2 3.6 3.6 3.6 3.1 3.1 3.1 3.05 3.05 3.05 f ′ ( 9 ) = 1 2 9 = 1 6 , f'(9) = \dfrac{1}{2\sqrt9} = \dfrac16\mathclose{\text{,}} f ′ ( 9 ) = 2 9 1 = 6 1 , 所以
L ( x ) = 3 + x − 9 6 L(x) = 3 + \dfrac{x - 9}{6} L ( x ) = 3 + 6 x − 9 和
L ( 9.6 ) = 3 + 0.1 = 3.1 L(9.6) = 3 + 0.1 = 3.1 L ( 9.6 ) = 3 + 0.1 = 3.1 (真实值为
3.098 … ). 3.098\ldots\mathclose{\text{).}} 3.098 … ). 3.2 3.2 3.2 使用斜率
1 3 , \tfrac13\mathclose{\text{,}} 3 1 , 忘记
1 2 x \dfrac{1}{2\sqrt x} 2 x 1 中的 2;
3.6 3.6 3.6 使用斜率 1;
3.05 3.05 3.05 使用斜率
1 12 . \tfrac{1}{12}\mathclose{\text{.}} 12 1 .
3 球体的半径测量相对误差最多为 1%。计算出的表面积
4 π r 2 4\pi r^2 4 π r 2 的相对误差约为
1 % 1\% 1% 2 % 2\% 2% 3 % 3\% 3% 4 % 4\% 4% 对于
S = c r 2 , S = cr^2\mathclose{\text{,}} S = c r 2 , d S / S = 2 d r / r : dS/S = 2\,dr/r\mathclose{\text{:}} d S / S = 2 d r / r : 相对误差加倍,为 2%. 3% 是立方体体积的相对误差;常数
4 π 4\pi 4 π 不改变相对误差,因此 4% 是错误的;1% 忽略了幂次。
4 牛顿法对
f ( x ) = x 2 − 5 f(x) = x^2 - 5 f ( x ) = x 2 − 5 从
x 0 = 2 x_0 = 2 x 0 = 2 的一步计算得到
1.75 1.75 1.75 2.5 2.5 2.5 2.236 2.236 2.236 2.25 2.25 2.25 x 1 = 2 − f ( 2 ) f ′ ( 2 ) = 2 − − 1 4 = 2.25 . x_1 = 2 - \dfrac{f(2)}{f'(2)} = 2 - \dfrac{-1}{4} = 2.25\mathclose{\text{.}} x 1 = 2 − f ′ ( 2 ) f ( 2 ) = 2 − 4 − 1 = 2.25 . 1.75 1.75 1.75 是由于符号错误(
f ( 2 ) = − 1 f(2) = -1 f ( 2 ) = − 1 为负数)导致的;
2.5 2.5 2.5 除以
x 0 x_0 x 0 而不是
f ′ ( x 0 ) = 2 x 0 ; f'(x_0) = 2x_0\mathclose{\text{;}} f ′ ( x 0 ) = 2 x 0 ; 2.236 ≈ 5 2.236 \approx \sqrt5 2.236 ≈ 5 是根本身,而迭代过程只是逐渐趋近于它。
5 牛顿法对
f ( x ) = x 3 f(x) = \sqrt[3]{x} f ( x ) = 3 x 从
x 0 = 1 x_0 = 1 x 0 = 1 产生
− 2 , 4 , − 8 , … : -2, 4, -8, \dots\mathclose{\text{:}} − 2 , 4 , − 8 , … : 迭代远离根 0一步后得到根 0 错误,因为 f ′ ( 1 ) = 0 f'(1) = 0 f ′ ( 1 ) = 0 接近 0 的缓慢迭代 每一步得到
x n + 1 = − 2 x n x_{n+1} = -2x_n x n + 1 = − 2 x n (例 7.11)。
f ′ ( 1 ) = 1 3 , f'(1) = \tfrac13\mathclose{\text{,}} f ′ ( 1 ) = 3 1 , 而非 0;问题出在根处,那里
f ′ ( 0 ) f'(0) f ′ ( 0 ) 不存在且图像有垂直切线。
6 lim x → 0 x + 1 x + 2 \displaystyle\lim_{x\to0}\frac{x + 1}{x + 2} x → 0 lim x + 2 x + 1 等于
1 1 1 0 0 0 1 2 \dfrac12 2 1 它不存在 形式不是不定式:代入
x = 0 x = 0 x = 0 得到
1 2 。 \tfrac12\mathclose{\text{。}} 2 1 。 不管怎样应用洛必达法则得到
1 1 = 1 , \tfrac11 = 1\mathclose{\text{,}} 1 1 = 1 , 这是错误的:法则需要
0 / 0 0/0 0/0 或
∞ / ∞ 。 \infty/\infty\mathclose{\text{。}} ∞/∞ 。
7 lim x → ∞ ( 1 + 3 x ) x \displaystyle\lim_{x\to\infty}\Big(1 + \frac{3}{x}\Big)^x x → ∞ lim ( 1 + x 3 ) x 等于
1 1 1 e e e 3 3 3 e 3 e^3 e 3 例7.17中使用
a = 3 , a = 3\mathclose{\text{,}} a = 3 , 极限是
e 3 。 e^3\mathclose{\text{。}} e 3 。 答案1将形式
1 ∞ 1^\infty 1 ∞ 视为1;
e e e 是
a = 1 a = 1 a = 1 的情况;3是自然对数的极限
x ln ( 1 + 3 / x ) → 3 , x\ln(1 + 3/x) \to 3\mathclose{\text{,}} x ln ( 1 + 3/ x ) → 3 , 不包含最后一步
y = e ln y 。 y = e^{\ln y}\mathclose{\text{。}} y = e l n y 。
8 哪个函数在
x → ∞ x \to \infty x → ∞ 时增长最快?
x 100 x^{100} x 100 1.01 x 1.01^x 1.0 1 x ( ln x ) 100 (\ln x)^{100} ( ln x ) 100 x 100 ln x x^{100}\ln x x 100 ln x 任何
x x x 的幂函数都会被大于1的指数函数超越(定理7.7):
x 100 / 1.01 x → 0 , x^{100}/1.01^x \to 0\mathclose{\text{,}} x 100 /1.0 1 x → 0 , 且
x 100 ln x ≤ x 101 x^{100}\ln x \le x^{101} x 100 ln x ≤ x 101 对于
x ≥ 1 , x \ge 1\mathclose{\text{,}} x ≥ 1 , 因此它也会被超越。
( ln x ) 100 (\ln x)^{100} ( ln x ) 100 增长速度慢于
x 100 x^{100} x 100 (第7.7节的关键思想)。指数函数只有在
x x x 非常大时才会超越幂函数。
重新作答