其他分享
首页 > 其他分享> > 数值分析复习(五)——数值积分和数值微分

数值分析复习(五)——数值积分和数值微分

作者:互联网

五、数值积分和数值微分

基本概念

一般的数值积分公式为:
∫ a b f ( x ) d x ≈ ∑ k = 0 n A k f ( x k ) \int_a^b f(x)dx \approx \sum_{k=0}^n A_kf(x_k) ∫ab​f(x)dx≈k=0∑n​Ak​f(xk​)
其中称 x k x_k xk​ 为求积点, A k A_k Ak​ 为求积系数,记
I ( f ) = ∫ a b f ( x ) d x , I n ( f ) = ∑ k = 0 n A k f ( x k ) I(f)=\int_a^bf(x)dx,\quad I_n(f)=\sum_{k=0}^n A_kf(x_k) I(f)=∫ab​f(x)dx,In​(f)=k=0∑n​Ak​f(xk​)
则求积公式的截断误差为
R ( f ) = I ( f ) − I n ( f ) R(f) = I(f) - I_n(f) R(f)=I(f)−In​(f)

插值型求积公式

给定节点 a ≤ x 0 < x 1 < . . . < x n ≤ b a \le x_0 \lt x_1 \lt ... \lt x_n \le b a≤x0​<x1​<...<xn​≤b,已知 f ( x ) f(x) f(x) 在这些点上的函数值为 f ( x i ) ,   ( i = 0 , 1 , . . . , n ) f(x_i),\ (i=0,1,...,n) f(xi​), (i=0,1,...,n)。由插值理论, f ( x ) f(x) f(x) 的 n 次插值多项式为:
L n ( x ) = ∑ k = 0 n f ( x k ) l k ( x ) = ∑ k = 0 n f ( x k ) ∏ j = 0 , j ≠ k n x − x j x k − x j I ( f ) = ∫ a b f ( x ) d x ≈ ∫ a b L n ( x ) d x = ∑ k = 0 n [ ∫ a b l k ( x ) d x ] f ( x k ) = ∑ k = 0 n A k f ( x k ) \begin{aligned} L_n(x) &= \sum_{k=0}^nf(x_k)l_k(x) = \sum_{k=0}^nf(x_k)\prod_{j=0,j\ne k}^n \frac{x-x_j}{x_k-x_j} \\ I(f) &= \int_a^bf(x)dx \approx \int_a^b L_n(x)dx = \sum_{k=0}^n [\int_a^bl_k(x)dx]f(x_k) = \sum_{k=0}^n A_kf(x_k) \end{aligned} Ln​(x)I(f)​=k=0∑n​f(xk​)lk​(x)=k=0∑n​f(xk​)j=0,j​=k∏n​xk​−xj​x−xj​​=∫ab​f(x)dx≈∫ab​Ln​(x)dx=k=0∑n​[∫ab​lk​(x)dx]f(xk​)=k=0∑n​Ak​f(xk​)​
其中, A k = ∫ a b l k ( x ) d x A_k = \int_a^bl_k(x)dx Ak​=∫ab​lk​(x)dx。记 I n ( f ) = ∑ k = 0 n A k f ( x k ) I_n(f) = \sum_{k=0}^nA_kf(x_k) In​(f)=∑k=0n​Ak​f(xk​),则 I ( f ) ≈ I n ( f ) I(f) \approx I_n(f) I(f)≈In​(f)

R ( f ) = ∫ a b f ( n + 1 ) ( ξ ) ( n + 1 ) ! ∏ i = 0 n ( x − x i ) d x ,   ξ ∈ ( a , b ) R(f) = \int_a^b\frac{f^{(n+1)}(\xi)}{(n+1)!}\prod_{i=0}^n(x-x_i)dx, \ \xi \in (a, b) R(f)=∫ab​(n+1)!f(n+1)(ξ)​i=0∏n​(x−xi​)dx, ξ∈(a,b)

Newton-Cotes 公式

令 x = a + t h , t ∈ [ 0 , n ] x=a+th,t\in[0,n] x=a+th,t∈[0,n],则 x k = a + k h , x j = a + j h x_k = a+kh,x_j=a+jh xk​=a+kh,xj​=a+jh,
A k = ∫ a b l k ( x ) d x = ∫ a b ∏ j = 0 , j ≠ k n x − x j x k − x j d x = h ∫ 0 n ∏ j = 0 , j ≠ k n t − j k − j d t = ( − 1 ) n − k h k ! ( n − k ) ! ∫ 0 n ∏ j = 0 , j ≠ k n ( t − j ) d t = ( b − a ) ( − 1 ) n − k n × k ! ( n − k ) ! ∫ 0 n ∏ j = 0 , j ≠ k n ( t − j ) d t ,   k = 0 , 1 , . . . , n 记   C n , k = ( − 1 ) n − k n × k ! ( n − k ) ! ∫ 0 n ∏ j = 0 , j ≠ k n ( t − j ) d t ,   k = 0 , 1 , . . . , n 则   N e w t o n − C o t e s   公 式 可 写 为 I n ( f ) = ( b − a ) ∑ k = 0 n C n , k f ( x k ) ,   其 中   C n , k   只 依 赖 于 k 和 n \begin{aligned} A_k &= \int_a^bl_k(x)dx = \int_a^b\prod_{j=0,j\ne k}^n \frac{x-x_j}{x_k-x_j}dx = h\int_0^n\prod_{j=0,j \ne k}^n \frac{t-j}{k-j}dt \\ &=\frac{(-1)^{n-k}h}{k!(n-k)!}\int_0^n\prod_{j=0,j \ne k}^n(t-j)dt = (b-a)\frac{(-1)^{n-k}}{n\times k!(n-k)!}\int_0^n\prod_{j=0,j \ne k}^n(t-j)dt,\ k=0,1,...,n \\ 记\ C_{n,k}&=\frac{(-1)^{n-k}}{n\times k!(n-k)!}\int_0^n\prod_{j=0,j \ne k}^n(t-j)dt,\ k=0,1,...,n \qquad 则\ Newton-Cotes\ 公式可写为 \\ I_n(f) &= (b-a)\sum_{k=0}^nC_{n,k}f(x_k),\ 其中 \ C_{n,k}\ 只依赖于 k和n \end{aligned} Ak​记 Cn,k​In​(f)​=∫ab​lk​(x)dx=∫ab​j=0,j​=k∏n​xk​−xj​x−xj​​dx=h∫0n​j=0,j​=k∏n​k−jt−j​dt=k!(n−k)!(−1)n−kh​∫0n​j=0,j​=k∏n​(t−j)dt=(b−a)n×k!(n−k)!(−1)n−k​∫0n​j=0,j​=k∏n​(t−j)dt, k=0,1,...,n=n×k!(n−k)!(−1)n−k​∫0n​j=0,j​=k∏n​(t−j)dt, k=0,1,...,n则 Newton−Cotes 公式可写为=(b−a)k=0∑n​Cn,k​f(xk​), 其中 Cn,k​ 只依赖于k和n​

T ( f ) = b − a 2 [ f ( a ) + f ( b ) ] T(f)=\frac{b-a}{2}[f(a)+f(b)] T(f)=2b−a​[f(a)+f(b)]

R T ( f ) = I ( f ) − T ( f ) = ∫ a b f ′ ′ ( ξ ) 2 ( x − a ) ( x − b ) d x = f ′ ′ ( η ) 2 ∫ a b ( x − a ) ( x − b ) d x = − ( b − a ) 3 12 f ′ ′ ( η ) ,   η ∈ ( a , b ) \begin{aligned} R_T(f) &= I(f)-T(f)=\int_a^b\frac{f^{''}(\xi)}{2}(x-a)(x-b)dx \\ &=\frac{f^{''}(\eta)}{2}\int_a^b(x-a)(x-b)dx = -\frac{(b-a)^3}{12}f^{''}(\eta),\ \eta \in (a,b) \end{aligned} RT​(f)​=I(f)−T(f)=∫ab​2f′′(ξ)​(x−a)(x−b)dx=2f′′(η)​∫ab​(x−a)(x−b)dx=−12(b−a)3​f′′(η), η∈(a,b)​

S ( f ) = b − a 6 [ f ( a ) + 4 f ( a + b 2 ) + f ( b ) ] S(f) = \frac{b-a}{6}[f(a)+4f(\frac{a+b}{2})+f(b)] S(f)=6b−a​[f(a)+4f(2a+b​)+f(b)]

R S ( f ) = I ( f ) − S ( f ) = ∫ a b f ( x ) d x − ∫ a b H ( x ) d x = ∫ a b [ f ( x ) − H ( x ) ] d x = ∫ a b f ( 4 ) ( ξ ) 4 ( x − a ) ( x − a + b 2 ) 2 ( x − b ) d x = f ( 4 ) ( η ) 4 ∫ a b ( x − a ) ( x − a + b 2 ) 2 ( x − b ) d x = − b − a 180 ( b − a 2 ) 4 f ( 4 ) ( η ) ,   η ∈ ( a , b ) \begin{aligned} R_S(f) &= I(f) - S(f) = \int_a^bf(x)dx - \int_a^bH(x)dx = \int_a^b[f(x)-H(x)]dx \\ &= \int_a^b\frac{f^{(4)}(\xi)}{4}(x-a)(x-\frac{a+b}{2})^2(x-b)dx \\ &= \frac{f^{(4)}(\eta)}{4}\int_a^b(x-a)(x-\frac{a+b}{2})^2(x-b)dx \\ &= -\frac{b-a}{180}(\frac{b-a}{2})^4f^{(4)}(\eta),\ \eta \in (a,b) \end{aligned} RS​(f)​=I(f)−S(f)=∫ab​f(x)dx−∫ab​H(x)dx=∫ab​[f(x)−H(x)]dx=∫ab​4f(4)(ξ)​(x−a)(x−2a+b​)2(x−b)dx=4f(4)(η)​∫ab​(x−a)(x−2a+b​)2(x−b)dx=−180b−a​(2b−a​)4f(4)(η), η∈(a,b)​

C ( f ) = b − a 90 [ 7 f ( a ) + 32 f ( 3 a + b 4 ) + 12 f ( a + b 2 ) + 32 f ( a + 3 b 4 ) + 7 f ( b ) ] C(f) = \frac{b-a}{90}[7f(a)+32f(\frac{3a+b}{4})+12f(\frac{a+b}{2})+32f(\frac{a+3b}{4})+7f(b)] C(f)=90b−a​[7f(a)+32f(43a+b​)+12f(2a+b​)+32f(4a+3b​)+7f(b)]

R C ( f ) = I ( f ) − C ( f ) = − 2 ( b − a ) 945 ( b − a 4 ) 6 f ( 6 ) ( η ) ,   η ∈ ( a , b ) R_C(f) = I(f)-C(f) = -\frac{2(b-a)}{945}(\frac{b-a}{4})^6f^{(6)}(\eta),\ \eta \in (a, b) RC​(f)=I(f)−C(f)=−9452(b−a)​(4b−a​)6f(6)(η), η∈(a,b)

代数精度

复化求积公式

复化梯形公式

将区间 [ a , b ] [a, b] [a,b] 作 n n n 等分,记 h = b − a n , x k = a + k h , k = 0 , 1 , . . . , n h=\frac{b-a}{n},x_k = a+kh,k=0,1,...,n h=nb−a​,xk​=a+kh,k=0,1,...,n
I ( f ) = ∫ a b f ( x ) d x = ∑ k = 0 n − 1 ∫ x k x k + 1 f ( x ) d x I(f) = \int_a^bf(x)dx = \sum_{k=0}^{n-1}\int_{x_k}^{x_{k+1}}f(x)dx I(f)=∫ab​f(x)dx=k=0∑n−1​∫xk​xk+1​​f(x)dx
对小区间上的积分 ∫ x k x k + 1 f ( x ) d x \int_{x_k}^{x_{k+1}}f(x)dx ∫xk​xk+1​​f(x)dx 应用梯形公式即可得到复化梯形公式
T n ( f ) = ∑ k = 0 n − 1 h 2 [ f ( x k ) + f ( x k + 1 ) ] T_n(f) = \sum_{k=0}^{n-1}\frac{h}{2}[f(x_k)+f(x_{k+1})] Tn​(f)=k=0∑n−1​2h​[f(xk​)+f(xk+1​)]
其截断误差为
I ( f ) − T n ( f ) = ∑ k = 0 n − 1 ∫ x k x k + 1 f ( x ) d x − ∑ k = 0 n − 1 h 2 [ f ( x k ) + f ( x k + 1 ) ] = ∑ k = 0 n − 1 [ − h 3 12 f ′ ′ ( η k ) ] ,   η k ∈ [ x k , x k + 1 ] \begin{aligned} I(f)-T_n(f) &= \sum_{k=0}^{n-1}\int_{x_k}^{x_{k+1}}f(x)dx - \sum_{k=0}^{n-1}\frac{h}{2}[f(x_k)+f(x_{k+1})] \\ &= \sum_{k=0}^{n-1}[-\frac{h^3}{12}f^{''}(\eta_k)],\ \eta_k \in [x_k, x_{k+1}] \end{aligned} I(f)−Tn​(f)​=k=0∑n−1​∫xk​xk+1​​f(x)dx−k=0∑n−1​2h​[f(xk​)+f(xk+1​)]=k=0∑n−1​[−12h3​f′′(ηk​)], ηk​∈[xk​,xk+1​]​
设 f ( x ) ∈ C 2 [ a , b ] f(x) \in C^2[a, b] f(x)∈C2[a,b],则由连续函数介值定理, ∃ η ∈ ( a , b ) \exists \eta \in (a, b) ∃η∈(a,b),使 1 n ∑ k = 0 n − 1 f ′ ′ ( η k ) = f ′ ′ ( η ) \frac{1}{n}\sum_{k=0}^{n-1}f^{''}(\eta_k)=f^{''}(\eta) n1​∑k=0n−1​f′′(ηk​)=f′′(η),故 T n ( f ) T_n(f) Tn​(f) 的截断误差为
I ( f ) − T n ( f ) = − h 3 12 n f ′ ′ ( η ) = − b − a 12 h 2 f ′ ′ ( η ) I(f)-T_n(f) = -\frac{h^3}{12}nf^{''}(\eta) = -\frac{b-a}{12}h^2f^{''}(\eta) I(f)−Tn​(f)=−12h3​nf′′(η)=−12b−a​h2f′′(η)

∣ I ( f ) − T n ( f ) ∣ = b − a 12 h 2 ∣ f ′ ′ ( η ) ∣ ≤ b − a 12 M 2 h 2 ≤ ϵ |I(f)-T_n(f)| = \frac{b-a}{12}h^2|f^{''}(\eta)| \le \frac{b-a}{12}M_2h^2 \le \epsilon ∣I(f)−Tn​(f)∣=12b−a​h2∣f′′(η)∣≤12b−a​M2​h2≤ϵ

复化 Simpson 公式

记 x k + 1 2 = 1 2 ( x k + x k + 1 ) x_{k+\frac{1}{2}} = \frac{1}{2}(x_k+x_{k+1}) xk+21​​=21​(xk​+xk+1​),对每个小区间上积分 ∫ x k x k + 1 f ( x ) d x \int_{x_k}^{x_{k+1}}f(x)dx ∫xk​xk+1​​f(x)dx 应用 Simpson 公式即可得到复化 Simpson 公式
S n ( f ) = ∑ k = 0 n − 1 h 6 [ f ( x k ) + 4 f ( x k + 1 2 ) + f ( x k + 1 ) ] S_n(f) = \sum_{k=0}^{n-1}\frac{h}{6}[f(x_k)+4f(x_{k+\frac{1}{2}})+f(x_{k+1})] Sn​(f)=k=0∑n−1​6h​[f(xk​)+4f(xk+21​​)+f(xk+1​)]
其截断误差为
I ( f ) − S n ( f ) = ∑ k = 0 n − 1 − h 180 ( h 2 ) 4 f ( 4 ) ( η k ) = − h 180 ( h 2 ) 4 ∑ k = 0 n − 1 f ( 4 ) ( η k ) ,   η k ∈ [ x k , x k + 1 ] I(f)-S_n(f) = \sum_{k=0}^{n-1}-\frac{h}{180}(\frac{h}{2})^4f^{(4)}(\eta_k) = -\frac{h}{180}(\frac{h}{2})^4\sum_{k=0}^{n-1}f^{(4)}(\eta_k) ,\ \eta_k \in [x_k, x_{k+1}] I(f)−Sn​(f)=k=0∑n−1​−180h​(2h​)4f(4)(ηk​)=−180h​(2h​)4k=0∑n−1​f(4)(ηk​), ηk​∈[xk​,xk+1​]
设 f ( x ) ∈ C 4 [ a , b ] f(x) \in C^4[a, b] f(x)∈C4[a,b],由连续函数介值定理, ∃ η ∈ ( a , b ) \exists \eta \in (a,b) ∃η∈(a,b),使 1 n ∑ k = 0 n − 1 f ( 4 ) ( η k ) = f ( 4 ) ( η ) \frac{1}{n}\sum_{k=0}^{n-1}f^{(4)}(\eta_k) = f^{(4)}(\eta) n1​∑k=0n−1​f(4)(ηk​)=f(4)(η),故 S n ( f ) S_n(f) Sn​(f) 的截断误差为
I ( f ) − S n ( f ) = − h 180 ( h 2 ) 4 n f ( 4 ) ( η ) = − b − a 180 ( h 2 ) 4 f ( 4 ) ( η ) ,   η ∈ ( a , b ) I(f)-S_n(f)=-\frac{h}{180}(\frac{h}{2})^4nf^{(4)}(\eta)=-\frac{b-a}{180}(\frac{h}{2})^4f^{(4)}(\eta),\ \eta \in (a, b) I(f)−Sn​(f)=−180h​(2h​)4nf(4)(η)=−180b−a​(2h​)4f(4)(η), η∈(a,b)

∣ I ( f ) − S n ( f ) ∣ ≤ b − a 180 ( h 2 ) 4 M 4 ≤ ϵ |I(f)-S_n(f)| \le \frac{b-a}{180}(\frac{h}{2})^4M_4 \le \epsilon ∣I(f)−Sn​(f)∣≤180b−a​(2h​)4M4​≤ϵ

复化 Cotes 公式(*)

记 x k + 1 4 = x k + 1 4 h ,   x k + 1 2 = x k + 1 2 h ,   x k + 3 4 = x k + 3 4 h x_{k+\frac{1}{4}}=x_k+\frac{1}{4}h,\ x_{k+\frac{1}{2}}=x_k+\frac{1}{2}h,\ x_{k+\frac{3}{4}}=x_k+\frac{3}{4}h xk+41​​=xk​+41​h, xk+21​​=xk​+21​h, xk+43​​=xk​+43​h,对积分 ∫ x k x k + 1 f ( x ) d x \int_{x_k}^{x_{k+1}}f(x)dx ∫xk​xk+1​​f(x)dx 应用 Cotes 公式即可得到复化 Cotes 公式
C n ( f ) = ∑ k = 0 n − 1 h 90 [ 7 f ( x k ) + 32 f ( x x + 1 4 ) + 12 f ( x k + 1 2 ) + 32 f ( x k + 3 4 ) + 7 f ( x k + 1 ) ] C_n(f) = \sum_{k=0}^{n-1}\frac{h}{90}[7f(x_k)+32f(x_{x+\frac{1}{4}})+12f(x_{k+\frac{1}{2}})+32f(x_{k+\frac{3}{4}})+7f(x_{k+1})] Cn​(f)=k=0∑n−1​90h​[7f(xk​)+32f(xx+41​​)+12f(xk+21​​)+32f(xk+43​​)+7f(xk+1​)]
其截断误差为
I ( f ) − C n ( f ) = − 2 ( b − a ) 945 ( h 2 ) 6 f ( 6 ) ( η ) ,   η ∈ ( a , b ) I(f)-C_n(f)=-\frac{2(b-a)}{945}(\frac{h}{2})^6f^{(6)}(\eta),\ \eta \in (a, b) I(f)−Cn​(f)=−9452(b−a)​(2h​)6f(6)(η), η∈(a,b)
当 h 很小时有

复化求积公式的阶数

设有计算积分 I ( f ) I(f) I(f) 的复化求积公式 I n ( f ) I_n(f) In​(f),如果存在正整数 p p p 和非零常数 C C C,使
lim ⁡ h → 0 I ( f ) − I n ( f ) h p = C \lim_{h \rightarrow 0} \frac{I(f)-I_n(f)}{h^p}=C h→0lim​hpI(f)−In​(f)​=C
则称公式 I n ( f ) I_n(f) In​(f) 是 p p p 阶的,即截断误差为: R ( f ) = I ( f ) − I n ( f ) = O ( h p ) R(f)=I(f)-I_n(f)=O(h^p) R(f)=I(f)−In​(f)=O(hp)

Gauss 求积公式

设 I ( f ) = ∫ a b f ( x ) d x I(f)=\int_a^b f(x)dx I(f)=∫ab​f(x)dx, I n ( f ) = ∑ k = 0 n A k f ( x k ) I_n(f)=\sum_{k=0}^nA_kf(x_k) In​(f)=∑k=0n​Ak​f(xk​), I n ( f ) I_n(f) In​(f) 是求积公式 I ( f ) I(f) I(f) 的求积公式,如果求积公式 I n ( f ) I_n(f) In​(f) 的代数精度是 (2n+1),则称该公式为 Gauss-Legendre 公式,简称 Gauss 公式,对应的求积点 x k ( k = 0 , 1 , . . . , n ) x_k(k=0,1,...,n) xk​(k=0,1,...,n) 称为 Gauss 点。由代数精度知,求积公式 I ( f ) ≈ I n ( f ) I(f) \approx I_n(f) I(f)≈In​(f) 的代数精度为
( 2 n + 1 ) ↔ ∫ a b x i d x = ∑ k = 0 n A k x k i ,    i = 0 , 1 , . . . , 2 n + 1 (2n+1) \leftrightarrow \int_a^bx^idx=\sum_{k=0}^nA_kx_k^i, \ \ i=0,1,...,2n+1 (2n+1)↔∫ab​xidx=k=0∑n​Ak​xki​,  i=0,1,...,2n+1
例1:考虑求积公式 ∫ − 1 1 f ( x ) d x ≈ A 0 f ( x 0 ) + A 1 f ( x 1 ) \int_{-1}^1 f(x) dx \approx A_0f(x_0)+A_1f(x_1) ∫−11​f(x)dx≈A0​f(x0​)+A1​f(x1​) 决定求积系数 A 0 A_0 A0​, A 1 A_1 A1​ 和求积点 x 0 x_0 x0​, x 1 x_1 x1​,使其成为 2 点 Gauss 公式

:n = 1,即要使公式的代数精度为 2+1=3,由代数精度可得
f ( x ) = 1 , A 0 + A 1 = ∫ − 1 1 1 d x = 2 f ( x ) = x , A 0 x 0 + A 1 x 1 = ∫ − 1 1 x d x = 0 f ( x ) = x 2 , A 0 x 0 2 + A 1 x 1 2 = ∫ − 1 1 x 2 d x = 2 3 f ( x ) = x 3 , A 0 x 0 3 + A 1 x 1 3 = ∫ − 1 1 x 3 d x = 0 \begin{aligned} f(x) &= 1,\quad A_0+A_1=\int_{-1}^1 1dx=2 \\ f(x) &= x,\quad A_0x_0+A_1x_1=\int_{-1}^1 xdx=0 \\ f(x) &= x^2,\quad A_0x_0^2+A_1x_1^2=\int_{-1}^1x^2dx=\frac{2}{3} \\ f(x) &= x^3,\quad A_0x_0^3+A_1x_1^3=\int_{-1}^1 x^3 dx = 0 \end{aligned} f(x)f(x)f(x)f(x)​=1,A0​+A1​=∫−11​1dx=2=x,A0​x0​+A1​x1​=∫−11​xdx=0=x2,A0​x02​+A1​x12​=∫−11​x2dx=32​=x3,A0​x03​+A1​x13​=∫−11​x3dx=0​
求得 A 0 = A 1 = 1 A_0=A_1=1 A0​=A1​=1, x 0 = − 1 3 x_0=-\frac{1}{\sqrt{3}} x0​=−3 ​1​, x 1 = 1 3 x_1=\frac{1}{\sqrt{3}} x1​=3 ​1​,故 [ − 1 , 1 ] [-1,1] [−1,1] 上两点 Gauss 公式
∫ − 1 1 f ( x ) d x ≈ f ( − 1 3 ) + f ( 1 3 ) \int_{-1}^1f(x)dx \approx f(-\frac{1}{\sqrt{3}})+f(\frac{1}{\sqrt{3}}) ∫−11​f(x)dx≈f(−3 ​1​)+f(3 ​1​)

W n + 1 ( x ) = ( x − x 0 ) ( x − x 1 ) . . . ( x − x n ) W_{n+1}(x)=(x-x_0)(x-x_1)...(x-x_n) Wn+1​(x)=(x−x0​)(x−x1​)...(x−xn​)

则求积公式 I ( f ) ≈ I n ( f ) I(f) \approx I_n(f) I(f)≈In​(f) 是 Gauss 求积公式 ↔ \leftrightarrow ↔ W n + 1 ( x ) W_{n+1}(x) Wn+1​(x) 与任意一个次数不超过 n n n 的多项式 p ( x ) p(x) p(x) 正交,即
∫ a b p ( x ) W n + 1 ( x ) d x = 0 \int_a^bp(x)W_{n+1}(x)dx = 0 ∫ab​p(x)Wn+1​(x)dx=0

( g i , g j ) = ∫ a b g i ( x ) g j ( x ) d x = 0 (g_i, g_j) = \int_a^bg_i(x)g_j(x)dx=0 (gi​,gj​)=∫ab​gi​(x)gj​(x)dx=0

则称 { g k ( x ) } k = 0 ∞ \{g_k(x)\}_{k=0}^\infty {gk​(x)}k=0∞​ 为区间 [ a , b ] [a,b] [a,b] 上的正交多项式序列,称 g n ( x ) g_n(x) gn​(x) 为区间 [ a , b ] [a,b] [a,b] 上的 n n n 次正交多项式

n 次勒让德(Legendre)多项式
P n ( t ) = 1 2 n n ! d n ( t 2 − 1 ) n d t n ,   n = 0 , 1 , 2 , . . . P_n(t) = \frac{1}{2^nn!}\frac{d^n(t^2-1)^n}{dt^n},\ n=0,1,2,... Pn​(t)=2nn!1​dtndn(t2−1)n​, n=0,1,2,...

区间 [ − 1 , 1 ] [-1,1] [−1,1] 上的 Gauss 公式

I ( g ) ≈ ∫ − 1 1 g ( t ) d t ≈ ∑ k = 0 n A k ~ g ( t k ) A k ~ = ∫ − 1 1 ∏ j = 0 , j ≠ k n t − t j t k − t j d t ,   k = 0 , 1 , . . . , n \begin{aligned} I(g) &\approx \int_{-1}^1g(t)dt \approx \sum_{k=0}^n \tilde{A_k}g(t_k) \\ \tilde{A_k} &= \int_{-1}^1 \prod_{j=0,j \ne k}^n \frac{t-t_j}{t_k-t_j}dt,\ k = 0,1,...,n \end{aligned} I(g)Ak​~​​≈∫−11​g(t)dt≈k=0∑n​Ak​~​g(tk​)=∫−11​j=0,j​=k∏n​tk​−tj​t−tj​​dt, k=0,1,...,n​

∫ − 1 1 g ( t ) d t ≈ 2 g ( 0 ) \int_{-1}^1g(t)dt \approx 2g(0) ∫−11​g(t)dt≈2g(0)

∫ − 1 1 g ( t ) d t ≈ g ( − 1 3 ) + g ( 1 3 ) \int_{-1}^1 g(t)dt \approx g(-\frac{1}{\sqrt{3}})+g(\frac{1}{\sqrt{3}}) ∫−11​g(t)dt≈g(−3 ​1​)+g(3 ​1​)

∫ − 1 1 g ( t ) d t ≈ 5 9 g ( − 3 5 ) + 8 9 g ( 0 ) + 5 9 g ( 3 5 ) \int_{-1}^1 g(t)dt \approx \frac{5}{9}g(-\sqrt{\frac{3}{5}})+\frac{8}{9}g(0)+\frac{5}{9}g(\sqrt{\frac{3}{5}}) ∫−11​g(t)dt≈95​g(−53​ ​)+98​g(0)+95​g(53​ ​)

区间 [ a , b ] [a,b] [a,b] 上的 Gauss 公式

作变换 x = a + b 2 + b − a 2 t \pmb{x=\frac{a+b}{2}+\frac{b-a}{2}t} x=2a+b​+2b−a​t​x=2a+b​+2b−a​t​​x=2a+b​+2b−a​t,可得
I ( f ) = ∫ a b f ( x ) d x = ∫ − 1 1 b − a 2 f ( a + b 2 + b − a 2 t ) d t I(f) = \int_a^b f(x)dx = \int_{-1}^1\frac{b-a}{2}f(\frac{a+b}{2}+\frac{b-a}{2}t)dt I(f)=∫ab​f(x)dx=∫−11​2b−a​f(2a+b​+2b−a​t)dt
由 [ − 1 , 1 ] [-1,1] [−1,1] 上的 Gauss 公式得 [ a , b ] [a, b] [a,b] 上的 Gauss 公式为
I n ( f ) = ∑ k = 0 n b − a 2 A k ~ f ( a + b 2 + b − a 2 t k ) I_n(f) = \sum_{k=0}^n\frac{b-a}{2}\tilde{A_k}f(\frac{a+b}{2}+\frac{b-a}{2}t_k) In​(f)=k=0∑n​2b−a​Ak​~​f(2a+b​+2b−a​tk​)

Gauss 公式的截断误差

设 f ( x ) ∈ C 2 n + 2 [ a , b ] f(x) \in C^{2n+2}[a,b] f(x)∈C2n+2[a,b],则 Gauss 公式 ∫ a b f ( x ) d x ≈ ∑ k = 0 n A k f ( x k ) \int_a^bf(x)dx \approx \sum_{k=0}^nA_kf(x_k) ∫ab​f(x)dx≈∑k=0n​Ak​f(xk​) 的截断误差为
R ( f ) = ∫ a b f ( x ) d x − ∑ k = 0 n A k f ( x k ) = f ( 2 n + 2 ) ( ξ ) ( 2 n + 2 ) ! ∫ a b W n + 1 2 ( x ) d x R(f) = \int_a^bf(x)dx - \sum_{k=0}^nA_kf(x_k) = \frac{f^{(2n+2)}(\xi)}{(2n+2)!}\int_a^bW_{n+1}^2(x)dx R(f)=∫ab​f(x)dx−k=0∑n​Ak​f(xk​)=(2n+2)!f(2n+2)(ξ)​∫ab​Wn+12​(x)dx

其中, W n + 1 ( x ) = ∏ j = 0 n ( x − x j ) ,   ξ ∈ ( a , b ) W_{n+1}(x)=\prod_{j=0}^n(x-x_j),\ \xi\in(a,b) Wn+1​(x)=∏j=0n​(x−xj​), ξ∈(a,b)

Gauss 公式的稳定性和收敛性

I n ( f ~ ) = ∑ k = 0 n A k f k ~ I_n(\tilde{f}) = \sum_{k=0}^n A_k \tilde{f_k} In​(f~​)=k=0∑n​Ak​fk​~​

复化 Gauss

TODO

数值微分

f ′ ( x 0 ) ≈ f ( x 0 + h ) − f ( x 0 ) h , ( 向 前 差 商 ) f ′ ( x 0 ) ≈ f ( x 0 ) − f ( x 0 − h ) h , ( 向 后 差 商 ) f ′ ( x 0 ) ≈ f ( x 0 + h ) − f ( x 0 − h ) 2 h , ( 中 心 差 商 ) \begin{aligned} f^{'}(x_0) &\approx \frac{f(x_0+h)-f(x_0)}{h}, \quad (向前差商) \\ f^{'}(x_0) &\approx \frac{f(x_0)-f(x_0-h)}{h}, \quad (向后差商) \\ f^{'}(x_0) &\approx \frac{f(x_0+h)-f(x_0-h)}{2h}, \quad (中心差商) \end{aligned} f′(x0​)f′(x0​)f′(x0​)​≈hf(x0​+h)−f(x0​)​,(向前差商)≈hf(x0​)−f(x0​−h)​,(向后差商)≈2hf(x0​+h)−f(x0​−h)​,(中心差商)​

将 f ( x 0 + h ) f(x_0+h) f(x0​+h), f ( x 0 − h ) f(x_0-h) f(x0​−h) 在 x 0 x_0 x0​ 点 Taylor 展开,可以得
f ′ ( x 0 ) − f ( x 0 + h ) − f ( x 0 ) h = − h 2 f ′ ′ ( x 0 ) + O ( h 2 ) f ′ ( x 0 ) − f ( x 0 ) − f ( x 0 − h ) h = h 2 f ′ ′ ( x 0 ) + O ( h 2 ) f ′ ( x 0 ) − f ( x 0 + h ) − f ( x 0 − h ) 2 h = − h 2 6 f ′ ′ ′ ( x 0 ) + O ( h 3 ) \begin{aligned} f^{'}(x_0) - \frac{f(x_0+h)-f(x_0)}{h} &= -\frac{h}{2}f^{''}(x_0)+O(h^2) \\ f^{'}(x_0) - \frac{f(x_0)-f(x_0-h)}{h} &= \frac{h}{2}f^{''}(x_0)+O(h^2) \\ f^{'}(x_0) - \frac{f(x_0+h)-f(x_0-h)}{2h} &= -\frac{h^2}{6}f^{'''}(x_0)+O(h^3) \end{aligned} f′(x0​)−hf(x0​+h)−f(x0​)​f′(x0​)−hf(x0​)−f(x0​−h)​f′(x0​)−2hf(x0​+h)−f(x0​−h)​​=−2h​f′′(x0​)+O(h2)=2h​f′′(x0​)+O(h2)=−6h2​f′′′(x0​)+O(h3)​

标签:xk,数值积分,frac,复习,int,公式,sum,数值,dx
来源: https://blog.csdn.net/steven_ysh/article/details/122268727