数值分析 周维祺
导数:f′(x)=limΔx→0f(x+Δx)−f(x)Δxf'(x)=\lim\limits_{\Delta x\to 0}\frac{f(x+\Delta x)-f(x)}{\Delta x}f′(x)=Δx→0limΔxf(x+Δx)−f(x)
给定h>0h>0h>0,差分: 前向:D~f(x)=f(x+h)−f(x)h\tilde Df(x)=\frac{f(x+h)-f(x)}{h}\quadD~f(x)=hf(x+h)−f(x) 后向:D~f(x)=f(x)−f(x−h)h\tilde Df(x)=\frac{f(x)-f(x-h)}{h}D~f(x)=hf(x)−f(x−h) 中心:D~f(x)=f(x+h)−f(x−h)2h\tilde Df(x)=\frac{f(x+h)-f(x-h)}{2h}D~f(x)=2hf(x+h)−f(x−h)
验证若fff在xxx处可导,则h→0h\to0h→0时,上述三种差分均收敛于f′(x)f'(x)f′(x)
设fff足够光滑,将fff泰勒展开: f(x+h)=f(x)+f′(x)h+f′′(ξ)2h2,ξ∈[x,x+h]f(x+h)=f(x)+f'(x)h+\frac{f''(\xi)}{2}h^2, \quad \xi\in[x,x+h]f(x+h)=f(x)+f′(x)h+2f′′(ξ)h2,ξ∈[x,x+h]
∣f(x+h)−f(x)h−f′(x)∣=∣f′′(ξ)2h∣∼O(h)|\frac{f(x+h)-f(x)}{h}-f'(x)|=|\frac{f''(\xi)}{2}h|\sim O(h)∣hf(x+h)−f(x)−f′(x)∣=∣2f′′(ξ)h∣∼O(h)
误差随步长线性减少
f(x+h)=f(x)+f′(x)h+f′′(x)2h2+f′′′(ξ1)6h3f(x+h)=f(x)+f'(x)h+\frac{f''(x)}{2}h^2+\frac{f'''(\xi_1)}{6}h^3f(x+h)=f(x)+f′(x)h+2f′′(x)h2+6f′′′(ξ1)h3
f(x−h)=f(x)−f′(x)h+f′′(x)2h2−f′′′(ξ2)6h3f(x-h)=f(x)-f'(x)h+\frac{f''(x)}{2}h^2-\frac{f'''(\xi_2)}{6}h^3f(x−h)=f(x)−f′(x)h+2f′′(x)h2−6f′′′(ξ2)h3
∣f(x+h)−f(x−h)2h−f′(x)∣=∣f′′′(ξ1)+f′′′(ξ2)12h2∣∼O(h2)|\frac{f(x+h)-f(x-h)}{2h}-f'(x)|=|\frac{f'''(\xi_1)+f'''(\xi_2)}{12}h^2|\sim O(h^2)∣2hf(x+h)−f(x−h)−f′(x)∣=∣12f′′′(ξ1)+f′′′(ξ2)h2∣∼O(h2)
误差随步长平方减少
f′′(x)≈f′(x+h2)−f′(x−h2)2⋅h2=f′(x+h2)−f′(x−h2)hf''(x)\approx \frac{f'(x+\frac{h}{2})-f'(x-\frac{h}{2})}{2\cdot\frac{h}{2}}=\frac{f'(x+\frac{h}{2})-f'(x-\frac{h}{2})}{h}\quadf′′(x)≈2⋅2hf′(x+2h)−f′(x−2h)=hf′(x+2h)−f′(x−2h) (中心差分)
f′(x+h2)≈f(x+h2+h2)−f(x+h2−h2)2⋅h2=f(x+h)−f(x)hf'(x+\frac{h}{2})\approx\frac{f(x+\frac{h}{2}+\frac{h}{2})-f(x+\frac{h}{2}-\frac{h}{2})}{2\cdot\frac{h}{2}}=\frac{f(x+h)-f(x)}{h}\quadf′(x+2h)≈2⋅2hf(x+2h+2h)−f(x+2h−2h)=hf(x+h)−f(x) (中心差分)
f′(x−h2)≈f(x−h2+h2)−f(x−h2−h2)2⋅h2=f(x)−f(x−h)hf'(x-\frac{h}{2})\approx\frac{f(x-\frac{h}{2}+\frac{h}{2})-f(x-\frac{h}{2}-\frac{h}{2})}{2\cdot\frac{h}{2}}=\frac{f(x)-f(x-h)}{h}\quadf′(x−2h)≈2⋅2hf(x−2h+2h)−f(x−2h−2h)=hf(x)−f(x−h) (中心差分)
f′′(x)≈f(x+h)−f(x)h−f(x)−f(x−h)hh=f(x+h)−2f(x)+f(x−h)h2f''(x)\approx\frac{\frac{f(x+h)-f(x)}{h}-\frac{f(x)-f(x-h)}{h}}{h}=\frac{f(x+h)-2f(x)+f(x-h)}{h^2}f′′(x)≈hhf(x+h)−f(x)−hf(x)−f(x−h)=h2f(x+h)−2f(x)+f(x−h)
仿照一阶差分误差的推导方法,利用泰勒展开,推导二阶差分的误差
f(x+h)=f(x)+f′(x)h+f′′(x)2h2+f(3)(x)6h3+f(4)(ξ1)24h4f(x+h)=f(x)+f'(x)h+\frac{f''(x)}{2}h^2+\frac{f^{(3)}(x)}{6}h^3+\frac{f^{(4)}(\xi_1)}{24}h^4f(x+h)=f(x)+f′(x)h+2f′′(x)h2+6f(3)(x)h3+24f(4)(ξ1)h4
f(x−h)=f(x)−f′(x)h+f′′(x)2h2−f(3)(x)6h3+f(4)(ξ2)24h4f(x-h)=f(x)-f'(x)h+\frac{f''(x)}{2}h^2-\frac{f^{(3)}(x)}{6}h^3+\frac{f^{(4)}(\xi_2)}{24}h^4f(x−h)=f(x)−f′(x)h+2f′′(x)h2−6f(3)(x)h3+24f(4)(ξ2)h4
∣f(x+h)−2f(x)+f(x−h)h2−f′′(x)∣=∣f(4)(ξ1)+f(4)(ξ2)24h2∣∼O(h2)|\frac{f(x+h)-2f(x)+f(x-h)}{h^2}-f''(x)|=|\frac{f^{(4)}(\xi_1)+f^{(4)}(\xi_2)}{24}h^2|\sim O(h^2)∣h2f(x+h)−2f(x)+f(x−h)−f′′(x)∣=∣24f(4)(ξ1)+f(4)(ξ2)h2∣∼O(h2)
拓展阅读:外插法
数值微分的一般形式 D~f=∑kckf(xk)\tilde Df=\sum\limits_k c_kf(x_k)D~f=k∑ckf(xk)
思考:先用插值法得p(x)p(x)p(x)作为f(x)f(x)f(x)的近似,再用p′(x)p'(x)p′(x)作为f′(x)f'(x)f′(x)的近似,是不是一个好方法?
积分是有界运算: ∣∫abf(x)−p(x)dx∣≤∥f−p∥(b−a)|\int_a^bf(x)-p(x)dx|\le\|f-p\|(b-a)∣∫abf(x)−p(x)dx∣≤∥f−p∥(b−a)
若f(x)f(x)f(x)与p(x)p(x)p(x)的差异有界,则其积分的差异也有界
微分是无界运算,即使f(x)f(x)f(x)与p(x)p(x)p(x)的差异有界,其微分的差异仍可以为无穷大。例:f(x)−g(x)=2xf(x)-g(x)=2\sqrt xf(x)−g(x)=2x,在(0,1)(0,1)(0,1)上有界,但f′(x)−g′(x)=1/xf'(x)-g'(x)=1/\sqrt{x}f′(x)−g′(x)=1/x,在(0,1)(0,1)(0,1)上无界